Commit Graph

31213 Commits

Author SHA1 Message Date
stephan
6003505a39 Cherry-pick JS fixes/cleanups/docs from [206275292217], [256c1dd2c367], and [dec0c6073cc1] from the kvvfs-v2 branch into trunk.
FossilOrigin-Name: cdd3e700f59e5c30241cd5c6d9ea31f6a5f1c7130c6341b4e0b6dc32b06f3c79
2025-11-25 19:29:23 +00:00
stephan
f37923e723 Guard access to a piece of Emscripten-related scaffolding so that sqlite3-api.js does not hit it when imported into other builds. Reported in [forum:6eacbb9c447a5665|forum post 6eacbb9c447a5665].
FossilOrigin-Name: cb9cf028fcefa8ec51415b5dac886c2443b2ed207fa388dbc3d725dcc85fe092
2025-11-25 19:20:15 +00:00
stephan
1da8e7ac4f Remove some debug output.
FossilOrigin-Name: 9fc6b811d6b0e268be18b768b6a69381606557a1702064b29f0ff4ca7c505cac
2025-11-25 19:06:05 +00:00
stephan
20e1f8a289 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
2025-11-25 19:05:13 +00:00
stephan
f0ca498c61 Improve kvvfs file name validation. Add sqlite3.kvvfs.unlink().
FossilOrigin-Name: 0dfdf4681cf63541de971a20be21b33d0d3b38e8281f302d20aca9492df3da42
2025-11-25 18:52:08 +00:00
drh
6ef15842cd Fix subtle inaccuracies in qrfWrapLine(). Omit an unused variable from shell.c.in.
FossilOrigin-Name: 5804ba4874cc41b11e8bb559d5533283c2895d2b13316830955663575567f911
2025-11-25 18:20:33 +00:00
stephan
e62055f274 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
2025-11-25 16:41:56 +00:00
stephan
27aec2d1c1 Add an explicit rollback test for kvvfs.
FossilOrigin-Name: 2bf31ef8027a3e15887d4dcd26fe09463b5f8852c5ce443f7d07c23d29c37311
2025-11-25 16:07:05 +00:00
stephan
30f9c25d9a 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
2025-11-25 15:59:58 +00:00
stephan
a63538027c 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
2025-11-25 15:35:53 +00:00
dan
0e2d839f0e Fix a typo in fts3/4 debugging code allowing 'maxpendinXY' to act as a synonym for 'maxpending=' in special INSERT statements.
FossilOrigin-Name: 5af554337af3052a5fd734c05883700dd42d140d99d41154b60e1a0f559e5023
2025-11-25 15:11:34 +00:00
drh
011c261472 Work around an incorrect compiler warning on Mac.
FossilOrigin-Name: d4c1d3e30b774802a7abd5f61807a690fb5be7617459f3dbd7ec1efceb6125d7
2025-11-25 13:58:36 +00:00
drh
993b38f0f3 Fixes to .mode in the CLI. "qbox" sets the correct null value.
The "--quote on" option sets the null value to NULL.

