예제 #1
0
        private void Initialize(IDbContext dbContext)
        {
            _dbSchema = dbContext.PowerPlant.CreateDbSchema();
            _commands = dbContext.PowerPlant.CreateCommands();

            _dbSchema.DropTable(_testTable);
        }
예제 #2
0
 public virtual void Setup()
 {
     PowerPlant    = DbContext.PowerPlant;
     DbSchema      = PowerPlant.CreateDbSchema();
     ColumnFactory = PowerPlant.CreateColumnFactory();
     TableName     = "hmstestcolumntypes";
     DbSchema.DropTable(TableName);
 }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
 public virtual void Cleanup()
 {
     DbSchema.DropTable(TableName);
 }
예제 #6
0
파일: TestMisc.cs 프로젝트: radtek/ACopy
 public virtual void Cleanup()
 {
     DbSchema.DropTable(TestTable);
     DeleteFiles();
 }
예제 #7
0
 public void Cleanup()
 {
     _dbSchema.DropTable(_testTable);
 }