Exemplo n.º 1
0
        private void ReadAndVerify(
            string expectedType,
            int?expectedLength,
            int?expectedPrec,
            int?expectedScale)
        {
            _reader.Read(new List <string>()
            {
                TableName
            }, out int tableCounter, out int errorCounter);
            DbSchema.GetRawColumnDefinition(TableName, "col1", out string type, out int length, out int prec, out int scale);

            type.ToLower().Should().Be(expectedType);
            if (expectedLength.HasValue)
            {
                length.Should().Be(expectedLength.Value);
            }
            if (expectedPrec.HasValue)
            {
                prec.Should().Be(expectedPrec.Value);
            }
            if (expectedScale.HasValue)
            {
                scale.Should().Be(expectedScale.Value);
            }
        }
Exemplo n.º 2
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));
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        protected void WriteAndRead()
        {
            _writer.Directory = Directory;
            _writer.Write(new List <string> {
                TestTable
            });

            DbSchema.DropTable(TestTable);

            _reader.Directory = Directory;
            int totalTables;
            int failedTables;

            _reader.Read(new List <string> {
                TestTable
            }, out totalTables, out failedTables);
        }