1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Update JS worker #1 API and related tests for recent API changes.

FossilOrigin-Name: d797e183e96e04520636865204c02307b751fdc2949a04587de9259a1733e37b
This commit is contained in:
stephan
2022-12-25 23:45:59 +00:00
parent ec35e92d1d
commit 7103801df1
5 changed files with 14 additions and 31 deletions

View File

@@ -158,15 +158,6 @@
bigIntEnabled: bool. True if BigInt support is enabled.
wasmfsOpfsDir: path prefix, if any, _intended_ for use with
WASMFS OPFS persistent storage.
wasmfsOpfsEnabled: true if persistent storage is enabled in the
current environment. Only files stored under wasmfsOpfsDir
will persist using that mechanism, however. It is legal to use
the non-WASMFS OPFS VFS to open a database via a URI-style
db filename.
vfsList: result of sqlite3.capi.sqlite3_js_vfs_list()
}
}
@@ -449,7 +440,6 @@ sqlite3.initWorker1API = function(){
toss("Throwing because of simulateError flag.");
}
const rc = Object.create(null);
const pDir = sqlite3.capi.sqlite3_wasmfs_opfs_dir();
let byteArray, pVfs;
oargs.vfs = args.vfs;
if(isSpecialDbFilename(args.filename)){
@@ -475,15 +465,14 @@ sqlite3.initWorker1API = function(){
e.name+' creating '+args.filename+": "+e.message, {
cause: e
}
);
);
}finally{
if(pMem) sqlite3.wasm.dealloc(pMem);
}
}
const db = wState.open(oargs);
rc.filename = db.filename;
rc.persistent = (!!pDir && db.filename.startsWith(pDir+'/'))
|| !!sqlite3.capi.sqlite3_js_db_uses_vfs(db.pointer, "opfs");
rc.persistent = !!sqlite3.capi.sqlite3_js_db_uses_vfs(db.pointer, "opfs");
rc.dbId = getDbId(db);
rc.vfs = db.dbVfsName();
return rc;
@@ -558,11 +547,10 @@ sqlite3.initWorker1API = function(){
'config-get': function(){
const rc = Object.create(null), src = sqlite3.config;
[
'wasmfsOpfsDir', 'bigIntEnabled'
'bigIntEnabled'
].forEach(function(k){
if(Object.getOwnPropertyDescriptor(src, k)) rc[k] = src[k];
});
rc.wasmfsOpfsEnabled = !!sqlite3.capi.sqlite3_wasmfs_opfs_dir();
rc.version = sqlite3.version;
rc.vfsList = sqlite3.capi.sqlite3_js_vfs_list();
rc.opfsEnabled = !!sqlite3.opfs;