示例#1
0
        public void GenerateSqliteDatabaseFromFile()
        {
            var t_Schema = _GenerateTestSchema();

            var t_SqliteGen = new SqliteGenerator();
            var t_Files     = t_SqliteGen.GenerateSource(t_Schema);

            var t_Con = _CreateTestDatabase();

            foreach (var t_File in t_Files)
            {
                using (var t_Query = new SQLiteCommand(t_Con))
                {
                    t_Query.CommandText = t_File.Content;

                    t_Query.ExecuteNonQuery();
                }
            }

            string t_TableName = null;

            using (var t_Query = new SQLiteCommand(t_Con))
            {
                t_Query.CommandText = "SELECT name FROM sqlite_master WHERE type='table' AND name='TestTableSqlite';";

                var t_Reader = t_Query.ExecuteReader();
                t_Reader.Read();
                t_TableName = t_Reader.GetString(0);
            }

            Assert.IsTrue(t_TableName == "TestTableSqlite");
        }
示例#2
0
        public void SetUp()
        {
            _dumpFilename = "createtable.dump";
            _tableName    = "sample_table";
            _columnName   = "sample_column_id";

            _generator         = new SqliteGenerator();
            _fileDumpProcessor = new FileProcessor(_dumpFilename, _generator, new TextWriterAnnouncer(System.Console.Out), new ProcessorOptions());
        }
示例#3
0
        public void GenerateSqliteSource()
        {
            var t_Schema = _GenerateTestSchema();

            var t_SqliteGen = new SqliteGenerator();
            var t_Files     = t_SqliteGen.GenerateSource(t_Schema);


            Assert.IsTrue(t_Files.Count == 1 && t_Files[0].Name == "TestTableSqlite.sql" && t_Files[0].Content.Length > 0);
        }
        public override IMigrationProcessor Create(String connectionString, IAnnouncer announcer, IMigrationProcessorOptions options)
        {
            var factory    = new SqliteDbFactory();
            var connection = factory.CreateConnection(connectionString);
            var generator  = new SqliteGenerator()
            {
                compatabilityMode = CompatabilityMode.STRICT
            };

            return(new NzbDroneSqliteProcessor(connection, generator, announcer, options, factory));
        }
        MigrationRunner getRunner()
        {
            var assembly  = typeof(SqlMigrationService).Assembly;
            var ns        = typeof(SqlMigrationService).Namespace;
            var generator = new SqliteGenerator();
            var processor = new SqliteProcessor(_connection, generator, new TextWriterAnnouncer(Console.Out), new ProcessorOptions());

            return(new MigrationRunner(assembly, new RunnerContext(new TextWriterAnnouncer(Console.Out))
            {
                Namespace = ns
            },
                                       processor));
        }
示例#6
0
        private void _CreateTestDatabase(Schema Schema)
        {
            if (System.IO.File.Exists("SqliteTestDatabase.db"))
            {
                System.IO.File.Delete("SqliteTestDatabase.db");
            }

            var t_SqliteGenerator = new SqliteGenerator();
            var t_Files           = t_SqliteGenerator.GenerateSource(Schema);

            using (var t_Con = new SQLiteConnection("Data Source=SqliteTestDatabase.db;Version=3;").OpenAndReturn())
            {
                foreach (var t_File in t_Files)
                {
                    new SQLiteCommand(t_File.Content, t_Con).ExecuteNonQuery();
                }
            }
        }
 public void Setup()
 {
     generator = new SqliteGenerator();
 }
 public void Setup()
 {
     _generator = new SqliteGenerator();
 }
        public void SetUp()
        {
            _dumpFilename = "createtable.dump";
            _tableName = "sample_table";
            _columnName = "sample_column_id";

            _generator = new SqliteGenerator();
            _fileDumpProcessor = new FileProcessor(_dumpFilename, _generator, new TextWriterAnnouncer(System.Console.Out), new ProcessorOptions());
        }