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].
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]
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].
stephan [Wed, 5 Nov 2025 05:59:53 +0000 (05:59 +0000)]
TEA extension: add --tcl-stubs config flag, defaulting to zero, because there does not seem to be a universally-valid default for that. Addresses [forum:cd6503fce2|forum post cd6503fce2].
stephan [Tue, 4 Nov 2025 22:01:55 +0000 (22:01 +0000)]
Minor wasm build simplifications and extend the JS bindings of sqlite3_column/value_text() such that they include embeded NUL bytes in their result strings rather than truncate them at NUL. Consolidate the shell.c build flags from the canonical and autoconf makefiles into the configure script.
stephan [Mon, 3 Nov 2025 21:26:27 +0000 (21:26 +0000)]
Add new file missing from [936990cf067a5ebb] (and subsequently deleted by fossil clean -x). Have speedtest1 wasm use the user-provided sqlite3.c, rather than forcing the canonical one, so that the wasm exports don't have to be re-generated for that special case. Remove a harmless duplicate -D... flag.
drh [Mon, 3 Nov 2025 15:34:25 +0000 (15:34 +0000)]
Use the same compile-time options for the CLI in the auto-setup tarball
as are used in the canonical source tree.
[forum:/forumpost/8975130218|Forum post 8975130218].
stephan [Sat, 1 Nov 2025 14:49:05 +0000 (14:49 +0000)]
Fix ext/wasm/mkdist.sh to use ./version-info instead of ../../version-info (a recent build change made to ensure that builds with a custom sqlite3.c embed that version info).
drh [Fri, 31 Oct 2025 15:18:29 +0000 (15:18 +0000)]
Change the name of a file-scope constant array in carray.c so that it does
not conflict with other variables names in other files when carray.c is
amalgamated. This is down to resolve a harmless compiler warning.
stephan [Thu, 30 Oct 2025 21:11:01 +0000 (21:11 +0000)]
Add SQLITE_OMIT_WAL checks around some functions to avoid defining unused statics in such builds. Fixes OMIT_WAL builds on msys2 and passes tool/omittest-msvc.tcl.
stephan [Thu, 30 Oct 2025 20:18:20 +0000 (20:18 +0000)]
Simplify the EXPORTED_FUNCTIONS lists to use the preprocessor instead of per-list shell commands. (Unrelated) Remove part of the post-compilation JS filtering which breaks with emsdk 4.0.16+, which means the .js files are about 57kb bigger than they really ought to be.
stephan [Thu, 30 Oct 2025 18:46:03 +0000 (18:46 +0000)]
Add (void) to two places for the sake of SQLITE_OMIT_WAL builds. Why these do not complain on tests in this tree, but do on a downstream tree (same machine, same compiler), is a mystery.
drh [Thu, 30 Oct 2025 11:39:49 +0000 (11:39 +0000)]
Fix the CLI ".dump" command so that it does not make duplicate
sqlite_sequence table entries as described in
[forum:/forumpost/b1674b56ad|forum thread b1674b56ad].
stephan [Thu, 30 Oct 2025 02:21:38 +0000 (02:21 +0000)]
A experiment addressing the embedded-NUL behavior of sqlite3_colum/value_text() in the JS bindings, as discussed in [forum:d77281aec2df9ada|forum post d77281aec2]. This is an experiment only. It works, in that existing tests do not see the difference, but it has implicications which require careful consideration before deploying.
drh [Wed, 29 Oct 2025 20:47:01 +0000 (20:47 +0000)]
Fix a logic error introduced by [cea8bf79e18d55a8] which caused
"0 OR 2" to be evaluated as "2" instead of as "1". Problem reported at
[forum:/forumpost/d5f32040c5d50d2d|forum post d5f32040c].
drh [Tue, 28 Oct 2025 13:24:50 +0000 (13:24 +0000)]
Fix an signed integer overflow problem that can occur when using an oversize
value for the SQLITE_MAX_LENGTH compile-time option together with
multi-gigabyte operands to the OP_Concat operator.
drh [Tue, 28 Oct 2025 10:50:55 +0000 (10:50 +0000)]
Add enhanced resistance to corruption after posix advisory locks on the
database file been unintentionally broken on unix by running
close(open(DBFILE)) from a separate thread.