public void CheckTable(MappingClass mapping, String db) { logger.Info("[access] begin check table"); OleDbConnection connection = DataFactory.GetConnection(_connectionString, this.DatabaseType) as OleDbConnection; connection.Open(); IDbCommand cmd = new OleDbCommand(); cmd.Connection = connection; object[] restrictions = new object[4]; restrictions[3] = "TABLE"; DataTable oleDbSchemaTable = connection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, restrictions); foreach (DataRow row in oleDbSchemaTable.Rows) { existTables.Add(row["TABLE_NAME"].ToString()); logger.Info("table found:" + row["TABLE_NAME"].ToString()); } existTables = new AccessTableBuilder().CheckMappingTableIsExist(cmd, db, existTables, mapping); connection.Close(); }
public void CheckTable(MappingClass mapping, String db) { logger.Info("[mysql] begin check table"); IDbConnection connection = DataFactory.GetConnection(_connectionString, this.DatabaseType); connection.Open(); IDbCommand cmd = connection.CreateCommand(); cmd.CommandText = "show tables"; IDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { existTables.Add(reader[0].ToString()); logger.Info("table found:" + reader[0].ToString()); } reader.Close(); existTables = new MySqlTableBuilder().CheckMappingTableIsExist(cmd, db, existTables, mapping); connection.Close(); }