mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-27 20:41:58 +03:00
Filter the OPFS VFSes out of the sqlite3-node.mjs build. Add another level of subdirectory to the sahpool to later enable transparent support of client-provided files under the VFS's root dir. Rework the awkward sahpool-via-oo1 mapping.
FossilOrigin-Name: 080a4d0aba30d8f3802b49be4a113205f069b3bdea8cebf525d654055642ff62
This commit is contained in:
@ -3054,16 +3054,13 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
|
||||
run. */)
|
||||
.assert(u1.getCapacity() + 2 === (await u2.addCapacity(2)))
|
||||
.assert(2 === (await u2.reduceCapacity(2)))
|
||||
.assert(sqlite3.oo1.OpfsSAHPool.default instanceof Function)
|
||||
.assert(sqlite3.oo1.OpfsSAHPool.default ===
|
||||
sqlite3.oo1.OpfsSAHPool[sahPoolConfig.name])
|
||||
.assert(sqlite3.capi.sqlite3_js_vfs_list().indexOf(sahPoolConfig.name) >= 0);
|
||||
|
||||
T.assert(0 === u1.getFileCount());
|
||||
const DbCtor = sqlite3.oo1.OpfsSAHPool.default;
|
||||
const dbName = '/foo.db';
|
||||
let db = new DbCtor(dbName);
|
||||
T.assert(1 === u1.getFileCount());
|
||||
let db = new u1.OpfsSAHPoolDb(dbName);
|
||||
T.assert(db instanceof sqlite3.oo1.DB)
|
||||
.assert(1 === u1.getFileCount());
|
||||
db.exec([
|
||||
'create table t(a);',
|
||||
'insert into t(a) values(1),(2),(3)'
|
||||
@ -3072,14 +3069,19 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
|
||||
T.assert(3 === db.selectValue('select count(*) from t'));
|
||||
db.close();
|
||||
T.assert(1 === u1.getFileCount());
|
||||
db = new DbCtor(dbName);
|
||||
db = new u2.OpfsSAHPoolDb(dbName);
|
||||
T.assert(1 === u1.getFileCount());
|
||||
db.close();
|
||||
T.assert(1 === u1.getFileCount())
|
||||
.assert(true === u1.unlink(dbName))
|
||||
.assert(false === u1.unlink(dbName))
|
||||
.assert(0 === u1.getFileCount());
|
||||
|
||||
if(0){
|
||||
/* Enable this block to inspect vfs's contents via the dev
|
||||
console or OPFS Explorer browser extension. The
|
||||
following bits will remove them. */
|
||||
return;
|
||||
}
|
||||
T.assert(true === await u2.removeVfs())
|
||||
.assert(false === await u1.removeVfs())
|
||||
.assert(!sqlite3.capi.sqlite3_vfs_find(sahPoolConfig.name));
|
||||
|
Reference in New Issue
Block a user