FossilOrigin-Name: 5454ec46e162247afa178c8532a0fa19eb05897417ac5b3d2a2ed14bfd331a75
2025-11-25 12:16:56 +00:00
drh
b24048ddce Omit the unused bTextNull flag from the QRF spec object.
FossilOrigin-Name: 4bbf176a87b1bedcce0359b70bbf6831a1e458d48c91dcba49f5e00bb38ecaa1
2025-11-25 10:53:39 +00:00
stephan
68230ef670 kvvfs internal cleanups. Experimentally add async event listeners to kvvfs to explore backing up a kvvfs a page at a time.
FossilOrigin-Name: f355fd484947a645206c9b9c2fd6fe691455dece7fb1aa5b72cb51a86b39474f
2025-11-25 05:44:03 +00:00
stephan
76dc170938 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
2025-11-25 04:07:50 +00:00
stephan
c14460f466 Disallow a filename of '-journal' for db files in kvvfs, as that name has a special meaning there.
FossilOrigin-Name: 357cc42633efb85c3ca9bc3d6d46430e1ecaf2825e6bdd7d7b4e0f6865d0b599
2025-11-25 03:09:45 +00:00
stephan
d3a0fc5473 Add xGetLastError() to kvvfs but it does not appear to be called for xOpen() failures.
FossilOrigin-Name: 7e7944f00792c5e7a9ea013f9c5d1f6bb6313070de20ec4ce262ff0b430f9801
2025-11-25 02:08:49 +00:00
stephan
45d8831cad Fix a 32-/64-bit incompatibility in opfs-sahpool.
FossilOrigin-Name: 256c1dd2c367dbc3b3df5028f2004bb1126851109efc71a1699f60f493514fcb
2025-11-25 02:08:11 +00:00
drh
c42259c2bd Fix typos in the help text for ".mode" of the CLI.
FossilOrigin-Name: fddb99c5162ba12a6e3c87e96583d57bae217339b4dd6dc44c3538e738fbf625
2025-11-25 00:21:27 +00:00
stephan
b7ed25a86f 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
2025-11-24 20:43:14 +00:00
stephan
91c8b974e5 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
2025-11-24 20:36:49 +00:00
stephan
c4d6f31747 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
2025-11-24 20:14:23 +00:00
drh
94b621a15a Add the --blob-quote option to the ".mode" command in the CLI.
FossilOrigin-Name: 76a986b10d284b25915a07b7150ef1b85f4ef7d48d4e5315b13e7d1532cb97f1
2025-11-24 18:31:13 +00:00
stephan
d8b323f652 Fix a typeof check so that it works in Worker threads.
FossilOrigin-Name: 3f2ed39e40e9c76c7d035b819d06c316ec4fba4e112b8a293822a8648147594b
2025-11-24 18:17:07 +00:00
stephan
c340a0f717 Have kvvfs enforce ASCII-only names to avoid truncating multibyte characters in kvvfs's key buffer.
FossilOrigin-Name: 03cb2a13c7f9081132390b5169cf22ffeced6ebdc5f01654360f951720310916
2025-11-24 18:08:25 +00:00
dan
e77e6bd0a0 Change some 32-bit integers in fts3_write.c to 64-bit to reduce the chances of integer overflow.
FossilOrigin-Name: 8f8a7224c1e0173764757d5022de60abec3babdc3d4131632805e0b04d1a65bf
2025-11-24 17:44:17 +00:00
drh
4aadef3370 Add the QRF_BLOB_Size encoding for BLOBs in QRF.
FossilOrigin-Name: bafff695d34202377b937cb4ca9f8a7611ae286d9ab927e6c71faa3cd99496e5
2025-11-24 16:46:08 +00:00
dan
8f11a71722 Avoid an assert() failure caused by processing a CREATE TABLE AS ... command that generates very long column names.
FossilOrigin-Name: 06554a079d6b299986fc5eeb201595fad14f77c0efcf2d65bd2f36bbc325892c
2025-11-24 16:04:07 +00:00
dan
09079ddbc9 Avoid signed integer overflow that may occur in a non-default build when processing a very large CREATE TABLE AS ... statement.
FossilOrigin-Name: b7417497d1fdbf588a8aca8499d27dee560d728a1eafbf44b34fe3b119423d98
2025-11-24 15:40:10 +00:00
stephan
72b4d638a5 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
2025-11-24 15:17:52 +00:00
drh
10dd61fd91 Show just the list of available modes and omit the current mode display
for the ".mode --list" command in the CLI.

FossilOrigin-Name: b9b2761fe79d9cc52365eef6bc34c7442972c5410517ff69926397cc7974ae33
2025-11-24 13:26:06 +00:00
drh
69537bdef6 In the CLI on the ".mode" command, replace the recently added --no-limits option with
"--limits L,C".  And add --sw as an alias for --screenwidth.

