public void Booleans()
        {
            _storage.EnterFluidMode();

            var trueKeys = new[] {
                _storage.Store("foo", SharedChecks.MakeRow("x", true)),
                _storage.Store("foo", SharedChecks.MakeRow("x", 1)),
                _storage.Store("foo", SharedChecks.MakeRow("x", "1"))
            };

            var falseKeys = new[] {
                _storage.Store("foo", SharedChecks.MakeRow("x", false)),
                _storage.Store("foo", SharedChecks.MakeRow("x", 0)),
                _storage.Store("foo", SharedChecks.MakeRow("x", "0"))
            };

            var nullKeys = new[] {
                _storage.Store("foo", SharedChecks.MakeRow("x", null)),
                _storage.Store("foo", SharedChecks.MakeRow("x", ""))
            };

            AssertExtensions.Equivalent(trueKeys, _db.Col <object>(true, "select id from foo where x"));
            AssertExtensions.Equivalent(falseKeys, _db.Col <object>(true, "select id from foo where not x"));
            AssertExtensions.Equivalent(nullKeys, _db.Col <object>(true, "select id from foo where x is null"));
        }
Пример #2
0
        public void Caching_EnableDisable()
        {
            var readers = new Func <string, object>[] {
                sql => _db.Cell <string>(true, sql),
                sql => _db.Col <string>(true, sql)[0],
                sql => _db.Row(true, sql)["r"],
                sql => _db.Rows(true, sql)[0]["r"],
            };

            foreach (var reader in readers)
            {
                _db.CacheCapacity = 1;
                var value = reader(SELECT_RANDOM);
                Assert.Equal(value, reader(SELECT_RANDOM));

                _db.CacheCapacity = 0;
                Assert.NotEqual(value, reader(SELECT_RANDOM));
            }
        }
Пример #3
0
        public void AlterTable_BoolToInteger()
        {
            _db.Exec("create table foo(id serial, p bool)");
            _db.Exec("insert into foo (p) values (null)");
            _db.Exec("insert into foo (p) values (false)");
            _db.Exec("insert into foo (p) values (true)");

            _storage.EnterFluidMode();
            _storage.Store("foo", new Dictionary <string, object> {
                { "p", 2 }
            });

            var col = _db.Col <string>(false, "select p from foo order by id");

            Assert.Equal(new[] { null, "0", "1", "2" }, col);
        }
Пример #4
0
 public string[] GetTableNames(IDatabaseAccess db)
 {
     return db.Col<string>(false, "select name from sys.objects where type='U'");
 }
Пример #5
0
 public string[] GetTableNames(IDatabaseAccess db)
 {
     return db.Col<string>(false, "select name from sqlite_master where type = 'table' and name <> 'sqlite_sequence'");
 }
Пример #6
0
 public IEnumerable <string> GetTableNames(IDatabaseAccess db)
 {
     return(db.Col <string>(false, "SHOW TABLES"));
 }
Пример #7
0
 public IEnumerable <string> GetTableNames(IDatabaseAccess db)
 {
     return(db.Col <string>(false, "SELECT name FROM sqlite_master WHERE type = 'table' AND name <> 'sqlite_sequence'"));
 }
Пример #8
0
 public string[] GetTableNames(IDatabaseAccess db)
 {
     return db.Col<string>(false, "show tables");
 }
Пример #9
0
 public string[] GetTableNames(IDatabaseAccess db)
 {
     return db.Col<string>(false, "select table_name from information_schema.tables where table_schema = 'public'");
 }
Пример #10
0
 public string[] GetTableNames(IDatabaseAccess db)
 {
     return(db.Col <string>(false, "select name from sqlite_master where type = 'table' and name <> 'sqlite_sequence'"));
 }
Пример #11
0
 public string[] GetTableNames(IDatabaseAccess db)
 {
     return(db.Col <string>(false, "select table_name from information_schema.tables where table_schema = 'public'"));
 }
Пример #12
0
 public string[] GetTableNames(IDatabaseAccess db)
 {
     return(db.Col <string>(false, "show tables"));
 }
Пример #13
0
 public string[] GetTableNames(IDatabaseAccess db)
 {
     return(db.Col <string>(false, "select name from sys.objects where type='U'"));
 }
Пример #14
0
 public IEnumerable <string> GetTableNames(IDatabaseAccess db)
 {
     return(db.Col <string>(false,
                            "SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'"));
 }
Пример #15
0
 public IEnumerable <string> GetTableNames(IDatabaseAccess db)
 {
     return(db.Col <string>(false,
                            "SELECT name FROM sys.objects WHERE type='U'"));
 }