From faf10c521fd79975c6dd66e79457eb4b6966c0ef Mon Sep 17 00:00:00 2001 From: stephan Date: Mon, 22 Jul 2024 21:21:25 +0000 Subject: Move a block of JS code which was inadvertently (and harmlessly) moved in the previous checkin. Clarify the semantics of an internal-use-only API. Add another WAL-related JS test. FossilOrigin-Name: 6cd9f55a975b5237efee8776efce7e7836b41905ca750f82be3b90aa04c1dff2 --- ext/wasm/api/sqlite3-api-oo1.c-pp.js | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'ext/wasm/api/sqlite3-api-oo1.c-pp.js') diff --git a/ext/wasm/api/sqlite3-api-oo1.c-pp.js b/ext/wasm/api/sqlite3-api-oo1.c-pp.js index 55d7356e2..3d6a24c77 100644 --- a/ext/wasm/api/sqlite3-api-oo1.c-pp.js +++ b/ext/wasm/api/sqlite3-api-oo1.c-pp.js @@ -79,6 +79,15 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ } }.bind({counter: 0})); + /** + A map of sqlite3_vfs pointers to SQL code or a callback function + to run when the DB constructor opens a database with the given + VFS. In the latter case, the call signature is + (theDbObject,sqlite3Namespace) and the callback is expected to + throw on error. + */ + const __vfsPostOpenCallback = Object.create(null); + //#if enable-see /** Converts ArrayBuffer or Uint8Array ba into a string of hex @@ -108,7 +117,9 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ are set. It throws if more than one is set or if any are set to values of an invalid type. - Returns true if it applies the key, else an unspecified falsy value. + Returns true if it applies the key, else an unspecified falsy + value. Note that applying the key does not imply that the key is + correct, only that it was passed on to the db. */ const dbCtorApplySEEKey = function(db,opt){ if( !capi.sqlite3_key_v2 ) return; @@ -170,10 +181,10 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ try{ stmt = db.prepare("PRAGMA "+keytype+"="+util.sqlite3__wasm_qfmt_token(key, 1)); stmt.step(); + return true; }finally{ if(stmt) stmt.finalize(); } - return true; }; //#endif enable-see @@ -294,16 +305,6 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ } }; - - /** - A map of sqlite3_vfs pointers to SQL code or a callback function - to run when the DB constructor opens a database with the given - VFS. In the latter case, the call signature is - (theDbObject,sqlite3Namespace) and the callback is expected to - throw on error. - */ - const __vfsPostOpenCallback = Object.create(null); - /** Sets a callback which should be called after a db is opened with the given sqlite3_vfs pointer. The 2nd argument must be a -- cgit v1.2.3