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")); }
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)); } }
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); }
public string[] GetTableNames(IDatabaseAccess db) { return db.Col<string>(false, "select name from sys.objects where type='U'"); }
public string[] GetTableNames(IDatabaseAccess db) { return db.Col<string>(false, "select name from sqlite_master where type = 'table' and name <> 'sqlite_sequence'"); }
public IEnumerable <string> GetTableNames(IDatabaseAccess db) { return(db.Col <string>(false, "SHOW TABLES")); }
public IEnumerable <string> GetTableNames(IDatabaseAccess db) { return(db.Col <string>(false, "SELECT name FROM sqlite_master WHERE type = 'table' AND name <> 'sqlite_sequence'")); }
public string[] GetTableNames(IDatabaseAccess db) { return db.Col<string>(false, "show tables"); }
public string[] GetTableNames(IDatabaseAccess db) { return db.Col<string>(false, "select table_name from information_schema.tables where table_schema = 'public'"); }
public string[] GetTableNames(IDatabaseAccess db) { return(db.Col <string>(false, "select name from sqlite_master where type = 'table' and name <> 'sqlite_sequence'")); }
public string[] GetTableNames(IDatabaseAccess db) { return(db.Col <string>(false, "select table_name from information_schema.tables where table_schema = 'public'")); }
public string[] GetTableNames(IDatabaseAccess db) { return(db.Col <string>(false, "show tables")); }
public string[] GetTableNames(IDatabaseAccess db) { return(db.Col <string>(false, "select name from sys.objects where type='U'")); }
public IEnumerable <string> GetTableNames(IDatabaseAccess db) { return(db.Col <string>(false, "SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'")); }
public IEnumerable <string> GetTableNames(IDatabaseAccess db) { return(db.Col <string>(false, "SELECT name FROM sys.objects WHERE type='U'")); }