]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
38 hours agoMinor kvvfs error handling cleanup. kvvfs-v2
stephan [Wed, 26 Nov 2025 20:20:40 +0000 (20:20 +0000)] 
Minor kvvfs error handling cleanup.

FossilOrigin-Name: 5ec20ebe057af297f5e0ccc0d7184ab0ed720f91db0f470a7cf827df0f2aa530

38 hours agoTeach kvvf's xClose() and xFileControl() to return more specific result codes for...
stephan [Wed, 26 Nov 2025 20:18:11 +0000 (20:18 +0000)] 
Teach kvvf's xClose() and xFileControl() to return more specific result codes for exceptions.

FossilOrigin-Name: 6b48375972e6e4112efd51ffea0e54d33a4245bf0155b7fa3ca1e3f147eb043c

38 hours agokvvfs: silently reject attempts to change the page size, as changing it corrupts...
stephan [Wed, 26 Nov 2025 20:12:29 +0000 (20:12 +0000)] 
kvvfs: silently reject attempts to change the page size, as changing it corrupts this vfs for reasons not yet understood. Add more kvvfs tests.

FossilOrigin-Name: 65272adfab333565719bde4f6c5bbe4f0b5415c17a8de43e6b2d7b0518cca4c7

41 hours agoFactor out an obsolete malloc failure check and an snprintf() for keys in transient...
stephan [Wed, 26 Nov 2025 17:19:44 +0000 (17:19 +0000)] 
Factor out an obsolete malloc failure check and an snprintf() for keys in transient kvvfs storage.

FossilOrigin-Name: e2e94f9094f8bbe93cdf7d2a2e72e92462b94e18319603c5a364f183cb780be1

41 hours agoRemove a JS-specific block from os_kv.c.
stephan [Wed, 26 Nov 2025 17:17:22 +0000 (17:17 +0000)] 
Remove a JS-specific block from os_kv.c.

FossilOrigin-Name: 3c1d5eac270e8afe6196ccb11a6d7bb0d1f262c882ce390a16b998bd2f55cb3d

41 hours agoFix tests broken by the previous commit.
stephan [Wed, 26 Nov 2025 16:40:23 +0000 (16:40 +0000)] 
Fix tests broken by the previous commit.

FossilOrigin-Name: 430d4d668fc2d151f20a02ddbbac7f884258af7fd1268d3aafb5f9e8eadf844b

42 hours agoRemove some dead code. Resolve the remaining kvvfs v1/v2 API compatibility confusion...
stephan [Wed, 26 Nov 2025 16:27:11 +0000 (16:27 +0000)] 
Remove some dead code. Resolve the remaining kvvfs v1/v2 API compatibility confusion by eliding the v1 API from Workers like we've always done. Add some tests.

FossilOrigin-Name: 450b4bcca6038be58a73ff15ff18b9d70df661fe0bd9777273e0db6fbce5f296

42 hours agoWasm speedtest1: replace some 'self' with 'globalThis' and expose the sqlite3 object...
stephan [Wed, 26 Nov 2025 16:26:27 +0000 (16:26 +0000)] 
Wasm speedtest1: replace some 'self' with 'globalThis' and expose the sqlite3 object to the global scope for inspection via the dev console (for inspecting resulting kvvfs storage objects).

FossilOrigin-Name: c18154bc9a7cf07d3902d74d27b4ca696929aae9e1abe031679bd5a42d759046

44 hours agoMinor optimization in kvvfs event notification.
stephan [Wed, 26 Nov 2025 14:22:51 +0000 (14:22 +0000)] 
Minor optimization in kvvfs event notification.

FossilOrigin-Name: fd85b96b12d164f7700624dba478d35e886b23f5c31c853715f783639ea95f23

44 hours agoInternal kvvfs docs and cleanups. Wasm speedtest1: remove the hard-coded --size=2...
stephan [Wed, 26 Nov 2025 13:55:20 +0000 (13:55 +0000)] 
Internal kvvfs docs and cleanups. Wasm speedtest1: remove the hard-coded --size=2 limit for kvvfs and use a transient storage object instead of session storage (which is limited to --size=2). For small job sizes kvvfs is roughly 3x the speed of memdb and that gap grows as the --size increases, with kvvfs _really_ bogging down on the --size=50 jsonb tests.

FossilOrigin-Name: 43173267849f7f4b77a9ee15ab586e9deb0e290071149857fe18421fb948a715

2 days agoRemove some debug output.
stephan [Tue, 25 Nov 2025 19:06:05 +0000 (19:06 +0000)] 
Remove some debug output.

FossilOrigin-Name: 9fc6b811d6b0e268be18b768b6a69381606557a1702064b29f0ff4ca7c505cac

2 days agoRemove the ostensible support for empty kvvfs names, as those names apparently never...
stephan [Tue, 25 Nov 2025 19:05:13 +0000 (19:05 +0000)] 
Remove the ostensible support for empty kvvfs names, as those names apparently never reach kvvfs.xOpen (the empty name is special). That actually simplifies things with regards to backwards compatibility.

