Esempio n. 1
0
        public void LoadFromMissingTable()
        {
            Assert.Throws(SQLitePortability.ExceptionType, () => { _storage.Load("phantom", 1); });

            _storage.EnterFluidMode();
            Assert.Null(_storage.Load("phantom", 1));
        }
Esempio n. 2
0
        public static void CheckStoringNull(DatabaseStorage storage)
        {
            storage.EnterFluidMode();

            var row = MakeRow("p", 1);
            var id  = storage.Store("foo", row);

            row      = storage.Load("foo", id);
            row["p"] = null;
            storage.Store("foo", row);

            row = storage.Load("foo", id);
            Assert.Null(row["p"]);
        }
        public void UTF8_mb4()
        {
            const string pile = "\U0001f4a9";

            _storage.EnterFluidMode();
            var id = _storage.Store("foo", SharedChecks.MakeRow("p", pile));

            Assert.Equal(pile, _storage.Load("foo", id)["p"]);
        }
Esempio n. 4
0
        public void Check(object before, object after)
        {
            var id = _storage.Store("foo", new Dictionary <string, object> {
                { "p", before }
            });

            try {
                var loaded = _storage.Load("foo", id);
                Assert.Equal(after, loaded.GetSafe("p"));

                if (after != null)
                {
                    Assert.Equal(after.GetType(), loaded["p"].GetType());
                }
            } finally {
                _db.Exec("drop table foo");
                _storage.InvalidateSchema();
            }
        }
Esempio n. 5
0
        public static void CheckCompoundKey(DatabaseStorage storage, KeyUtil keys)
        {
            storage.EnterFluidMode();

            keys.RegisterKey("foo", new[] { "k1", "k2" }, null);

            var row = MakeRow(
                "k1", "text",
                "k2", Guid.NewGuid(),
                "v", "hello"
            );

            var id = storage.Store("foo", row) as CompoundKey;
            Assert.Equal(row["k1"], id["k1"]);
            Assert.Equal(row["k2"], id["k2"]);

            row = storage.Load("foo", id);
            Assert.Equal("hello", row["v"]);
        }
Esempio n. 6
0
        public static void CheckCompoundKey(DatabaseStorage storage, KeyUtil keys)
        {
            storage.EnterFluidMode();

            keys.RegisterKey("foo", new[] { "k1", "k2" }, null);

            var row = MakeRow(
                "k1", "text",
                "k2", Guid.NewGuid(),
                "v", "hello"
                );

            var id = storage.Store("foo", row) as CompoundKey;

            Assert.Equal(row["k1"], id["k1"]);
            Assert.Equal(row["k2"], id["k2"]);

            row = storage.Load("foo", id);
            Assert.Equal("hello", row["v"]);
        }
Esempio n. 7
0
        public static void CheckStoringNull(DatabaseStorage storage)
        {
            storage.EnterFluidMode();

            var row = MakeRow("p", 1);
            var id = storage.Store("foo", row);

            row = storage.Load("foo", id);
            row["p"] = null;
            storage.Store("foo", row);

            row = storage.Load("foo", id);
            Assert.Null(row["p"]);
        }