FossilOrigin-Name: cff0978587a4193b57b0384a587bf89174be2fd91cff4d40130babef1dc8431e
2025-11-24 13:24:58 +00:00
stephan
eaeaad519d Doc typo fix.
FossilOrigin-Name: d96cc772f0423f3f2b6ee0b0fb3d7e133cc4981cc7be76527a6d43792ece74e2
2025-11-24 13:22:26 +00:00
stephan
b6685f6e8a Add the fail-on-malloc()-error patch to the autosetup maintenance docs.
FossilOrigin-Name: 526b88fb9b270e780660b97fc14f41583885a3d801f0ed17e0e35ebd61749b26
2025-11-24 13:10:23 +00:00
drh
4f7cd07abb Change our local copy of the third-party jimsh0.c program (used only
during the build process) so that it prints an error message and
exits if malloc() fails.  This does not fix any actual bugs nor make
the build process any "safer", but it might help prevent bothersome
warnings from pedantic static analyzers.

FossilOrigin-Name: 72c8a5b94cdf5da7e2b197e02c9d5d98fe415cd731c3893acf3ba69bb4dde37a
2025-11-24 11:00:02 +00:00
stephan
9101b90159 Add the long-missing sqlite3_next_stmt() binding to JS/WASM.
FossilOrigin-Name: de27d2d3f2353309227b4d5f77eff76c108c094b61ac59f5a769229a084f2567
2025-11-23 22:18:26 +00:00
stephan
853335af49 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
2025-11-23 22:13:42 +00:00
stephan
8679c33355 Add the long-missing sqlite3_next_stmt() binding to JS/WASM.
FossilOrigin-Name: 53a99ff4ed5ef5f8620bf324a4f7a1d0812f5c80311228eb820039430ca04bd5
2025-11-23 22:09:16 +00:00
stephan
606b1bd153 Docs, cleanups, and dead code removal.
FossilOrigin-Name: 49db59aa9c74e49d878adc8671b0d32db8f1f898bde29d046ce0e368d8987868
2025-11-23 20:05:21 +00:00
stephan
da0d872270 Get the kvvfs v2 working in 64-bit wasm builds (a 0 vs null vs BigInt issue).
FossilOrigin-Name: 4811742688bd8ae847c0a13ca9b395b2d2edd24ce4e7760a5d1b0adf1c7f332d
2025-11-23 16:54:16 +00:00
stephan
274db1fd84 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
2025-11-23 16:35:18 +00:00
stephan
d855948547 Initial work on eliminating the superfluous-for-transient-storage kvvfs key prefixes and implementing kvvfs db import.
FossilOrigin-Name: 6bc64059410b1868b7a3576e16d03c02e7c007a2be8b313e386eeb2e2a35c258
2025-11-23 15:38:34 +00:00
stephan
56a4a2173e 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
2025-11-23 13:33:56 +00:00
stephan
ea375f1320 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
2025-11-23 12:14:18 +00:00
stephan
48c8405f99 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
2025-11-23 11:28:27 +00:00
drh
f63bc3a922 New test case for bSplitColumn in QRF.
FossilOrigin-Name: 6d01f9f49eef5f7d4bddadc458691b6ca36e277bae1d4b43b60a128a44e3faca
2025-11-23 10:55:38 +00:00
drh
58a4e08e3d In QRF in bSplitColumn mode, increase the spacing between columns to be as
wide as five, for improved legibility, if screen width allows.

FossilOrigin-Name: 673648cc812e1549c2b3e7749306e7395d0b7e396a7d5ac432948eb3a6c3713f
2025-11-23 00:45:47 +00:00
drh
d0056d4234 Use the new "split" mode to simplify and improve the implementation of
the ".tables" and ".indexes" commands in the CLI.  Fix a bug in QRF
that this new implementation found.

FossilOrigin-Name: b73df612b621699cd58de6ef327fefdeb8f52eb620f0d2df00d38ff6608a8dd5
2025-11-23 00:10:06 +00:00
drh
c4190338c5 Add "split" mode in the CLI. Fix CLI commands given on the command line
so that they honor --once in prior commands.

FossilOrigin-Name: 2530f04d1bb02b800fda83544f5b5dcd42f52b3e56ad625cd03b40e42f24ac6b
2025-11-22 23:34:53 +00:00