FossilOrigin-Name: a5c61fa56770a6fffcb4c76db2256c71b2d5f0beee6fc2c4800c40bf7ef995c8

2 days agoImprove kvvfs file name validation. Add sqlite3.kvvfs.unlink().
stephan [Tue, 25 Nov 2025 18:52:08 +0000 (18:52 +0000)] 
Improve kvvfs file name validation. Add sqlite3.kvvfs.unlink().

FossilOrigin-Name: 0dfdf4681cf63541de971a20be21b33d0d3b38e8281f302d20aca9492df3da42

2 days agoAdd the sqlite3.kvvfs namespace for the new kvvfs APIs instead of adding more sqlite3...
stephan [Tue, 25 Nov 2025 16:41:56 +0000 (16:41 +0000)] 
Add the sqlite3.kvvfs namespace for the new kvvfs APIs instead of adding more sqlite3_js_kvvfs_...() methods. Reinstate that clearing kvvfs storage is illegal when db handles are opened, solely for sanity's sake (they can actually recover from that but supporting such use feels ill-advised).

FossilOrigin-Name: 02793c5905e6b99379cd5ad6bfe1eb6cccf839da081fc174dce7b06245e212fb

2 days agoAdd an explicit rollback test for kvvfs.
stephan [Tue, 25 Nov 2025 16:07:05 +0000 (16:07 +0000)] 
Add an explicit rollback test for kvvfs.

FossilOrigin-Name: 2bf31ef8027a3e15887d4dcd26fe09463b5f8852c5ce443f7d07c23d29c37311

2 days agoA more compact formulation of [ac8af73c16ab821] which uncovered two remaining direct...
stephan [Tue, 25 Nov 2025 15:59:58 +0000 (15:59 +0000)] 
A more compact formulation of [ac8af73c16ab821] which uncovered two remaining direct calls to kvrecordRead(), now replaced with calls through the thunk. Fix a typo which caused the storage object name to not be passed on to event listener.

FossilOrigin-Name: d391f1ce691fca4504c21a7e3e05a029f247da23d432ee34b0dae14be51d909c

2 days agoIn wasm builds, #if out the impls for the 3 core kvvfs i/o routines which get overwri...
stephan [Tue, 25 Nov 2025 15:35:53 +0000 (15:35 +0000)] 
In wasm builds, #if out the impls for the 3 core kvvfs i/o routines which get overwritten from JS (and thus aren't used) to reduce dependencies on POSIX APIs.

FossilOrigin-Name: ac8af73c16ab821a7aa7d28a5fde8aeba0bc4d03c0af0dd2cff288c8fdabc49e

3 days agokvvfs internal cleanups. Experimentally add async event listeners to kvvfs to explore...
stephan [Tue, 25 Nov 2025 05:44:03 +0000 (05:44 +0000)] 
kvvfs internal cleanups. Experimentally add async event listeners to kvvfs to explore backing up a kvvfs a page at a time.

FossilOrigin-Name: f355fd484947a645206c9b9c2fd6fe691455dece7fb1aa5b72cb51a86b39474f

3 days agoFactor out some now-superfluous JS-side kvvfs code. Factor out a superfluous allocati...
stephan [Tue, 25 Nov 2025 04:07:50 +0000 (04:07 +0000)] 
Factor out some now-superfluous JS-side kvvfs code. Factor out a superfluous allocation. Shorten the public API names of the new methods.

FossilOrigin-Name: be435b668f1aee56fc4965592c207de25283de238fe89002f1a68ba0567aca65

3 days agoDisallow a filename of '-journal' for db files in kvvfs, as that name has a special...
stephan [Tue, 25 Nov 2025 03:09:45 +0000 (03:09 +0000)] 
Disallow a filename of '-journal' for db files in kvvfs, as that name has a special meaning there.

FossilOrigin-Name: 357cc42633efb85c3ca9bc3d6d46430e1ecaf2825e6bdd7d7b4e0f6865d0b599

3 days agoAdd xGetLastError() to kvvfs but it does not appear to be called for xOpen() failures.
stephan [Tue, 25 Nov 2025 02:08:49 +0000 (02:08 +0000)] 
Add xGetLastError() to kvvfs but it does not appear to be called for xOpen() failures.

FossilOrigin-Name: 7e7944f00792c5e7a9ea013f9c5d1f6bb6313070de20ec4ce262ff0b430f9801

3 days agoFix a 32-/64-bit incompatibility in opfs-sahpool.
stephan [Tue, 25 Nov 2025 02:08:11 +0000 (02:08 +0000)] 
Fix a 32-/64-bit incompatibility in opfs-sahpool.

FossilOrigin-Name: 256c1dd2c367dbc3b3df5028f2004bb1126851109efc71a1699f60f493514fcb

