1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Significant cleanups and expansion of the sqlite3.opfs utilities. Add oo1.DB.dbVfsName(). Add VFS name to worker1:open's arguments and result.

FossilOrigin-Name: 86a341d7e061f946b39e8647ddd4743013b851b33ae9e6e755d8dbc53fba5286
This commit is contained in:
stephan
2022-11-01 07:49:49 +00:00
parent c7dd9b60eb
commit 49048b148e
14 changed files with 341 additions and 106 deletions

View File

@ -258,9 +258,9 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
in the form of a single configuration object with the following
properties:
- `.filename`: database file name
- `.flags`: open-mode flags
- `.vfs`: the VFS fname
- `filename`: database file name
- `flags`: open-mode flags
- `vfs`: the VFS fname
The `filename` and `vfs` arguments may be either JS strings or
C-strings allocated via WASM. `flags` is required to be a JS
@ -560,6 +560,25 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
dbName: function(dbNumber=0){
return capi.sqlite3_db_name(affirmDbOpen(this).pointer, dbNumber);
},
/**
Returns the name of the sqlite3_vfs used by the given database
of this connection (defaulting to 'main'). The argument may be
either a JS string or a WASM C-string. Returns undefined if the
given db name is invalid. Throws if this object has been
close()d.
*/
dbVfsName: function(dbName=0){
let rc;
const pVfs = capi.sqlite3_js_db_vfs(
affirmDbOpen(this).pointer, dbName
);
if(pVfs){
const v = new capi.sqlite3_vfs(pVfs);
try{ rc = wasm.cstringToJs(v.$zName) }
finally { v.dispose() }
}
return rc;
},
/**
Compiles the given SQL and returns a prepared Stmt. This is
the only way to create new Stmt objects. Throws on error.