Пример #1
0
#pragma warning disable IDE1006 // Naming Styles
        public void _020_DropTable(SqlEngineVersion version)
#pragma warning restore IDE1006 // Naming Styles
        {
            _sqlExecuterTestAdapter.Check(version);
            _sqlExecuterTestAdapter.Initialize(version.UniqueName);

            var table = new SqlTable("HierarchyFromCsvToSqlTests");

            var generator = SqlGeneratorFactory.CreateGenerator(version, _sqlExecuterTestAdapter.GetContext(version));
            var sql       = generator.DropTable(table);
            var result    = _sqlExecuterTestAdapter.ExecuteNonQuery(version.UniqueName, sql);

            if (result != null)
            {
                Assert.Inconclusive(result);
            }
        }
Пример #2
0
#pragma warning disable IDE1006 // Naming Styles
        public void _010_GenerateScriptAndCreateTable(SqlEngineVersion version)
#pragma warning restore IDE1006 // Naming Styles
        {
            _sqlExecuterTestAdapter.Check(version);
            _sqlExecuterTestAdapter.InitializeAndCreate(version.UniqueName);

            var dd = new DatabaseDefinition(null, new[] { MsSqlVersion.MsSql2016.GetTypeMapper(), OracleVersion.Oracle12c.GetTypeMapper(), SqLiteVersion.SqLite3.GetTypeMapper() });

            var table  = new SqlTable("HierarchyFromCsvToSqlTests");
            var column = table.AddInt32("Id");

            column.Properties.Add(new Identity(column)
            {
                Increment = 1, Seed = 1
            });
            table.AddNVarChar("Name", 100);

            dd.AddTable(table);

            var context = new Context
            {
                Settings = TestHelper.GetDefaultTestSettings(version),
                Logger   = TestHelper.CreateLogger()
            };

            var generator = SqlGeneratorFactory.CreateGenerator(version, context);

            var sql = generator.CreateTable(table);

            var result = _sqlExecuterTestAdapter.ExecuteNonQuery(version.UniqueName, sql);

            if (result != null)
            {
                Assert.Inconclusive(result);
            }
        }
Пример #3
0
        public void DropAll(
            [Option(LongName = "connectionString", ShortName = "c")]
            string connectionString,
            [Option(LongName = "sqlType", ShortName = "t")]
            string sqlType
            )
        {
            var version = SqlEngineVersions.GetVersion(sqlType);

            var connString = new NamedConnectionString("", version.ProviderName, connectionString, version.VersionString);

            var context = CreateContext(version);

            var generator = SqlGeneratorFactory.CreateGenerator(version, context);

            var executer = SqlExecuterFactory.CreateSqlExecuter(connString, generator);
            var dc       = new DatabaseCreator(null, executer);

            dc.DropAllViews();
            dc.DropAllForeignKeys();
            dc.DropAllTables();
            // TODO needs databasedefinition
            // dc.DropAllSchemas();
        }