diff options
author | stephan <stephan@noemail.net> | 2022-11-01 07:49:49 +0000 |
---|---|---|
committer | stephan <stephan@noemail.net> | 2022-11-01 07:49:49 +0000 |
commit | 49048b148eac5f74eb6f1e9dfbd85ee8f95694a4 (patch) | |
tree | 6fcd456e95de58e06c0498c2b271da54051934ac /ext/wasm/api/sqlite3-api-oo1.js | |
parent | c7dd9b60eb95ebd65e53ed238e77ecfe6247b3b0 (diff) | |
download | sqlite-49048b148eac5f74eb6f1e9dfbd85ee8f95694a4.tar.gz sqlite-49048b148eac5f74eb6f1e9dfbd85ee8f95694a4.zip |
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
Diffstat (limited to 'ext/wasm/api/sqlite3-api-oo1.js')
-rw-r--r-- | ext/wasm/api/sqlite3-api-oo1.js | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/ext/wasm/api/sqlite3-api-oo1.js b/ext/wasm/api/sqlite3-api-oo1.js index e318b7200..aaaeaa3d5 100644 --- a/ext/wasm/api/sqlite3-api-oo1.js +++ b/ext/wasm/api/sqlite3-api-oo1.js @@ -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 @@ -561,6 +561,25 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ 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. |