Esempio n. 1
0
        private static void CopyIn(IDbContext dbContext, IArgumentCollection settings, List <string> tables)
        {
            IALogger logger = new ConsoleLogger();
            IAReader reader = AReaderFactory.CreateInstance(dbContext, logger);

            reader.Directory = settings["Folder"].Value;
            if (settings["MaxDegreeOfParallelism"].IsSet)
            {
                reader.MaxDegreeOfParallelism = int.Parse(settings["MaxDegreeOfParallelism"].Value);
            }
            if (settings["BatchSize"].IsSet)
            {
                reader.BatchSize = int.Parse(settings["BatchSize"].Value);
            }
            if (settings["UseCollation"].IsSet)
            {
                reader.Collation = settings["UseCollation"].Value;
            }
            if (settings["DataFileSuffix"].IsSet)
            {
                reader.DataFileSuffix = settings["DataFileSuffix"].Value;
            }
            if (settings["SchemaFileSuffix"].IsSet)
            {
                reader.SchemaFileSuffix = settings["SchemaFileSuffix"].Value;
            }
            reader.CreateClusteredIndex = settings["CreateClusteredIndex"].IsSet;

            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();
            int totalTables;
            int failedTables;

            reader.Read(tables, out totalTables, out failedTables);

            int totalViews  = 0;
            int failedViews = 0;

            if (settings["View"].IsSet)
            {
                CreateViews(dbContext, out totalViews, out failedViews, logger);
            }

            stopWatch.Stop();

            logger.Write("");
            logger.Write(string.Format("{0} tables created.", totalTables));
            if (failedTables > 0)
            {
                logger.Write(string.Format("Found {0} tables with errors", failedTables));
            }
            logger.Write(string.Format("{0} views created.", totalViews));
            if (failedViews > 0)
            {
                logger.Write(string.Format("Found {0} views with errors", failedViews));
            }
            logger.Write(string.Format("Total time: {0}", stopWatch.Elapsed));
        }
Esempio n. 2
0
        private void Read()
        {
            IAReader reader = AReaderFactory.CreateInstance(DbContext);

            reader.Directory = Directory;
            int totalTables;
            int failedTables;

            reader.Read(new List <string> {
                TestTable
            }, out totalTables, out failedTables);
        }
Esempio n. 3
0
        protected void Setup(string tableName)
        {
            TestTable   = tableName;
            _schemaFile = tableName + ".aschema";
            _dataFile   = tableName + ".adata";

            _writer       = AWriterFactory.CreateInstance(DbContext);
            _reader       = AReaderFactory.CreateInstance(DbContext);
            DbSchema      = DbContext.PowerPlant.CreateDbSchema();
            Commands      = DbContext.PowerPlant.CreateCommands();
            ColumnFactory = DbContext.PowerPlant.CreateColumnFactory();
            Cleanup();
        }
Esempio n. 4
0
        public override void Setup()
        {
            DbContext        = DbContextFactory.CreateOracleContext(ConnectionStrings.GetOracle());
            _oraTableCreator = new OraTableCreator(DbContext);
            TableName        = _oraTableCreator.TableName;

            _writer           = AWriterFactory.CreateInstance(DbContext);
            _writer.Directory = ".\\";
            _reader           = AReaderFactory.CreateInstance(DbContext);
            _reader.Directory = ".\\";

            _schemaFileName = $@".\{TableName}.{_writer.SchemaFileSuffix}";
            _dataFileName   = $@".\{TableName}.{_writer.DataFileSuffix}";
            _blobFileName   = $@".\{TableName}\i000000000000000.raw";

            base.Setup();
        }