Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | 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. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
6cd9f55a975b5237efee8776efce7e78 |
User & Date: | stephan 2024-07-22 21:21:25.705 |
Context
2024-07-22
| ||
21:46 | Doc typo fix. No code changes. (check-in: 8d558ad25b user: stephan tags: trunk) | |
21:21 | 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. (check-in: 6cd9f55a97 user: stephan tags: trunk) | |
20:58 | OPFS VFSes: remove the on-open() pragma calls, as those (A) already reflected the build-time default settings and (B) they made it illegal to run locking_mode=exclusive, which is a requirement for WAL mode without shared memory. Modify part of the test suite to demonstrate that the SAHPool VFS can run in WAL mode so long as locking_mode=exclusive is used. (check-in: 19cd8e2b05 user: stephan tags: trunk) | |
Changes
Changes to ext/wasm/api/sqlite3-api-oo1.c-pp.js.
︙ | ︙ | |||
75 76 77 78 79 80 81 82 83 84 85 86 87 88 | if(capi.SQLITE_TRACE_STMT===t){ // x == SQL, p == sqlite3_stmt* console.log("SQL TRACE #"+(++this.counter)+' via sqlite3@'+c+':', wasm.cstrToJs(x)); } }.bind({counter: 0})); //#if enable-see /** Converts ArrayBuffer or Uint8Array ba into a string of hex digits. */ const byteArrayToHex = function(ba){ if( ba instanceof ArrayBuffer ){ | > > > > > > > > > | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | if(capi.SQLITE_TRACE_STMT===t){ // x == SQL, p == sqlite3_stmt* console.log("SQL TRACE #"+(++this.counter)+' via sqlite3@'+c+':', wasm.cstrToJs(x)); } }.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 digits. */ const byteArrayToHex = function(ba){ if( ba instanceof ArrayBuffer ){ |
︙ | ︙ | |||
104 105 106 107 108 109 110 | as a string, an ArrayBuffer, or a Uint8Array. This is a no-op in non-SEE builds. It throws on error and returns without side effects if none of the key/textkey/hexkey options are set. It throws if more than one is set or if any are set to values of an invalid type. | | > > | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | as a string, an ArrayBuffer, or a Uint8Array. This is a no-op in non-SEE builds. It throws on error and returns without side effects if none of the key/textkey/hexkey options 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. 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; let keytype; let key; const check = (opt.key ? 1 : 0) + (opt.hexkey ? 1 : 0) + (opt.textkey ? 1 : 0); if( !check ) return; |
︙ | ︙ | |||
166 167 168 169 170 171 172 173 174 175 | }else{ return; } let stmt; try{ stmt = db.prepare("PRAGMA "+keytype+"="+util.sqlite3__wasm_qfmt_token(key, 1)); stmt.step(); }finally{ if(stmt) stmt.finalize(); } | > < | 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | }else{ return; } let stmt; try{ stmt = db.prepare("PRAGMA "+keytype+"="+util.sqlite3__wasm_qfmt_token(key, 1)); stmt.step(); return true; }finally{ if(stmt) stmt.finalize(); } }; //#endif enable-see /** A proxy for DB class constructors. It must be called with the being-construct DB object as its "this". See the DB constructor for the argument docs. This is split into a separate function |
︙ | ︙ | |||
290 291 292 293 294 295 296 | } }catch(e){ this.close(); throw e; } }; | < < < < < < < < < < | 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | } }catch(e){ this.close(); throw e; } }; /** Sets a callback which should be called after a db is opened with the given sqlite3_vfs pointer. The 2nd argument must be a function, which gets called with (theOo1DbObject,sqlite3Namespace) at the end of the DB() constructor. The function must throw on error, in which case the db is closed and the exception is propagated. This function is |
︙ | ︙ |
Changes to ext/wasm/tester1.c-pp.js.
︙ | ︙ | |||
3147 3148 3149 3150 3151 3152 3153 | T.assert(dbytes.length >= 4096); const dbName2 = '/exported.db'; let nWrote = u1.importDb(dbName2, dbytes); T.assert( 2 == u1.getFileCount() ) .assert( dbytes.byteLength == nWrote ); let db2 = new u1.OpfsSAHPoolDb(dbName2); T.assert(db2 instanceof sqlite3.oo1.DB) | | > > > > | 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 | T.assert(dbytes.length >= 4096); const dbName2 = '/exported.db'; let nWrote = u1.importDb(dbName2, dbytes); T.assert( 2 == u1.getFileCount() ) .assert( dbytes.byteLength == nWrote ); let db2 = new u1.OpfsSAHPoolDb(dbName2); T.assert(db2 instanceof sqlite3.oo1.DB) .assert('wal' !== db2.selectValue("pragma journal_mode") /* importDb() unsets the WAL-mode header for historical reasons. Because clients must explicitly enable pragma locking_mode=exclusive before using WAL, that behavior is retained. */) .assert(3 === db2.selectValue('select count(*) from t')); db2.close(); T.assert(true === u1.unlink(dbName2)) .assert(false === u1.unlink(dbName2)) .assert(1 === u1.getFileCount()) .assert(1 === u1.getFileNames().length); // Try again with a function as an input source: |
︙ | ︙ |