private void Initialize(IDbContext dbContext) { _dbSchema = dbContext.PowerPlant.CreateDbSchema(); _commands = dbContext.PowerPlant.CreateCommands(); _dbSchema.DropTable(_testTable); }
public virtual void Setup() { PowerPlant = DbContext.PowerPlant; DbSchema = PowerPlant.CreateDbSchema(); ColumnFactory = PowerPlant.CreateColumnFactory(); TableName = "hmstestcolumntypes"; DbSchema.DropTable(TableName); }
private void CreateTable(string type, string sqlValue) { _dbSchema.DropTable(TableName); var stmt = $"create table {TableName} (col1 {type})"; _commands.ExecuteNonQuery(stmt); stmt = $"insert into {TableName} (col1) values ({sqlValue})"; _commands.ExecuteNonQuery(stmt); }
private bool ReadTable(string schemaFile) { var stopWatch = new Stopwatch(); stopWatch.Start(); string currentTableName; long rowCounter; try { var tableDefinition = GetTableDefinition(schemaFile); var raw16Columns = _dbContext.DbType == DbTypeName.Oracle ? tableDefinition.GetRaw16Columns() : new List <string>(); tableDefinition.Columns .FindAll(c => raw16Columns.Contains(c.Name)) .ForEach(c => c.Details["Length"] = 17); _dbSchema.DropTable(tableDefinition.Name); _dbSchema.CreateTable(tableDefinition); ClusteredIndexOnAgrtid(tableDefinition); currentTableName = tableDefinition.Name; _logger.Write($"{currentTableName,30} Started..."); var fileName = GetDataFileName(currentTableName); rowCounter = BulkLoadData(tableDefinition, fileName); WhenOracleAlterRawColumns(tableDefinition.Name, raw16Columns, 16); _dbSchema.CreateIndexes(tableDefinition.Indexes); } catch (Exception ex) { _logger.Write($"ERROR while reading table. Current schema file: {schemaFile}:"); _logger.Write(ex); return(false); } stopWatch.Stop(); var message = $"{currentTableName,30} {rowCounter,10} rows read. Time: {stopWatch.Elapsed}"; _logger.Write(message); return(true); }
public virtual void Cleanup() { DbSchema.DropTable(TableName); }
public virtual void Cleanup() { DbSchema.DropTable(TestTable); DeleteFiles(); }
public void Cleanup() { _dbSchema.DropTable(_testTable); }