public ScriptParser(DbInterpreter dbInterpreter, string script) { this.dbInterpreter = dbInterpreter; this.originalScript = script; this.Parse(); }
private async void SetupIntellisence() { if (this.CheckConnection()) { DbInterpreterOption option = new DbInterpreterOption() { ObjectFetchMode = DatabaseObjectFetchMode.Simple }; DbInterpreter dbInterpreter = DbInterpreterHelper.GetDbInterpreter(this.displayInfo.DatabaseType, this.displayInfo.ConnectionInfo, option); this.queryEditor.DbInterpreter = dbInterpreter; SchemaInfoFilter filter = new SchemaInfoFilter() { DatabaseObjectType = DatabaseObjectType.Table | DatabaseObjectType.Function | DatabaseObjectType.View | DatabaseObjectType.TableColumn }; SchemaInfo schemaInfo = await dbInterpreter.GetSchemaInfoAsync(filter); DataStore.SetSchemaInfo(this.displayInfo.DatabaseType, schemaInfo); this.queryEditor.SetupIntellisence(); } }
private async Task AddDbObjectNodes(TreeNode parentNode, string database, DatabaseObjectType databaseObjectType = DatabaseObjectType.None, bool createFolderNode = true) { DbInterpreter dbInterpreter = this.GetDbInterpreter(database); SchemaInfo schemaInfo = databaseObjectType == DatabaseObjectType.None ? new SchemaInfo() : await dbInterpreter.GetSchemaInfoAsync(new SchemaInfoFilter() { DatabaseObjectType = databaseObjectType }); this.ClearNodes(parentNode); this.AddTreeNodes(parentNode, databaseObjectType, DatabaseObjectType.Table, schemaInfo.Tables, createFolderNode, true); this.AddTreeNodes(parentNode, databaseObjectType, DatabaseObjectType.View, schemaInfo.Views, createFolderNode); this.AddTreeNodes(parentNode, databaseObjectType, DatabaseObjectType.Function, schemaInfo.Functions, createFolderNode); this.AddTreeNodes(parentNode, databaseObjectType, DatabaseObjectType.Procedure, schemaInfo.Procedures, createFolderNode); foreach (UserDefinedType userDefinedType in schemaInfo.UserDefinedTypes) { string text = $"{userDefinedType.Name}({userDefinedType.Type})"; string imageKeyName = nameof(userDefinedType); TreeNode node = DbObjectsTreeHelper.CreateTreeNode(userDefinedType.Name, text, imageKeyName); node.Tag = userDefinedType; parentNode.Nodes.Add(node); } }
public ScriptTokenProcessor(CommonScript script, ScriptDbObject dbObject, DbInterpreter sourceInterpreter, DbInterpreter targetInterpreter) { this.Script = script; this.DbObject = dbObject; this.SourceInterpreter = sourceInterpreter; this.TargetInterpreter = targetInterpreter; }
public async Task <bool> TestConnect() { if (!this.ValidateInfo()) { return(false); } ConnectionInfo connectionInfo = this.GetConnectionInfo(); DbInterpreter dbInterpreter = DbInterpreterHelper.GetDbInterpreter(this.DatabaseType, connectionInfo, new DbInterpreterOption()); try { using (DbConnection dbConnection = dbInterpreter.CreateConnection()) { await dbConnection.OpenAsync(); MessageBox.Show("Success."); if (this.OnTestConnect != null) { this.OnTestConnect(); } return(true); } } catch (Exception ex) { MessageBox.Show("Failed:" + ex.Message); return(false); } }
private async Task <bool> IsNameExisted() { DatabaseType databaseType = this.rbAnotherDatabase.Checked ? this.ucConnection.DatabaseType : this.DatabaseType; ConnectionInfo connectionInfo = this.rbAnotherDatabase.Checked ? this.targetDbConnectionInfo : this.ConnectionInfo; DbInterpreterOption option = new DbInterpreterOption() { ObjectFetchMode = DatabaseObjectFetchMode.Simple }; DbInterpreter dbInterpreter = DbInterpreterHelper.GetDbInterpreter(databaseType, connectionInfo, option); SchemaInfoFilter filter = new SchemaInfoFilter() { TableNames = new string[] { this.txtName.Text.Trim() } }; var tables = await dbInterpreter.GetTablesAsync(filter); if (tables.Count > 0) { return(true); } return(false); }
private void tvDbObjects_ItemDrag(object sender, ItemDragEventArgs e) { if (e.Button == MouseButtons.Left) { TreeNode treeNode = e.Item as TreeNode; if (treeNode != null && treeNode.Tag is DatabaseObject) { string text = treeNode.Text; int index = text.IndexOf('('); if (index > 0) { text = text.Substring(0, index); } DbInterpreter dbInterpreter = this.GetDbInterpreter(this.GetDatabaseNode(treeNode).Name); string[] items = text.Trim().Split('.'); items[items.Length - 1] = dbInterpreter.GetQuotedString(items[items.Length - 1]); DoDragDrop(string.Join(".", items), DragDropEffects.Move); } } }
public void InitControls(DbInterpreter dbInterpreter) { if (this.inited) { return; } var types = Enum.GetValues(typeof(IndexType)); List <string> typeNames = new List <string>(); foreach (var type in types) { if (dbInterpreter.IndexType.HasFlag((IndexType)type) && (IndexType)type != IndexType.None) { typeNames.Add(type.ToString()); if (type.ToString() != IndexType.Primary.ToString()) { this.lbIndexType.Items.Add(type.ToString()); } } } this.colType.DataSource = typeNames; if (this.DatabaseType == DatabaseType.Oracle) { this.colComment.Visible = false; } this.inited = true; }
private async void btnTest_Click(object sender, EventArgs e) { ConnectionInfo connectionInfo = this.GetConnectionInfo(); DbInterpreter dbInterpreter = DbInterpreterHelper.GetDbInterpreter(this.DatabaseType, connectionInfo, new DbInterpreterOption()); string oldDatabase = this.cboDatabase.Text; try { using (DbConnection dbConnection = dbInterpreter.GetDbConnector().CreateConnection()) { dbConnection.Open(); MessageBox.Show("Success."); this.cboDatabase.Items.Clear(); List <Database> databaseses = await dbInterpreter.GetDatabasesAsync(); databaseses.ForEach(item => { this.cboDatabase.Items.Add(item.Name); }); this.cboDatabase.Text = oldDatabase; } } catch (Exception ex) { MessageBox.Show("Failed:" + ex.Message); } }
private async void ShowColumnMappingSelector(string referenceTableName, List <ForeignKeyColumn> mappings) { frmColumnMapping form = new frmColumnMapping() { ReferenceTableName = referenceTableName, TableName = this.txtTableName.Text.Trim(), Mappings = mappings }; IEnumerable <TableColumnDesingerInfo> columns = this.ucColumns.GetColumns().Where(item => !string.IsNullOrEmpty(item.Name)); form.TableColumns = columns.OrderBy(item => item.Name).Select(item => item.Name).ToList(); DbInterpreter dbInterpreter = this.GetDbInterpreter(); dbInterpreter.Option.ObjectFetchMode = DatabaseObjectFetchMode.Simple; SchemaInfoFilter filter = new SchemaInfoFilter() { TableNames = new string[] { referenceTableName } }; List <TableColumn> referenceTableColumns = await dbInterpreter.GetTableColumnsAsync(filter); if (referenceTableName == this.selfTableName) { form.ReferenceTableColumns = this.ucColumns.GetColumns().Select(item => item.Name).ToList(); } else { form.ReferenceTableColumns = referenceTableColumns.Select(item => item.Name).ToList(); } if (form.ShowDialog() == DialogResult.OK) { this.ucForeignKeys.SetRowColumns(form.Mappings); } }
private async void TestConnect() { ConnectionInfo connectionInfo = this.GetConnectionInfo(); DbInterpreter dbInterpreter = DbInterpreterHelper.GetDbInterpreter(this.DatabaseType, connectionInfo, new DbInterpreterOption()); string oldDatabase = this.cboDatabase.Text; try { this.cboDatabase.Items.Clear(); List <Database> databaseses = await dbInterpreter.GetDatabasesAsync(); databaseses.ForEach(item => { this.cboDatabase.Items.Add(item.Name); }); this.cboDatabase.Text = oldDatabase; } catch (Exception ex) { MessageBox.Show("Failed:" + ex.Message); } }
private void btnTest_Click(object sender, EventArgs e) { ConnectionInfo connectionInfo = this.GetConnectionInfo(); DbInterpreter dbInterpreter = DbInterpreterHelper.GetDbInterpreter(this.DatabaseType, connectionInfo, new GenerateScriptOption()); try { using (DbConnection dbConnection = dbInterpreter.GetDbConnector().CreateConnection()) { dbConnection.Open(); MessageBox.Show("Success."); if (string.IsNullOrEmpty(this.cboDatabase.Text.Trim())) { this.cboDatabase.Items.Clear(); List <Database> databaseses = dbInterpreter.GetDatabases(); databaseses.ForEach(item => { this.cboDatabase.Items.Add(item.Name); }); } } } catch (Exception ex) { MessageBox.Show("Failed:" + ex.Message); } }
private async void LoadData(DatabaseObjectDisplayInfo displayInfo, long pageNum = 1, bool isSort = false) { this.displayInfo = displayInfo; this.pagination.PageNum = pageNum; Table table = displayInfo.DatabaseObject as Table; int pageSize = this.pagination.PageSize; DbInterpreter dbInterpreter = DbInterpreterHelper.GetDbInterpreter(displayInfo.DatabaseType, displayInfo.ConnectionInfo, new DbInterpreterOption()); string orderColumns = ""; if (this.dgvData.SortedColumn != null) { string sortOrder = (this.sortOrder == SortOrder.Descending ? "DESC" : "ASC"); orderColumns = $"{dbInterpreter.GetQuotedString(this.dgvData.SortedColumn.Name)} {sortOrder}"; } string conditionClause = ""; if (this.conditionBuilder != null && this.conditionBuilder.Conditions.Count > 0) { this.conditionBuilder.QuotationLeftChar = dbInterpreter.QuotationLeftChar; this.conditionBuilder.QuotationRightChar = dbInterpreter.QuotationRightChar; conditionClause = "WHERE " + this.conditionBuilder.ToString(); } (long Total, DataTable Data)result = await dbInterpreter.GetPagedDataTableAsync(table, orderColumns, pageSize, pageNum, conditionClause); this.pagination.TotalCount = result.Total; this.dgvData.DataSource = DataGridViewHelper.ConvertDataTable(result.Data); foreach (DataGridViewColumn column in this.dgvData.Columns) { Type valueType = column.ValueType; if (valueType == typeof(byte[]) || valueType.Name == "SqlGeography") { column.SortMode = DataGridViewColumnSortMode.NotSortable; } } if (this.sortedColumnIndex != -1) { DataGridViewColumn column = this.dgvData.Columns[this.sortedColumnIndex]; this.isSorting = true; ListSortDirection sortDirection = this.GetSortDirection(this.sortOrder); this.dgvData.Sort(column, sortDirection); this.isSorting = false; } }
private TableManager GetTableManager() { DbInterpreter dbInterpreter = this.GetDbInterpreter(); TableManager tableManager = new TableManager(dbInterpreter); return(tableManager); }
public ColumnTranslator(DbInterpreter sourceInterpreter, DbInterpreter targetInterpreter, List <TableColumn> columns) : base(sourceInterpreter, targetInterpreter) { this.columns = columns; this.sourceDbType = sourceInterpreter.DatabaseType; this.targetDbType = targetInterpreter.DatabaseType; this.sourceDataTypeSpecs = DataTypeManager.GetDataTypeSpecifications(this.sourceDbType); this.targetDataTypeSpecs = DataTypeManager.GetDataTypeSpecifications(this.targetDbType); }
public DbSynchro(DbInterpreter sourceInterpreter, DbInterpreter targetInterpreter) { this.sourceInterpreter = sourceInterpreter; this.targetInterpreter = targetInterpreter; this.tableManager = new TableManager(this.targetInterpreter); this.targetScriptGenerator = DbScriptGeneratorHelper.GetDbScriptGenerator(targetInterpreter); }
protected virtual string GetTableColumnEmptySql(DbInterpreter interpreter, TableColumn column, bool isCount) { string tableName = $"{column.Owner}.{interpreter.GetQuotedString(column.TableName)}"; string selectColumn = isCount ? $"{this.GetStringNullFunction()}(COUNT(1),0) AS {interpreter.GetQuotedString("Count")}" : "*"; string sql = $"SELECT {selectColumn} FROM {tableName} WHERE {this.GetStringLengthFunction()}({interpreter.GetQuotedString(column.Name)})=0"; return(sql); }
private void LoadSourceDbSchemaInfo() { this.tvSource.Nodes.Clear(); DatabaseType dbType = this.GetDatabaseType(this.cboSourceDB.Text); DbInterpreter dbInterpreter = DbInterpreterHelper.GetDbInterpreter(dbType, this.sourceDbConnectionInfo, new GenerateScriptOption()); if (dbInterpreter is SqlServerInterpreter) { List <UserDefinedType> userDefinedTypes = dbInterpreter.GetUserDefinedTypes(); if (userDefinedTypes.Count > 0) { TreeNode userDefinedRootNode = new TreeNode("User Defined Types"); userDefinedRootNode.Name = nameof(UserDefinedType); this.tvSource.Nodes.Add(userDefinedRootNode); foreach (UserDefinedType userDefinedType in userDefinedTypes) { TreeNode node = new TreeNode(); node.Tag = userDefinedType; node.Text = $"{userDefinedType.Owner}.{userDefinedType.Name}"; userDefinedRootNode.Nodes.Add(node); } } } TreeNode tableRootNode = new TreeNode("Tables"); tableRootNode.Name = nameof(Table); this.tvSource.Nodes.Add(tableRootNode); List <Table> tables = dbInterpreter.GetTables(); foreach (Table table in tables) { TreeNode tableNode = new TreeNode(); tableNode.Tag = table; tableNode.Text = dbInterpreter.GetObjectDisplayName(table, false); tableRootNode.Nodes.Add(tableNode); } TreeNode viewRootNode = new TreeNode("Views"); viewRootNode.Name = nameof(DatabaseMigration.Core.View); this.tvSource.Nodes.Add(viewRootNode); List <DatabaseMigration.Core.View> views = ViewHelper.ResortViews(dbInterpreter.GetViews()); foreach (var view in views) { TreeNode viewNode = new TreeNode(); viewNode.Tag = view; viewNode.Text = dbInterpreter.GetObjectDisplayName(view, false); viewRootNode.Nodes.Add(viewNode); } }
public TranslateEngine(SchemaInfo sourceSchemaInfo, SchemaInfo targetSchemaInfo, DbInterpreter sourceInterpreter, DbInterpreter targetInerpreter, DbConverterOption option = null, string targetDbOwner = null) { this.sourceSchemaInfo = sourceSchemaInfo; this.targetSchemaInfo = targetSchemaInfo; this.sourceInterpreter = sourceInterpreter; this.targetInerpreter = targetInerpreter; this.targetDbOwner = targetDbOwner; this.option = option; }
protected virtual string GetTableColumnReferenceSql(DbInterpreter interpreter, TableForeignKey foreignKey, bool isCount) { string tableName = $"{foreignKey.Owner}.{interpreter.GetQuotedString(foreignKey.TableName)}"; string selectColumn = isCount ? $"{this.GetStringNullFunction()}(COUNT(1),0) AS {interpreter.GetQuotedString("Count")}" : "*"; string whereClause = string.Join(" AND ", foreignKey.Columns.Select(item => $"{interpreter.GetQuotedString(item.ColumnName)}={interpreter.GetQuotedString(item.ReferencedColumnName)}")); string sql = $"SELECT {selectColumn} FROM {tableName} WHERE ({whereClause})"; return(sql); }
public virtual async Task <DiagnoseResult> DiagnoseNotNullWithEmpty() { this.Feedback("Begin to diagnose not null fields with empty value..."); DiagnoseResult result = new DiagnoseResult(); DbInterpreterOption option = new DbInterpreterOption() { ObjectFetchMode = DatabaseObjectFetchMode.Simple }; DbInterpreter interpreter = DbInterpreterHelper.GetDbInterpreter(this.DatabaseType, this.connectionInfo, option); this.Feedback("Begin to get table columns..."); List <TableColumn> columns = await interpreter.GetTableColumnsAsync(); this.Feedback("End get table columns."); var groups = columns.Where(item => DataTypeHelper.IsCharType(item.DataType) && !item.IsNullable) .GroupBy(item => new { item.Owner, item.TableName }); using (DbConnection dbConnection = interpreter.CreateConnection()) { foreach (var group in groups) { foreach (TableColumn column in group) { string countSql = this.GetTableColumnEmptySql(interpreter, column, true); this.Feedback($@"Begin to get invalid record count for column ""{column.Name}"" of table ""{column.TableName}""..."); int count = Convert.ToInt32(await interpreter.GetScalarAsync(dbConnection, countSql)); this.Feedback($@"End get invalid record count for column ""{column.Name}"" of table ""{column.TableName}"", the count is {count}."); if (count > 0) { result.Details.Add(new DiagnoseResultItem() { DatabaseObject = column, RecordCount = count, Sql = this.GetTableColumnEmptySql(interpreter, column, false) }); } } } } this.Feedback("End diagnose not null fields with empty value."); return(result); }
public virtual async Task <DiagnoseResult> DiagnoseSelfReferenceSame() { this.Feedback("Begin to diagnose self reference with same value..."); DiagnoseResult result = new DiagnoseResult(); DbInterpreterOption option = new DbInterpreterOption() { ObjectFetchMode = DatabaseObjectFetchMode.Details }; DbInterpreter interpreter = DbInterpreterHelper.GetDbInterpreter(this.DatabaseType, this.connectionInfo, option); this.Feedback("Begin to get foreign keys..."); List <TableForeignKey> foreignKeys = await interpreter.GetTableForeignKeysAsync(); this.Feedback("End get foreign keys."); var groups = foreignKeys.Where(item => item.ReferencedTableName == item.TableName) .GroupBy(item => new { item.Owner, item.TableName }); using (DbConnection dbConnection = interpreter.CreateConnection()) { foreach (var group in groups) { foreach (TableForeignKey foreignKey in group) { string countSql = this.GetTableColumnReferenceSql(interpreter, foreignKey, true); this.Feedback($@"Begin to get invalid record count for foreign key ""{foreignKey.Name}"" of table ""{foreignKey.TableName}""..."); int count = Convert.ToInt32(await interpreter.GetScalarAsync(dbConnection, countSql)); this.Feedback($@"End get invalid record count for column ""{foreignKey.Name}"" of table ""{foreignKey.TableName}"", the count is {count}."); if (count > 0) { result.Details.Add(new DiagnoseResultItem() { DatabaseObject = foreignKey, RecordCount = count, Sql = this.GetTableColumnReferenceSql(interpreter, foreignKey, false) }); } } } } this.Feedback("End diagnose self reference with same value."); return(result); }
private void SourceScriptBackgroundWorker_DoWork(object sender, DoWorkEventArgs e) { if (this.sourceScriptBackgroundWorker.CancellationPending) { e.Cancel = true; return; } SchemaInfo schemaInfo = this.GetSourceTreeSchemaInfo(); if (!this.ValidateSource(schemaInfo)) { return; } DatabaseType sourceDbType = this.GetDatabaseType(this.cboSourceDB.Text); int dataBatchSize = SettingManager.Setting.DataBatchSize; GenerateScriptOption sourceScriptOption = new GenerateScriptOption() { ScriptOutputMode = GenerateScriptOutputMode.None, DataBatchSize = dataBatchSize }; this.SetGenerateScriptOption(sourceScriptOption); GenerateScriptMode scriptMode = this.GetGenerateScriptMode(); if (scriptMode == GenerateScriptMode.None) { MessageBox.Show("Please specify the script mode."); return; } DbInterpreter dbInterpreter = DbInterpreterHelper.GetDbInterpreter(sourceDbType, this.sourceDbConnectionInfo, sourceScriptOption); string[] tableNames = schemaInfo.Tables.Select(item => item.Name).ToArray(); schemaInfo = dbInterpreter.GetSchemaInfo(tableNames); dbInterpreter.Subscribe(this); if (scriptMode.HasFlag(GenerateScriptMode.Schema)) { dbInterpreter.GenerateSchemaScripts(schemaInfo); } if (scriptMode.HasFlag(GenerateScriptMode.Data)) { dbInterpreter.GenerateDataScripts(schemaInfo); } MessageBox.Show(DONE); }
public async Task Run(DbInterpreter dbInterpreter, IEnumerable <Script> scripts) { using (DbConnection dbConnection = dbInterpreter.CreateConnection()) { dbConnection.Open(); DbTransaction transaction = dbConnection.BeginTransaction(); Func <Script, bool> isValidScript = (s) => { return(!(s is NewLineSript || s is SpliterScript || string.IsNullOrEmpty(s.Content) || s.Content == dbInterpreter.ScriptsDelimiter)); }; int count = scripts.Where(item => isValidScript(item)).Count(); int i = 0; foreach (Script s in scripts) { if (!isValidScript(s)) { continue; } string sql = s.Content?.Trim(); if (!string.IsNullOrEmpty(sql) && sql != dbInterpreter.ScriptsDelimiter) { i++; if (dbInterpreter.ScriptsDelimiter.Length == 1 && sql.EndsWith(dbInterpreter.ScriptsDelimiter)) { sql = sql.TrimEnd(dbInterpreter.ScriptsDelimiter.ToArray()); } if (!dbInterpreter.HasError) { CommandInfo commandInfo = new CommandInfo() { CommandType = CommandType.Text, CommandText = sql, Transaction = transaction, CancellationToken = this.CancellationTokenSource.Token }; await dbInterpreter.ExecuteNonQueryAsync(dbConnection, commandInfo); } } } transaction.Commit(); } }
private async Task GenerateObjectScript(string database, DatabaseObject dbObj, ScriptAction scriptAction) { DbInterpreter dbInterpreter = this.GetDbInterpreter(database, false); ScriptGenerator scriptGenerator = new ScriptGenerator(dbInterpreter); string script = await scriptGenerator.Generate(dbObj, scriptAction); this.ShowContent(new DatabaseObjectDisplayInfo() { Name = dbObj.Name, DatabaseType = this.databaseType, DatabaseObject = dbObj, Content = script, ConnectionInfo = dbInterpreter.ConnectionInfo }); }
private void DoScript(DatabaseObjectType databaseObjectType, ScriptAction scriptAction) { DbInterpreter dbInterpreter = DbInterpreterHelper.GetDbInterpreter(this.databaseType, new ConnectionInfo(), new DbInterpreterOption()); ScriptTemplate scriptTemplate = new ScriptTemplate(dbInterpreter); DatabaseObjectDisplayInfo displayInfo = this.GetDisplayInfo(); displayInfo.IsNew = true; displayInfo.Content = scriptTemplate.GetTemplateContent(databaseObjectType, scriptAction); displayInfo.ScriptAction = scriptAction; this.ShowContent(displayInfo); }
private async void InitControls() { if (this.displayInfo.DatabaseType == DatabaseType.MySql) { this.tabControl1.TabPages.Remove(this.tabConstraints); } DbInterpreter dbInterpreter = this.GetDbInterpreter(); List <UserDefinedType> userDefinedTypes = await dbInterpreter.GetUserDefinedTypesAsync(); this.ucColumns.UserDefinedTypes = userDefinedTypes; this.ucColumns.InitControls(); if (this.displayInfo.IsNew) { this.LoadDatabaseOwners(); } else { this.cboOwner.Enabled = false; SchemaInfoFilter filter = new SchemaInfoFilter() { Strict = true, TableNames = new string[] { this.displayInfo.Name } }; filter.DatabaseObjectType = DatabaseObjectType.Table | DatabaseObjectType.TableColumn | DatabaseObjectType.TablePrimaryKey; SchemaInfo schemaInfo = await dbInterpreter.GetSchemaInfoAsync(filter); Table table = schemaInfo.Tables.FirstOrDefault(); if (table != null) { this.txtTableName.Text = table.Name; this.cboOwner.Text = table.Owner; this.txtTableComment.Text = table.Comment; #region Load Columns List <TableColumnDesingerInfo> columnDesingerInfos = ColumnManager.GetTableColumnDesingerInfos(dbInterpreter, table, schemaInfo.TableColumns, schemaInfo.TablePrimaryKeys); this.ucColumns.LoadColumns(table, columnDesingerInfos); #endregion } else { MessageBox.Show("Table is not existed"); } } }
private DbInterpreter GetDbInterpreter(string database, bool isSimpleMode = true) { ConnectionInfo connectionInfo = this.GetConnectionInfo(database); DbInterpreterOption option = isSimpleMode ? simpleInterpreterOption : new DbInterpreterOption() { ObjectFetchMode = DatabaseObjectFetchMode.Details }; option.ThrowExceptionWhenErrorOccurs = false; DbInterpreter dbInterpreter = DbInterpreterHelper.GetDbInterpreter(this.databaseType, connectionInfo, option); return(dbInterpreter); }
private async Task ClearData(string database) { DbInterpreter dbInterpreter = this.GetDbInterpreter(database); DbManager dbManager = new DbManager(dbInterpreter); dbManager.Subscribe(this); dbInterpreter.Subscribe(this); await dbManager.ClearData(); if (!dbInterpreter.HasError) { MessageBox.Show("Data has been cleared."); } }
private async Task EmptyDatabase(string database, DatabaseObjectType databaseObjectType) { DbInterpreter dbInterpreter = this.GetDbInterpreter(database); DbManager dbManager = new DbManager(dbInterpreter); dbInterpreter.Subscribe(this); dbManager.Subscribe(this); await dbManager.EmptyDatabase(databaseObjectType); if (!dbInterpreter.HasError) { MessageBox.Show("Seleted database objects have been deleted."); } }