3 days agoDo not allow the kvvfs transient flag to flag a previously-non-transient storage...
stephan [Mon, 24 Nov 2025 20:43:14 +0000 (20:43 +0000)] 
Do not allow the kvvfs transient flag to flag a previously-non-transient storage as transient. i.e. only applies when first opening a db. Rename the transient flag to delete-on-close to avoid confusion with other meanings of transient in that context.

FossilOrigin-Name: 46d6b636307d98d17344d995afd99204e16eb06b6b19021a824dab95267d5377

3 days agoAdd the sqlite3_db_filename() to the sqlite3.oo1.DB tracing output. Document an unfor...
stephan [Mon, 24 Nov 2025 20:36:49 +0000 (20:36 +0000)] 
Add the sqlite3_db_filename() to the sqlite3.oo1.DB tracing output. Document an unfortunate design choice which was only recently recognized as such.

FossilOrigin-Name: dec0c6073cc130ba445ec68bc49a410001d778c4aa21624dcb0a68b88fce251f

3 days agoAdd kvvfs URI flag transient=1 to cause the storage object to be removed when the...
stephan [Mon, 24 Nov 2025 20:14:23 +0000 (20:14 +0000)] 
Add kvvfs URI flag transient=1 to cause the storage object to be removed when the last handle to the db is closed. By default it behaves like a filesystem would, retaining the storage objects.

FossilOrigin-Name: c6183261be77d03451aed563a5e4c19aa69706aa311cfdaf5db5e9b0a167d814

3 days agoFix a typeof check so that it works in Worker threads.
stephan [Mon, 24 Nov 2025 18:17:07 +0000 (18:17 +0000)] 
Fix a typeof check so that it works in Worker threads.

FossilOrigin-Name: 3f2ed39e40e9c76c7d035b819d06c316ec4fba4e112b8a293822a8648147594b

3 days agoHave kvvfs enforce ASCII-only names to avoid truncating multibyte characters in kvvfs...
stephan [Mon, 24 Nov 2025 18:08:25 +0000 (18:08 +0000)] 
Have kvvfs enforce ASCII-only names to avoid truncating multibyte characters in kvvfs's key buffer.

FossilOrigin-Name: 03cb2a13c7f9081132390b5169cf22ffeced6ebdc5f01654360f951720310916

3 days agoGet kvvfs v2 storage import working by disallowing it when there are opened db/journa...
stephan [Mon, 24 Nov 2025 15:17:52 +0000 (15:17 +0000)] 
Get kvvfs v2 storage import working by disallowing it when there are opened db/journal handles. Move import/export out of the JsStorageDb class and into sqlite3_js_kvvfs_import/export_storage().

FossilOrigin-Name: c9e0b32278290baf987b5a46bd47358439e3d0f190b2879a965d6e4262ea7baf

4 days agoMore work on kvvfs v2. Db imports work, in the sense that the storage is properly...
stephan [Sun, 23 Nov 2025 22:13:42 +0000 (22:13 +0000)] 
More work on kvvfs v2. Db imports work, in the sense that the storage is properly replaced, but the native side is not yet able to recover from that (and how to make it able to do so is not clear).

FossilOrigin-Name: 4857c9d2fe428c19319244bf0589eaf93c124f020a633d6b7d40d35aaf969d24

4 days agoAdd the long-missing sqlite3_next_stmt() binding to JS/WASM.
stephan [Sun, 23 Nov 2025 22:09:16 +0000 (22:09 +0000)] 
Add the long-missing sqlite3_next_stmt() binding to JS/WASM.

FossilOrigin-Name: 53a99ff4ed5ef5f8620bf324a4f7a1d0812f5c80311228eb820039430ca04bd5

4 days agoDocs, cleanups, and dead code removal.
stephan [Sun, 23 Nov 2025 20:05:21 +0000 (20:05 +0000)] 
Docs, cleanups, and dead code removal.

FossilOrigin-Name: 49db59aa9c74e49d878adc8671b0d32db8f1f898bde29d046ce0e368d8987868

4 days agoGet the kvvfs v2 working in 64-bit wasm builds (a 0 vs null vs BigInt issue).
stephan [Sun, 23 Nov 2025 16:54:16 +0000 (16:54 +0000)] 
Get the kvvfs v2 working in 64-bit wasm builds (a 0 vs null vs BigInt issue).

FossilOrigin-Name: 4811742688bd8ae847c0a13ca9b395b2d2edd24ce4e7760a5d1b0adf1c7f332d

4 days agoEliminate the superfluous 'kvvfs-' part of keys for transient storage and cleanup...
stephan [Sun, 23 Nov 2025 16:35:18 +0000 (16:35 +0000)] 
Eliminate the superfluous 'kvvfs-' part of keys for transient storage and cleanup their export a bit. Reminder for later: we could potentially use the dbpage vtab to serialize any db to this JSON-friendly form.

FossilOrigin-Name: f63014f70febf82976a99f9f1ce6d793e2ca8d1dd2f72622152b64b2d65f8adc

4 days agoInitial work on eliminating the superfluous-for-transient-storage kvvfs key prefixes...
stephan [Sun, 23 Nov 2025 15:38:34 +0000 (15:38 +0000)] 
Initial work on eliminating the superfluous-for-transient-storage kvvfs key prefixes and implementing kvvfs db import.

