diff options
author | stephan <stephan@noemail.net> | 2022-10-20 18:31:32 +0000 |
---|---|---|
committer | stephan <stephan@noemail.net> | 2022-10-20 18:31:32 +0000 |
commit | 8a8244b5c104022b5d6b4072630f012e6daf174e (patch) | |
tree | 280430fb83a31b34246b9871a1f88fededd816c3 /ext/wasm/api/sqlite3-api-worker1.js | |
parent | c046f6d4d92ed22d1454f3c64da8ecc4e49f9552 (diff) | |
download | sqlite-8a8244b5c104022b5d6b4072630f012e6daf174e.tar.gz sqlite-8a8244b5c104022b5d6b4072630f012e6daf174e.zip |
Rename sqlite3_web_... to sqlite3_js_... Document the worker1.close.unlink option. Fix unlink usage in speedtest1.html. Minor JS build cleanups.
FossilOrigin-Name: ac9af71b72a749b0a040273a88480d56f49570b569389a4ea20cc055f494d8ff
Diffstat (limited to 'ext/wasm/api/sqlite3-api-worker1.js')
-rw-r--r-- | ext/wasm/api/sqlite3-api-worker1.js | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/ext/wasm/api/sqlite3-api-worker1.js b/ext/wasm/api/sqlite3-api-worker1.js index 6c0900a50..fa6a43846 100644 --- a/ext/wasm/api/sqlite3-api-worker1.js +++ b/ext/wasm/api/sqlite3-api-worker1.js @@ -167,7 +167,7 @@ the non-WASMFS OPFS VFS to open a database via a URI-style db filename. - vfsList: result of sqlite3.capi.sqlite3_web_vfs_list() + vfsList: result of sqlite3.capi.sqlite3_js_vfs_list() } } ``` @@ -225,13 +225,15 @@ type: "close", messageId: ...as above... dbId: ...as above... - args: none + args: OPTIONAL {unlink: boolean} } ``` - If the dbId does not refer to an opened ID, this is a no-op. The - inability to close a db (because it's not opened) or delete its - file does not trigger an error. + If the `dbId` does not refer to an opened ID, this is a no-op. If + the `args` object contains a truthy `unlink` value then the database + will unlinked (deleted) after closing it. The inability to close a + db (because it's not opened) or delete its file does not trigger an + error. Response: @@ -432,15 +434,13 @@ sqlite3.initWorker1API = function(){ const pDir = sqlite3.capi.sqlite3_wasmfs_opfs_dir(); if(!args.filename || ':memory:'===args.filename){ oargs.filename = args.filename || ''; - }else if(pDir){ - oargs.filename = pDir + ('/'===args.filename[0] ? args.filename : ('/'+args.filename)); }else{ oargs.filename = args.filename; } const db = wState.open(oargs); rc.filename = db.filename; - rc.persistent = (!!pDir && db.filename.startsWith(pDir)) - || sqlite3.capi.sqlite3_web_db_uses_vfs(db.pointer, "opfs"); + rc.persistent = (!!pDir && db.filename.startsWith(pDir+'/')) + || sqlite3.capi.sqlite3_js_db_uses_vfs(db.pointer, "opfs"); rc.dbId = getDbId(db); return rc; }, @@ -521,7 +521,7 @@ sqlite3.initWorker1API = function(){ }); rc.wasmfsOpfsEnabled = !!sqlite3.capi.sqlite3_wasmfs_opfs_dir(); rc.version = sqlite3.version; - rc.vfsList = sqlite3.capi.sqlite3_web_vfs_list(); + rc.vfsList = sqlite3.capi.sqlite3_js_vfs_list(); return rc; }, |