drh [Tue, 18 Nov 2025 17:49:48 +0000 (17:49 +0000)]
New subcomponent, the Query Result Formatter (QRF), that formats query
results for display to humans on a fixed-width font terminal. Rework the
CLI to make use of the QRF. Renovate the .mode command of the CLI. Also
incorporate the QRF into the TCL interface as the "format" method.
drh [Tue, 18 Nov 2025 17:27:46 +0000 (17:27 +0000)]
Add support for SQLITE_LIMIT_PARSER_DEPTH to limit the size of the stack
used by the parser. This can help prevent deeply nested parse trees that
then cause problems on machines with smaller CPU stacks. Modify the
%realloc and %free directives of Lemon and add the new %stack_size_limit
directive in support of this capability.
drh [Tue, 18 Nov 2025 15:40:02 +0000 (15:40 +0000)]
Modify the "%realloc" and "%free" commands in Lemon so that the functions
they specify take an extra parameter at the end, the %extra_context pointer.
This allows the implementation to distinguish between OOM errors and
failures to increase the stack size because of the stack size limit.
stephan [Mon, 17 Nov 2025 23:55:41 +0000 (23:55 +0000)]
Add api.oo1=0 flag to ext/wasm/GNUmakefile to strip out the sqlite3.oo1 pieces from the build. Part of the ongoing response to [forum:4b7d45433731d2e0|forum post 4b7d45433731d2e0].
drh [Mon, 17 Nov 2025 19:46:04 +0000 (19:46 +0000)]
If SQL is entered as additional command-line arguments to CLI, that counts
the same as getting input from a pipe or file for the purpose of determining
the default format mode.
drh [Mon, 17 Nov 2025 16:44:13 +0000 (16:44 +0000)]
CLI comes up in legacy "list" mode if neither stdin or stdout are a tty, or
if "--compat 20251114" or earlier is specified, or if "--batch" is used.
New modes "batch" and "tty" select either legacy "list" mode or the newer
"qbox" mode with limits.
Make CVS output compatible with legacy. Break out ".import" into a separate
subroutine in anticipation of forthcoming improvements. General code
cleanup.
drh [Sun, 16 Nov 2025 17:27:21 +0000 (17:27 +0000)]
Default .mode is now qbox with limits. New --compat YYYYMMDD command-line
option, and new -DCOMPATIBILITY_DATE=YYYYMMDD compile-time options can
override. Command ".mode YYYYMMDD" sets the mode to the default for the
date given.
stephan [Sat, 15 Nov 2025 15:30:45 +0000 (15:30 +0000)]
JNI: when validing the eTextRep argument in sqlite3_create_function(), only validate the lower four bits (the high bits are for other flags). Add flags to test functions to ensure this case is triggered.
stephan [Sat, 15 Nov 2025 15:09:04 +0000 (15:09 +0000)]
Replace the JNI binding's internal use of sqlite3ErrorWithMsg() with sqlite3_set_errmsg() and have it handle OOM in a way consistent with the rest of the JNI bindings.
stephan [Sat, 15 Nov 2025 13:30:13 +0000 (13:30 +0000)]
Random JS build cleanups and parallel build mkdir race fixes. Reinstate the recently-removed [a65bd978cbc646ec] after finding a reformulation which works on Emscripten 4.0.19 (and saves about 85kb on the JS deliverables).
stephan [Sat, 15 Nov 2025 11:53:30 +0000 (11:53 +0000)]
Reorder initialization of sqlite3ApiBootstrap()'s bownstrapped config object so that it's possible to inject the wasm memory and exports via that, to simplify plugging-in of sqlite3-api.js in other builds. Previously the build-provided wasm exports/memory overrode any which a client might want to use.
stephan [Sat, 15 Nov 2025 09:19:03 +0000 (09:19 +0000)]
Move sqlite3-api-cleanup.js into post-js-footer.js to remove the final direct Emscripten dependency from the intermediary build product sqlite3-api.js (the whole library, waiting to be bootstrapped). This is partly in response to [forum:4b7d45433731d2e0|forum post 4b7d45433731d2e0], which demonstrates a potential use case for a standalone sqlite3-api.js. This is a build/doc change, not a functional one.
dan [Fri, 14 Nov 2025 17:27:20 +0000 (17:27 +0000)]
If SQLITE_EXPERIMENTAL_PRAGMA_20251114 is defined at build-time, send an experimental pragma file-control to the VFS if a call to take a SHARED lock is to be immediately followed by one to take a RESERVED.
stephan [Fri, 14 Nov 2025 16:56:51 +0000 (16:56 +0000)]
In sqlite3-api-cleanup.js, if no Emscripten module is detected then simply return, rather than throw. This should enable the generated sqliet3-api.js (normally an intermediary file) to be used as-is, with the caveat that the caller has to bootstrap the library themselves.
stephan [Fri, 14 Nov 2025 14:42:00 +0000 (14:42 +0000)]
Fix a makefile ordering bug which caused certain builds to fail unless others had already been built. Remove the superfluous sqlite3-node.wasm from the final deliverables dir (sqlite3-node.mjs uses sqlite3.wasm instead).
drh [Thu, 13 Nov 2025 11:36:48 +0000 (11:36 +0000)]
Fix a problem in the EXISTS-to-JOIN optimization ([e33da6d5dc964db8]) so
that it works with nested WHERE and EXISTS statements.
[forum:/forumpost/0704c3c41e49631b|Forum post 0704c3c41e4]
drh [Wed, 12 Nov 2025 18:54:09 +0000 (18:54 +0000)]
Continuing code cleanup. Various minor bug fixes. All legacy tests now
pass. All planned features for ".mode" are implemented, at least at the
interface level, though some features are still no-ops.
drh [Wed, 12 Nov 2025 13:46:11 +0000 (13:46 +0000)]
Add a new direct CLI testing script in test/modeA.clitest to demonstration
that can be done. Rig this this to be run by test/shellB.test during normal
testing.
drh [Wed, 12 Nov 2025 12:44:02 +0000 (12:44 +0000)]
Rename QRF_STYLE_JsonLine to QRF_STYLE_JObject. Add new convenience modes
to the CLI and generally refactor and improve the ".mode" command. Some
tests are failing, mostly due to changes in error message output and similar.
drh [Tue, 11 Nov 2025 14:08:50 +0000 (14:08 +0000)]
Move the ".output" command into a separate subroutine. Enhance .output so
that it is able to capture output in a sqlite3_str object, then compare that
captured output we patterns to accomplish tests.
drh [Tue, 11 Nov 2025 00:44:25 +0000 (00:44 +0000)]
Factor the code for ".mode" out of do_meta_command() and into its own
subroutine, to show how the new infrastructure makes this easy. We need
to do the same for all the dot-commands. At the same time, add the
-textjsonb option to .mode.
drh [Mon, 10 Nov 2025 23:40:40 +0000 (23:40 +0000)]
Revamp the internal data structures that the CLI uses for tracking and
managing the display mode. This is an incremental check-in. The code
compiles and runs, but not all tests are passing.
drh [Mon, 10 Nov 2025 15:56:18 +0000 (15:56 +0000)]
The ".www" command is now handled by QRF. So at this point, QRF handles
all query result formatting in the CLI and the legacy formatter has been
removed from the code.
stephan [Mon, 10 Nov 2025 07:41:54 +0000 (07:41 +0000)]
Reworking of JS internals to support binding of nested C structs (like sqlite3_index_constraint and friends) and allow some of the automated JS/C conversions to be plugged in at the struct-binding level, simplifying how struct members, in particular function pointers, can be used from JS.
stephan [Sun, 9 Nov 2025 06:32:10 +0000 (06:32 +0000)]
In sqlite3.wasm.allocFromTypedArray(), swap the order of the allocation and the access to the heap view object to work around an obscure issue when allocating huge blobs. The heap view object could previously become stale via the following allocation if the underlying WebAssembly.Memory object needed to grow. Essentially a realloc()-moves-the-pointer situation but it only comes up with huge allocations under the right circumstances and would trigger a JS exception (as opposed to corrupting the WASM heap). Problem reported in [forum:05b77273be104532|forum post 05b77273be104532].