FossilOrigin-Name: 6bc64059410b1868b7a3576e16d03c02e7c007a2be8b313e386eeb2e2a35c258

4 days agoAdd tests demonstrating basic concurrent use of kvvfs storage and that kvvfs still...
stephan [Sun, 23 Nov 2025 13:33:56 +0000 (13:33 +0000)] 
Add tests demonstrating basic concurrent use of kvvfs storage and that kvvfs still works after wiping the storage out from under it).

FossilOrigin-Name: cbbb9e61ae81097625488d78c5cbc0065c0acc3c8a7fd819490bc697f9d808c5

4 days agoBump kvvfs's sqlite3_vfs::iVersion to 2 so that its xCurrentTimeInt64() can be used...
stephan [Sun, 23 Nov 2025 12:14:18 +0000 (12:14 +0000)] 
Bump kvvfs's sqlite3_vfs::iVersion to 2 so that its xCurrentTimeInt64() can be used. Add JsStorageDb.exportToObject() to serialize a kvvfs to a JSON-friendly form.

FossilOrigin-Name: 393c1beee00ec3b3e98eb385cae0abeb1b34475140c0e8c3d57541d349904436

4 days agoReplace an alloc/free on every read of a JS kvvfs key with a one-time alloc and a...
stephan [Sun, 23 Nov 2025 11:28:27 +0000 (11:28 +0000)] 
Replace an alloc/free on every read of a JS kvvfs key with a one-time alloc and a long paragraph explaining why we have to leak it.

FossilOrigin-Name: 66fb9978f0a63887d214e895343adedfa46ee7aefccb8389d6d3af727e0a65ea

5 days agoThis combination of kvvfs callbacks seems to work okay for both persistent and transi...
stephan [Sat, 22 Nov 2025 19:21:25 +0000 (19:21 +0000)] 
This combination of kvvfs callbacks seems to work okay for both persistent and transient storage, but it's unclear why/how, as xAccess() does not appear to be doing anything useful (and misbehaves when told to report that the storage object in question exists). These tests fail in 64-bit builds for as-yet-unknown reasons (other tests continue to pass in 64-bit).

FossilOrigin-Name: 69e591d0054218ead789cee199e5258f1c378a89e4b7b0e38fe74e834e23156b

5 days agoFix a misinteraction of CREATE/READONLY flags in the OPFS VFS.
stephan [Sat, 22 Nov 2025 17:27:16 +0000 (17:27 +0000)] 
Fix a misinteraction of CREATE/READONLY flags in the OPFS VFS.

FossilOrigin-Name: 0b53be562f1e1a5b20ffe8d72df64e753a8d759b580d949a0f32409144769bb0

5 days agoFix storage-size counting of non-local/non-session kvvfs storage. Rename the 'global...
stephan [Sat, 22 Nov 2025 16:29:45 +0000 (16:29 +0000)] 
Fix storage-size counting of non-local/non-session kvvfs storage. Rename the 'global' buildin kvvfs storage object to 'localThread'.

FossilOrigin-Name: 61606be2ae2b0d73cdcd7947a77c7ad87cdf850bba90b0c3e3cdf8c02177db73

6 days agoIncremental work on kvvfs v2.
stephan [Sat, 22 Nov 2025 07:35:36 +0000 (07:35 +0000)] 
Incremental work on kvvfs v2.

FossilOrigin-Name: 60d61cf383b63b25dcfbf8da9539aaec253b6618ec83403f6690b7a32c13363d

6 days agoFactor KVVfsFile::zName back out. Remove the extraneous part of the storage keys...
stephan [Sat, 22 Nov 2025 05:37:21 +0000 (05:37 +0000)] 
Factor KVVfsFile::zName back out. Remove the extraneous part of the storage keys for non-local/non-session storage.

FossilOrigin-Name: d2bf96d68c6cb2ae68558722edb22192fb1dbbf08fefdb2fd0a4827688e082a8

6 days agoDemonstrate completely transient and a semi-transient (until page reload) kvvfs insta...
stephan [Sat, 22 Nov 2025 02:43:56 +0000 (02:43 +0000)] 
Demonstrate completely transient and a semi-transient (until page reload) kvvfs instances.

FossilOrigin-Name: 3f9ff9873303c3900dd3cba6e922bfb8cdb1f595353b692796b62e3025013517

6 days agoLatest side-stream jaccwabyt/wasmutil.
stephan [Sat, 22 Nov 2025 02:23:02 +0000 (02:23 +0000)] 
Latest side-stream jaccwabyt/wasmutil.

FossilOrigin-Name: e0b33b51229a977cc3fa8a5a6c8ea59669f8bf566b2a6330fd24da1ad886a716

