Exemple #1
0
        protected void ReopenDB()
        {
            var config = C4DatabaseConfig.Get(Native.c4db_getConfig(Db));

            LiteCoreBridge.Check(err => Native.c4db_close(Db, err));
            Native.c4db_free(Db);
            Db = (C4Database *)LiteCoreBridge.Check(err => {
                var localConfig = config;
                return(Native.c4db_open(DatabasePath(), &localConfig, err));
            });
        }
Exemple #2
0
        protected override void TeardownVariant(int option)
        {
            var config = C4DatabaseConfig.Get(Native.c4db_getConfig(Db));

            config.Dispose();
            LiteCoreBridge.Check(err => Native.c4db_delete(Db, err));
            Native.c4db_free(Db);
            Db = null;
            //if(CurrentException == null) {
            //    Native.c4_getObjectCount().Should().Be(_objectCount, "because otherwise an object was leaked");
            //}
        }
Exemple #3
0
        protected void ReopenDBReadOnly()
        {
            var config = C4DatabaseConfig.Get(Native.c4db_getConfig(Db));

            LiteCoreBridge.Check(err => Native.c4db_close(Db, err));
            Native.c4db_free(Db);
            config.flags = (config.flags & ~C4DatabaseFlags.Create) | C4DatabaseFlags.ReadOnly;
            Db           = (C4Database *)LiteCoreBridge.Check(err => {
                var localConfig = config;
                return(Native.c4db_open(DatabasePath(), &localConfig, err));
            });
        }