drh [Tue, 11 Oct 2022 12:02:42 +0000 (12:02 +0000)]
Improved the ability of the CLI to handle very long input lines.
Potentially a fix for the bug reported by
[forum:/forumpost/fa4bb2941a|forum post fa4bb2941a].
drh [Mon, 10 Oct 2022 23:54:17 +0000 (23:54 +0000)]
Enhance the "PRAGMA integrity_check" statement so that it verifies datatype
constraints on non-STRICT tables: (1) Columns with TEXT affinity should not
contain numeric values, and (2) columns with NUMERIC affinity should not
contain TEXT values that could be converted into numbers.
drh [Mon, 10 Oct 2022 18:25:05 +0000 (18:25 +0000)]
An attempt to enhance PRAGMA integrity check so that it does data type
checking on non-STRICT tables. Specifically: (1) Columns with TEXT affinity
should not contain numeric values, and (2) columns with numeric affinity should
not contain text values that can be converted to numeric.
drh [Mon, 10 Oct 2022 12:02:53 +0000 (12:02 +0000)]
Improved detection of database corrupting when moving pages on an
autovacuumed database when creating a new btree.
dbsqlfuzz 9a55397eae13cec64aebf1fd35489c3a90bdaac5
stephan [Sun, 9 Oct 2022 13:26:15 +0000 (13:26 +0000)]
Refactor kvvfs JS bits to make use of [ea370b9b05f7ed7eaa]. At main-thread startup, if kvvfs is available, replace the kvvfs I/O methods with JS impls. Checkin part 2 of 2, to account for cherrypicking [ea370b9b05f7ed7eaa] into the kv-vfs branch.
stephan [Sun, 9 Oct 2022 13:19:27 +0000 (13:19 +0000)]
Refactor os_kv.c so that the kvvfs read/write/delete methods can be swapped out at runtime by JS implementations. This eliminates the kvvfs dependency on Emscripten. Checkin part 1 of 2, to account for cherrypicking.
dan [Fri, 7 Oct 2022 18:57:15 +0000 (18:57 +0000)]
Fix a problem causing the seek-scan optimization to skip over valid rows that could occur when it is used with expressions of the form (a IN (?,?..) AND b >= ?). dbsqlfuzz ab1db6dc0efb04cba1cd3431ee6da4894fdc4520.
dan [Thu, 6 Oct 2022 14:10:11 +0000 (14:10 +0000)]
Fix a problem that occurred when using a bloom filter to optimize an (ipk = ?) lookup in the case where the RHS of the expression is a TEXT value. First reported by [forum:/forumpost/f61a8b7053|forum post f61a8b7053].
drh [Tue, 4 Oct 2022 14:50:46 +0000 (14:50 +0000)]
Attempt to clarify the operation of the xLock and xUnlock VFS I/O methods.
Assert() statements added to prove that they behave as the documentation says.
drh [Tue, 4 Oct 2022 10:35:10 +0000 (10:35 +0000)]
Change the name of the autoconf-generated configuration file from "config.h"
to "sqlite_cfg.h" to work around a bug in a dependency checker, reported
in [https://twitter.com/josecastillo/status/1577136108097314816|a tweet from Jose Castillo].
stephan [Tue, 4 Oct 2022 00:54:00 +0000 (00:54 +0000)]
Add a test/debug mechanism to shut down the OPFS async listener so that it can be inspected (it normally can't be because its tight event-listening loop ties up the thread) and then restarted.
stephan [Mon, 3 Oct 2022 13:03:41 +0000 (13:03 +0000)]
Export sqlite3_trace_v2() to wasm and use it to ensure that the new per-VFS post-open SQL support in the DB ctor works. Default opfs vfs to journal_mode=truncate, as it's faster in that mode. Add 't' DB open-mode flag to enable SQL tracing to console.log().
stephan [Mon, 3 Oct 2022 11:33:35 +0000 (11:33 +0000)]
Experimentally relinquish the OPFS VFS sync access handle when the db is idle and reacquire it on demand, the goal being to help alleviate cross-tab locking issues.
stephan [Mon, 3 Oct 2022 09:21:37 +0000 (09:21 +0000)]
OPFS VFS now lazily opens its sync access handle, as a step towards experimenting with relinquishing it during idle times to help avoid cross-tab and page-reload locking issues.
stephan [Sun, 2 Oct 2022 22:50:04 +0000 (22:50 +0000)]
More cleanups in the UDF argument and result handling, in particular int64. Consolidate some duplicate int64/bigint range checking code. Expose the UDF low-level utilities (arg/result conversion) to client code. Add the sqlite3_context pointer to the JS-side UDF wrappers for API consistency.
stephan [Sun, 2 Oct 2022 20:08:53 +0000 (20:08 +0000)]
JS: clean up create_function() wrapper and add support for create_window_function(). Eliminate an extraneous blob copy when a UDF returns a blob. Make use of newfound JS-fu to clean up how sqlite3ApiBootstrap() config is initialized.
stephan [Sun, 2 Oct 2022 18:47:39 +0000 (18:47 +0000)]
js: implement a hand-written wrapper for sqlite3_create_function_v2() which converts, if necessary, JS-function-type args to WASM function wrappers. Replace DB.createFunction() impl with the new one.
stephan [Sat, 1 Oct 2022 18:47:42 +0000 (18:47 +0000)]
wasm: correct a memleak caused by a shadowed var in the previous checkin. Add a stack-like allocator, sqlite3.capi.wasm.pstack, as a faster way of managing short-lived pointers (like the one which got shadowed).
stephan [Sat, 1 Oct 2022 13:38:27 +0000 (13:38 +0000)]
Tweak sqlite3-worker1.js to be able to load either sqlite3.js or sqlite3-wasmfs.js, noting that the latter still does not load in a Worker because of an Emscripten loader bug.
stephan [Fri, 30 Sep 2022 23:49:43 +0000 (23:49 +0000)]
Remove a couple of weird quirks of the Worker1 and Promiser APIs. The Worker1 (now undocumented) unlink capability needs to be reevaluated to work equivalently for all storage backends.
stephan [Fri, 30 Sep 2022 20:35:37 +0000 (20:35 +0000)]
Add JS wrapper for sqlite3_exec() which knows how to handle a JS callback. Add some console.error() reporting of module-load failures, as they otherwise often get silently swallowed up by the loader's mechanisms. Add 'flexible-string' JS-to-WASM argument converter which performs more X-to-string conversions than the 'string' arg converter does.
stephan [Fri, 30 Sep 2022 10:55:28 +0000 (10:55 +0000)]
wasm: expose sqlite3_de/serialize(), sqlite3_malloc/free() and friends, noting that the former explicitly lies on use of the latter for memory management so is not generically safe for use in wasm.
stephan [Thu, 29 Sep 2022 22:08:22 +0000 (22:08 +0000)]
Add JS infrastructure to ostensibly allow us to customize the wasm imports, which will hypothetically allow us to eliminate the dependency on EM_JS(), but the corresponding Emscripten glue-level feature currently breaks fatally with WASMFS builds so it's disabled.
stephan [Thu, 29 Sep 2022 17:35:25 +0000 (17:35 +0000)]
Ensure that the wasm builds always, even when passing -Ox flags from the CLI, use -g3 to avoid problems caused by symbol minification with optimization levels -O2 and higher.
stephan [Thu, 29 Sep 2022 16:54:23 +0000 (16:54 +0000)]
Finish eliminating explicit Emscripten module dependencies in test code and fiddle. The only remnant in public code is the Emscripten-generated module load/init interface.
stephan [Thu, 29 Sep 2022 13:17:50 +0000 (13:17 +0000)]
Rework the Emscripten-emitted module loader/init function such that it passes on the sqlite3 module, instead of the Emscripten module, to the first then() of sqlite3InitModule()'s returned Promise. This eliminates any need to mention the Emscripten module object in client-side code unless they want to configure it in advance for loading-status reports.
stephan [Tue, 27 Sep 2022 09:17:37 +0000 (09:17 +0000)]
wasm/js: rename /persistent to /opfs to account for potential future persistent storage options. Minor flag-handling cleanups in the speedtest1 pages. Minor API tweaks in oo1.
stephan [Mon, 26 Sep 2022 11:38:58 +0000 (11:38 +0000)]
Get fiddle db export working for OPFS VFS. Add root dir handle to the main OPFS VFS worker to enable creation of certain utility functions without delegating to the async worker. Add sqlite3.capi.sqlite3_wasm_rc_str() to map integer result codes back to their SQLITE_xxx counterparts. Minor doc touchups.