1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-27 20:41:58 +03:00

Rework sqlite3_wasm_vfs_unlink(), add sqlite3_wasm_db_vfs(), update some docs.

FossilOrigin-Name: cdd46858f0e63bc7bfce8e339b3db9efdec43b6443ee76563a847f53d0176831
This commit is contained in:
stephan
2022-10-20 05:14:37 +00:00
parent d89a66ec36
commit 842c5ee849
9 changed files with 58 additions and 55 deletions

View File

@ -861,13 +861,12 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
/**
Functions which are intended solely for API-internal use by the
WASM components, not client code. These get installed into
wasm.
TODO: get rid of sqlite3_wasm_vfs_unlink(). It is ill-conceived
and only rarely actually useful.
capi.wasm.
*/
wasm.bindingSignatures.wasm = [
["sqlite3_wasm_vfs_unlink", "int", "string"]
["sqlite3_wasm_db_reset", "int", "sqlite3*"],
["sqlite3_wasm_db_vfs", "sqlite3_vfs*", "sqlite3*","string"],
["sqlite3_wasm_vfs_unlink", "int", "sqlite3_vfs*","string"]
];
@ -919,7 +918,7 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
This method always adjusts the given value to be a multiple
of 8 bytes because failing to do so can lead to incorrect
results when reading and writing 64-bit values from/to the WASM
heap.
heap. Similarly, the returned address is always 8-byte aligned.
*/
alloc: (n)=>{
return wasm.exports.sqlite3_wasm_pstack_alloc(n)
@ -1074,12 +1073,8 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
Returns true if sqlite3.capi.sqlite3_wasmfs_opfs_dir() is a
non-empty string and the given name starts with (that string +
'/'), else returns false.
Potential (but arguable) TODO: return true if the name is one of
(":localStorage:", "local", ":sessionStorage:", "session") and
kvvfs is available.
*/
capi.sqlite3_web_filename_is_persistent = function(name){
capi.sqlite3_wasmfs_filename_is_persistent = function(name){
const p = capi.sqlite3_wasmfs_opfs_dir();
return (p && name) ? name.startsWith(p+'/') : false;
};