6 days agoGet initial JS overrides of the kvvfs sqlite3_vfs and sqlite3_io_methods in place...
stephan [Fri, 21 Nov 2025 22:13:35 +0000 (22:13 +0000)] 
Get initial JS overrides of the kvvfs sqlite3_vfs and sqlite3_io_methods in place. It now tracks a distinct Storage-ish object per sqlite3_file instance.

FossilOrigin-Name: 19a3349a2031e2b7fae67847b55643e4f70f8dae863ebc1ace3b09d1f482c8eb

6 days agoMore work towards using JS generic Storage objects as db page storage via kvvfs.
stephan [Fri, 21 Nov 2025 18:55:33 +0000 (18:55 +0000)] 
More work towards using JS generic Storage objects as db page storage via kvvfs.

FossilOrigin-Name: 90a33941c69b3581feaed271542f0238ca81ee34fe5b353ca7da48b81ac73a5f

6 days agoRemove kvvfs-specific filename validation from the oo1.DB ctor.
stephan [Fri, 21 Nov 2025 18:49:58 +0000 (18:49 +0000)] 
Remove kvvfs-specific filename validation from the oo1.DB ctor.

FossilOrigin-Name: 206275292217be4ff317d4c9186ecaf863ca69295e2f995ed175aa65d9ad11dc

6 days agoInitial restructuring of kvvfs working towards generic support of JS's Strorage inter...
stephan [Fri, 21 Nov 2025 15:23:52 +0000 (15:23 +0000)] 
Initial restructuring of kvvfs working towards generic support of JS's Strorage interface as storage rather than hard-coding it to just window.localStorage and window.sessionStorage. The eventual goal of that is to have a storage solution which works without the POSIX I/O APIs, getting us one step closer to a wasi-sdk build. It would be transient, like Emscripten's virtual filesystem, and could hypothetically replace our dependency on that particular feature.

FossilOrigin-Name: 190ef4a94005b0feebe865a960d846a1b60ec1b267b15d5a24749f174a6169bc

6 days agoAdd new file missing from [3c4061428544].
stephan [Fri, 21 Nov 2025 15:03:38 +0000 (15:03 +0000)] 
Add new file missing from [3c4061428544].

FossilOrigin-Name: 41f94eca01d8317364aa60ddd8e5fe3cd21a215040ef271a157d450a914139d0

6 days agoEnhance ALTER TABLE to support adding and removing NOT NULL and CHECK
drh [Fri, 21 Nov 2025 14:15:56 +0000 (14:15 +0000)] 
Enhance ALTER TABLE to support adding and removing NOT NULL and CHECK
constraints.

FossilOrigin-Name: 895498e4431e02cff65a5d96db22f0b0cb9c96aedf1e3cdcdeb3c34c6fec432b

6 days agoFix the QRF so that it omits the closing text from styles "json" and "jobject"
drh [Fri, 21 Nov 2025 11:00:29 +0000 (11:00 +0000)] 
Fix the QRF so that it omits the closing text from styles "json" and "jobject"
when the result set it empty.

FossilOrigin-Name: e1ba175124be83da4db6d5d4e583b9b3b7dcb82e983c6f185d590469dcdc3139

6 days agoMove the JS pieces of kvvfs into their own file to facilitate pending feature experim...
stephan [Fri, 21 Nov 2025 10:49:32 +0000 (10:49 +0000)] 
Move the JS pieces of kvvfs into their own file to facilitate pending feature experimentation.

FossilOrigin-Name: 3c40614285449df259a3444e36f888cfb5e782ea58287914f97f496ea61e9e9f

7 days agoTest cases for the fix in the prior check-in.
drh [Thu, 20 Nov 2025 22:46:27 +0000 (22:46 +0000)] 
Test cases for the fix in the prior check-in.

FossilOrigin-Name: 4d41bee75eda51251121c8e3903f47941116e5182238a03f41a593c47efb6fcf

7 days agoPreserve auto-explain mode across mode changes, as has always been the
drh [Thu, 20 Nov 2025 21:08:46 +0000 (21:08 +0000)] 
Preserve auto-explain mode across mode changes, as has always been the
case before.

FossilOrigin-Name: 8896185ae0b0af8918aa8ce449f18759e6ae60358afbac1019397bae307b15d5

7 days agoFix hwtime.h (broken by [305bb022368bac9f]) so that unamalgamated windows
drh [Thu, 20 Nov 2025 12:41:26 +0000 (12:41 +0000)] 
Fix hwtime.h (broken by [305bb022368bac9f]) so that unamalgamated windows
builds work again.

FossilOrigin-Name: 1245319257d03a00eddbc8ff4b43b5813f8a567a12a9957f923bef58c85c0c20

7 days agoRemove an extraneous loop level from the JS bootstrapping bits.
stephan [Thu, 20 Nov 2025 12:14:03 +0000 (12:14 +0000)] 
Remove an extraneous loop level from the JS bootstrapping bits.

FossilOrigin-Name: 86817b4e9f011d296fb420be95269fecb54fb48a220bce84020e3af2d2c164a4

