예제 #1
0
        // TODO NestedTransaction
        // Npgsql dose not support nested transaction but SavePoints are totaly compatible by
        // "using()" pattern. Should i transparently implient nested transactions using SavePoint?
        //[Fact]
        public void NestedTransactionTest()
        {
            var typ   = QuerBuilder.Compile <ISample>(_QueryPath, new PgDatabaseProvider());
            var query = QuerBuilder.New <ISample>(cnn, typ);

            query.create_schema_test();
            query.create_tbl_user();

            using (var tr1 = query.BeginTransaction())
            {
                query.create_user("u1", new byte[0], new byte[0], @"{ ""title"":""test"" }", 0);
                using (var tr2 = query.BeginTransaction())
                {
                    query.create_user("u2", new byte[0], new byte[0], @"{ ""title"":""test"" }", 0);
                    tr2.Commit();
                }
                using (var tr3 = query.BeginTransaction())
                {
                    query.create_user("u3", new byte[0], new byte[0], @"{ ""title"":""test3"" }", 0);
                    tr3.Rollback();
                }
                tr1.Commit();
            }

            foreach (var u in query.get_users("u%"))
            {
                Assert.True(u.user_name == "u1" || u.user_name == "u2");
            }
        }
예제 #2
0
        public void Create_table()
        {
            var typ   = QuerBuilder.Compile <ISample>(_QueryPath, new SqliteDatabaseProvider());
            var query = QuerBuilder.New <ISample>(cnn, typ);

            query.create_tbl_user();
        }
예제 #3
0
        public void CreateTableTest()
        {
            var typ   = QuerBuilder.Compile <ISample>(_QueryPath, new PgDatabaseProvider());
            var query = QuerBuilder.New <ISample>(cnn, typ);

            query.create_schema_test();
            query.create_tbl_user();
        }
예제 #4
0
        public void CreateScheemaTest()
        {
            var assembly = Assembly.GetAssembly(typeof(PostgresqlTest));
            var typ      = QuerBuilder.Compile <ISample>(assembly, new PgDatabaseProvider());
            var query    = QuerBuilder.New <ISample>(cnn, typ);

            query.create_schema_test();
        }
예제 #5
0
        public void Create_table()
        {
            var typ   = QuerBuilder.Compile <ISample>(_QueryPath, new MSSqlDatabaseProvider());
            var query = QuerBuilder.New <ISample>(cnn, typ);

            using (query.BeginTransaction())
            {
                query.create_schema_test();
                query.create_tbl_user();
            }
        }
예제 #6
0
        public void CheckTypes()
        {
            var typ   = QuerBuilder.Compile <ISample>(_QueryPath, new PgDatabaseProvider());
            var query = QuerBuilder.New <ISample>(cnn, typ);

            using (query.BeginTransaction())
            {
                query.create_schema_test();
                query.create_tbl_allTypes();
                query.create_allType(
                    long.MaxValue,
                    int.MaxValue,
                    short.MaxValue,
                    "Hello World",
                    new byte[] { 0, 1, 255 },
                    true,
                    @"{ ""Message"": ""This is a Json"" }",
                    (float)2.5,
                    double.MaxValue - 0.5,
                    new System.Collections.BitArray(new bool[] { false, false, true, false }),
                    Guid.NewGuid(),
                    DateTime.Now);
            }
        }
예제 #7
0
 public void Setup()
 {
     var typ   = QuerBuilder.Compile <ISample>(_QueryPath, new MSSqlDatabaseProvider());
     var query = QuerBuilder.New <ISample>(cnn, typ);
 }
예제 #8
0
 public void CompileFromResources()
 {
     var assembly = Assembly.GetAssembly(typeof(PostgresqlTest));
     var typ      = QuerBuilder.Compile <ISample>(assembly, new PgDatabaseProvider());
     var query    = QuerBuilder.New <ISample>(cnn, typ);
 }
예제 #9
0
 public void CompileFromFiles()
 {
     var typ   = QuerBuilder.Compile <ISample>(_QueryPath, new PgDatabaseProvider());
     var query = QuerBuilder.New <ISample>(cnn, typ);
 }