7 days agoEnable the SQLITE_EXPERIMENTAL_PRAGMA_20251114 in the WASM builds for the sake of...
stephan [Thu, 20 Nov 2025 12:12:55 +0000 (12:12 +0000)] 
Enable the SQLITE_EXPERIMENTAL_PRAGMA_20251114 in the WASM builds for the sake of VFS experimentors. The links in the comments describe what that does.

FossilOrigin-Name: aaa55a3ebf8e725443030be5f31ac7fc0766c1f3c771ce69852f31e7e6f165b9

7 days agoUse sqlite3MPrintf() instead of sqlite3_mprintf() internally in alter.c, alter-table-constraints
drh [Thu, 20 Nov 2025 11:06:58 +0000 (11:06 +0000)] 
Use sqlite3MPrintf() instead of sqlite3_mprintf() internally in alter.c,
for improved OOM reporting.

FossilOrigin-Name: 57555d75daa2ee8345f8329749841a322b3e57679e5c4899ef749c8bc814812d

8 days agoAdditional checks for OOM conditions.
drh [Thu, 20 Nov 2025 02:03:57 +0000 (02:03 +0000)] 
Additional checks for OOM conditions.

FossilOrigin-Name: 8fafd4988bf1fa1aa799c2834dd31bebdd52e7ae8e68c0197ccb497eb9b1e5f6

8 days agoMark an unreachable branch with NEVER().
drh [Thu, 20 Nov 2025 00:56:28 +0000 (00:56 +0000)] 
Mark an unreachable branch with NEVER().

FossilOrigin-Name: df2259a32fd65986eafceb2c551e6e1661927f1f5b18dbb97c59d9627279eea0

8 days agoCall sqlite3OomFault() rather than setting db->mallocFailed directly.
drh [Wed, 19 Nov 2025 23:11:56 +0000 (23:11 +0000)] 
Call sqlite3OomFault() rather than setting db->mallocFailed directly.

FossilOrigin-Name: 4fd5dfa215f14b20ddfc55904acbcc9bc9fd2123bb06fff72ef76efa17304566

8 days agoFix three harmless declaration-after-statement warnings in the new CLI code.
drh [Wed, 19 Nov 2025 19:37:28 +0000 (19:37 +0000)] 
Fix three harmless declaration-after-statement warnings in the new CLI code.

FossilOrigin-Name: b65b29656c835db22557733f4dcfe906bf21a7a3c36266cbbc7e3277f029b901

8 days agoImproved comments in code. Omit unneeded wrapper functions.
drh [Wed, 19 Nov 2025 15:25:18 +0000 (15:25 +0000)] 
Improved comments in code.  Omit unneeded wrapper functions.

FossilOrigin-Name: 3485c7c81bee8e98ea6b403438bcdb2b6fa058afeafea150ce1c859345e1529b

8 days agoStrip unterminated "--" comments from the end of constraints added using ALTER TABLE...
dan [Wed, 19 Nov 2025 11:31:59 +0000 (11:31 +0000)] 
Strip unterminated "--" comments from the end of constraints added using ALTER TABLE ADD CONSTRAINT or ADD NOT NULL.

FossilOrigin-Name: c73ab47b0250c01f1ffa6e506793769744ebeb8ca7edbb78de9a08db2037d6de

8 days agoClarification to the header comment on dropConstraintFunc(). No changes
drh [Wed, 19 Nov 2025 11:28:48 +0000 (11:28 +0000)] 
Clarification to the header comment on dropConstraintFunc().  No changes
to code.

FossilOrigin-Name: 4bd53fbb20d78de7bbff1154e7ee1321b93b0ede435e150ad4ee992a4108ad5a

9 days agoTrivial simplification to the ALTER TABLE ADD CONSTRAINT code.
drh [Wed, 19 Nov 2025 10:26:49 +0000 (10:26 +0000)] 
Trivial simplification to the ALTER TABLE ADD CONSTRAINT code.

FossilOrigin-Name: 383965b3ba701d3627e0bbd09ad04d0ce00d4721497d82e241dc7cffa745b1d9

9 days agoMerge the latest trunk changes into the alter-table-constraints branch.
drh [Tue, 18 Nov 2025 19:36:45 +0000 (19:36 +0000)] 
Merge the latest trunk changes into the alter-table-constraints branch.

FossilOrigin-Name: 31d7aeeaef20ac42c3c395dbaf7a8225ac718256a4cbeb7c198d1c7361766b1b

9 days agoDo not attempt to make the generated file "shell.c" read-only. This turns
drh [Tue, 18 Nov 2025 19:11:21 +0000 (19:11 +0000)] 
Do not attempt to make the generated file "shell.c" read-only.  This turns
out to be annoying in general, and especially annoying on macs.

FossilOrigin-Name: 6ab18d036a3e412ee01806a40f69aca2b77283bd5336df27597cc19d32e6e6f2

9 days agoNew subcomponent, the Query Result Formatter (QRF), that formats query
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.

FossilOrigin-Name: 7e460ffa5aae884807db9e7c8214d6d822d5d38ea406fe3b3eac04ac16f158fa

9 days agoAdd support for SQLITE_LIMIT_PARSER_DEPTH to limit the size of the stack
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.

FossilOrigin-Name: 52ba0c731d004409353a55ce8ca5a514ce486a077a2be82db5b8fea7619848d5

9 days agoModify the "%realloc" and "%free" commands in Lemon so that the functions parser-stack-size
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.

FossilOrigin-Name: 9862c945d9a8531f9bef123aee9ed1fd3f64542250a57beb3a150227bc3c1a12

9 days agoLower the default stack size for the parse to 50.
drh [Tue, 18 Nov 2025 15:20:22 +0000 (15:20 +0000)] 
Lower the default stack size for the parse to 50.

FossilOrigin-Name: 41fe19ab054acda912bc32dd6f9c6412416ab1af6cf55515e96c89fb55b46424

9 days agoAdd the SQLITE_LIMIT_PARSER_DEPTH value for sqlite3_limit(). This isn't
drh [Tue, 18 Nov 2025 14:48:33 +0000 (14:48 +0000)] 
Add the SQLITE_LIMIT_PARSER_DEPTH value for sqlite3_limit().  This isn't
something that many applications will need, but it is useful for testing.

FossilOrigin-Name: 8f0b07f36159225c476f756f8f9b35c75783bc8bed43b578f4d1055fa800ecc9

9 days agoYet another attempt at controlling the parser stack size.
drh [Tue, 18 Nov 2025 13:03:08 +0000 (13:03 +0000)] 
Yet another attempt at controlling the parser stack size.

FossilOrigin-Name: cb19986dc6bc483df21e082e54a14cb6d7540b1734259e6d326d676908ac0172

9 days agoFix incorrect "#line" generation in Lemon.
drh [Tue, 18 Nov 2025 10:38:41 +0000 (10:38 +0000)] 
Fix incorrect "#line" generation in Lemon.

FossilOrigin-Name: 5c0214df2c0a7470ac2edca0c483a3edd3c39ef0739688ab9a06e23882200360

10 days agoAdd api.oo1=0 flag to ext/wasm/GNUmakefile to strip out the sqlite3.oo1 pieces from...
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].

FossilOrigin-Name: ea48567ac54e4949a8b68977a58a5de7946e074ae8737133071d02f40ac97f34

10 days agoIf SQL is entered as additional command-line arguments to CLI, that counts qrf
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.

FossilOrigin-Name: 3d55ec15a9e4dc8af4bf1e2884eaa2c809995fb1529633f73287dc7a54153629

10 days agoFix a harmless compiler warning.
drh [Mon, 17 Nov 2025 19:19:58 +0000 (19:19 +0000)] 
Fix a harmless compiler warning.

FossilOrigin-Name: 6621737cc05cbf8ff5f576775a8a3c64f666b56d42939968ebb55d72a835646b

10 days agoThe -textjsonb option is on by default in the standard non-batch mode of
drh [Mon, 17 Nov 2025 18:51:55 +0000 (18:51 +0000)] 
The -textjsonb option is on by default in the standard non-batch mode of
the CLI.  New fast screening test for JSONB.

FossilOrigin-Name: fd09f934d64ec07fd56f1b80ab05dafb28b605d5802ff5758eea17d8ad24e3cc

10 days agoCLI comes up in legacy "list" mode if neither stdin or stdout are a tty, or
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.

FossilOrigin-Name: f6bfcea9a01493af182e9aa0d35df6f81bf9e36220df79139afa287fa43d9aa3

11 days agoFix test cases impacted by the use of ~/.sqliterc
drh [Mon, 17 Nov 2025 00:15:14 +0000 (00:15 +0000)] 
Fix test cases impacted by the use of ~/.sqliterc

FossilOrigin-Name: 8fc05faef91186429c6c710991fd736b1df9a9af946c29d207db2518d6436b38

11 days agoFix a bug in ".show". Adjust test cases for the new default mode.
drh [Sun, 16 Nov 2025 23:06:45 +0000 (23:06 +0000)] 
Fix a bug in ".show".  Adjust test cases for the new default mode.

FossilOrigin-Name: 2aebd7bfecaaf1f75b52b05a0d3009fc0dc61289ae666d24cb4e3ddfaf251645

11 days agoDefault .mode is now qbox with limits. New --compat YYYYMMDD command-line
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.

FossilOrigin-Name: 52e022375961ad9460412e40e100219ee59055eb0ab309cbfc2ab19f61929a45

11 days agoFix a long-standing bug in .schema when the argument contains a ".".
drh [Sun, 16 Nov 2025 10:49:51 +0000 (10:49 +0000)] 
Fix a long-standing bug in .schema when the argument contains a ".".

FossilOrigin-Name: 404576214fc20161cdcb031d57696d6068506309c8faecd3e4424e5ced28046b

12 days agoFix a problem with the new command-line parsing in the CLI.
drh [Sun, 16 Nov 2025 02:32:06 +0000 (02:32 +0000)] 
Fix a problem with the new command-line parsing in the CLI.

FossilOrigin-Name: 3e02804c387c89afde59eef8e464c6011e083e158873e4f8ab1f17bcc12b7c28

12 days agoImproved --safe mode defenses. Fix a test case error.
drh [Sun, 16 Nov 2025 01:34:01 +0000 (01:34 +0000)] 
Improved --safe mode defenses.  Fix a test case error.

FossilOrigin-Name: eacc9db80de8baa878ebdc3a054538c8998db9a2e46720c0d8b109d62a0cac29

12 days agoImproved error detection in the argument to .mode --widths.
drh [Sun, 16 Nov 2025 01:03:53 +0000 (01:03 +0000)] 
Improved error detection in the argument to .mode --widths.

FossilOrigin-Name: 4d774ee495e38282b8701988fe514344ee0e81285692c8d1adc1ee7e22960ad9

12 days agoFix formatting problem in .schema and .fullschema
drh [Sun, 16 Nov 2025 00:56:24 +0000 (00:56 +0000)] 
Fix formatting problem in .schema and .fullschema

FossilOrigin-Name: 4035fb15ff36d139ed4c839fdebb0278e6cf9a2f00298e1a548a8f8317ba14b2

12 days agoHelp text improvements in the CLI.
drh [Sat, 15 Nov 2025 20:10:32 +0000 (20:10 +0000)] 
Help text improvements in the CLI.

FossilOrigin-Name: dcaabd97d5064dd70fb386a2eef55f4301bba4b54915ed6a91d736abe7a04ae8

12 days agoRemove an unused struct.
stephan [Sat, 15 Nov 2025 16:06:03 +0000 (16:06 +0000)] 
Remove an unused struct.

FossilOrigin-Name: 93dd0e62b74a0d99803f680f23953e9fa2429074505ba402ca5ed4610ddef8fb

12 days agoBug fix to the --lineline option in the CLI. Other minor CLI tweaks.
drh [Sat, 15 Nov 2025 15:30:55 +0000 (15:30 +0000)] 
Bug fix to the --lineline option in the CLI.  Other minor CLI tweaks.

FossilOrigin-Name: 40f81a9f9f6ea29144174fbd487f83d150a1be8f35e7496bfc1cfc6a556b6312

12 days agoJNI: when validing the eTextRep argument in sqlite3_create_function(), only validate...
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.

FossilOrigin-Name: aab640be7bc5829fe16d2582b13f942b7debb271c150ca2471561de6b2d70dc7

12 days agoColumnar modes respond to nScreenWidth.
drh [Sat, 15 Nov 2025 15:18:41 +0000 (15:18 +0000)] 
Columnar modes respond to nScreenWidth.

FossilOrigin-Name: 60d26ebb4d91cc885b6b938ef2fc2864ebbf5a18d2e456521ee2f4aa3b22eddf

12 days agoReplace the JNI binding's internal use of sqlite3ErrorWithMsg() with sqlite3_set_errm...
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.

FossilOrigin-Name: 0899a9eb3af727f310372f3441573ab506ffec31dca4774e850b2b59a4001ee0

12 days agoRandom JS build cleanups and parallel build mkdir race fixes. Reinstate the recently...
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).

FossilOrigin-Name: acb1525a49463de67716638626406ccde9a282907d0de218ab88bf474ba830ee

12 days agoColumnar formats respond to --screenwidth restrictions by removing
drh [Sat, 15 Nov 2025 12:09:13 +0000 (12:09 +0000)] 
Columnar formats respond to --screenwidth restrictions by removing
cell padding.

FossilOrigin-Name: cbe233ca131118692fd4a84d8fcf0dfca926fa935f66cfb718c235d54084de3d

12 days agoReorder initialization of sqlite3ApiBootstrap()'s bownstrapped config object so that...
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.

FossilOrigin-Name: 2bd0addb6068cd2b34f6151a824c578e2253f541a8c55b578219b09c42afd82b

12 days agoGeneric internal JS cleanups towards improving portability of sqlite3-api.js to other...
stephan [Sat, 15 Nov 2025 11:30:45 +0000 (11:30 +0000)] 
Generic internal JS cleanups towards improving portability of sqlite3-api.js to other build systems.

FossilOrigin-Name: 5bc37e5c2fcd83fd0bc40234144072363f1cbf7d811a15b74a0991e397a35eb8

12 days agoData structure improvements on columnar layout. Prep work for getting
drh [Sat, 15 Nov 2025 11:28:23 +0000 (11:28 +0000)] 
Data structure improvements on columnar layout.  Prep work for getting
columnar layouts to respond to nScreenWidth.

FossilOrigin-Name: 777eeb2ed2708faf42559387bd582b9345a794798a0327e4fcd75e37948eac60

13 days agoMove sqlite3-api-cleanup.js into post-js-footer.js to remove the final direct Emscrip...
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.

FossilOrigin-Name: 2fcbd8e17d8f1dd7e9d45168805dba718777e46803d9375a4212296d3d0cd89c