1
0
mirror of https://github.com/sqlite/sqlite.git synced 2026-10-23 21:49:02 +03:00
Commit Graph

1199 Commits

Author SHA1 Message Date
stephan
0caf6b532d SAHPool VFS tweaks contributed off-list by Jure Rotar: hardening against malicious inputs and I/O errors. Truncate to the shorter length when overwriting a db file with a shorter one via importDb(). Correct xOpen() to honor the combination of CREATE/EXCLUSIVE flags.
FossilOrigin-Name: 7af745868b873daacdbb57621201887f80782cef4e10ef24243a15ae88897f0d
2026-10-01 08:13:58 +00:00
stephan
58fddadb23 Remove an extraneous nearly-full-file level of indentation in ext/wasm/tester1.c-pp.js.
FossilOrigin-Name: b838769b4b115518feba1ea1f6a39f49427870cae824ec7225627565ab91de3e
2026-09-30 20:59:50 +00:00
stephan
ca9a8adfa4 Add tests demonstrating kvvfs locking errors across multiple connections to the same storage. Add sqlite3.oo1.Stmt.resetNoThrow() for reasons described in its API docs.
FossilOrigin-Name: 0fed9bcbe2c33d8db5b3500b506bcdfa6a2c718a65bfef4f1d2d21951f6341a8
2026-09-30 19:26:14 +00:00
stephan
c15f5adadb Rework the JS kvvfs xLock(), xUnlock(), xCheckReserved(), and xSleep() analog to the recent opfs-sahpool changes to make it more robust when a given kvvfs store is accessed via multiple handles (all necessarily from the same thread). This does not break anything but also does not prove anything - tests are pending.
FossilOrigin-Name: d0e27fa55b05832dc2ad52d5bdb56e74dae2d95984e0f8f8d1831015c5fcd781
2026-09-30 18:40:09 +00:00
stephan
519e4c23a5 [fa44643f65d6] inadvertently removed its circular-cleanup protection by fixing the finalizer ordering. This check-in fixes that. Spotted in [forum:ba4cb328a7|forum post 2026-09-30T14:59:13Z].
FossilOrigin-Name: 771faec269d786f01fc8d9155fd546d09ea6ca2eba0f0c97e34e795f64719454
2026-09-30 15:46:02 +00:00
stephan
cdbfe6a938 Do not inherit the OPFS SAHPool's xSleep method from the default VFS, as doing so can cause the thread to freeze. This VFS only deals with contention originating in the same thread, so xSleep() needs to be a no-op. Addresses [forum:3f0794c5d8|bug report 2026-09-30T12:52:54Z].
FossilOrigin-Name: c9dd4d88e44a9eae4ea11d0ce5491c7ac2ac2d60a3bc83ed485812234be374da
2026-09-30 13:23:56 +00:00
stephan
f4786666d9 JS: when disposing of a C struct instance, do not unmap the 'pointer' property interceptor until after all client-added finalizers have been called.
FossilOrigin-Name: fa44643f65d6815c8c21ec25e7aa6e39a00fdc818d1d058e03123042e45884e1
2026-09-30 13:18:14 +00:00
stephan
3b28aa1ce7 Fix the OPFS SAHPool VFS's xLock/xUnlock to properly deal with multiple handles to the same underlying file within the same JS thread. Addresses [forum:5e66a600ba6e57de|bug report 2026-09-30T10:49:15Z]. Also (unrelated but code-adjacent) make sure that the VFS releases all of its internal mappings when it's paused.
FossilOrigin-Name: 9e2caaa382cee5d5df26ad3af7d727ab3f68a912e39655ffcc52f592d5a08a8d
2026-09-30 11:48:29 +00:00
stephan
737c12a04c Minor JS doc correction.
FossilOrigin-Name: 6b470917b2c9ab25d1e7fed56f19f37b5c2fc3f2a3d504a752a7bb2db14a3ee6
2026-09-30 10:36:27 +00:00
stephan
9fd5a0bc55 Correct the xCheckReserveLock() impl of the OPFS SAHPool VFS to fix a corruption case involving multiple handles in the same JS thread to the same filename when one leaves a journal behind. Addresses [forum:b2fbb61642|bug report 2026-09-29T18:25:28Z].
FossilOrigin-Name: 9168a6f1bedba87117169d096f9a6fcadaac65249d707193e4bcbc25e59ccb54
2026-09-30 09:53:09 +00:00
stephan
226a2c0d6a Generic internal JS cleanups. No functional changes. Update the preprocessor for the ability to use C-style comments in directive arguments.
FossilOrigin-Name: b2699eb9676e6f5459b8279661c264ba2c803ae133f85c703984deb7afa4fe60
2026-09-30 09:17:12 +00:00
stephan
ad1bbfc2bd OPFS SAHPool: more cleanly handle an init failure. Add an init option which tells it not to wipe the storage if initialization fails. Based on the discussion and patch in [forum:5664cd4baee50236|forum post 5664cd4b]. Minor doc updates in unrelated code.
FossilOrigin-Name: 0560c3cc20f60caee42492e4d2063aed8d8d44b0a544a8c3aae56ee67da2e4a7
2026-09-29 08:31:55 +00:00
stephan
998173efcd Update some long-dormant JS test code for refactoring-/renaming breakage induced since it was last used. Remove a separate long-dormant JS demo which cannot work with the current code.
FossilOrigin-Name: fc4e246dc26f3e3872dde42ceefcea70ba4158a92ba94361656b2ca0f4e3ef92
2026-09-26 06:23:08 +00:00
stephan
a8d1f1ff12 Fix a small potential buffer overwrite in the JS impl of kvvfs to resolve [bugs:8d4fe4cc4c|bug report 2026-09-23T10:50:46Z]. Remove some adjacent dead code.
FossilOrigin-Name: c43287d8855b3f9a4621545793ecb2a89ef456d563d8377f2b243812e6acb2b3
2026-09-23 14:00:07 +00:00
stephan
6ceffc33fe Preprocessor: remove more not-relevant-to-this-copy pieces and add support for C-style comments in directive arguments.
FossilOrigin-Name: 5c321483e07c09271e5a59209cdb7c6748e6525c351c5e7aeeb259eba4ea3e70
2026-09-23 10:06:30 +00:00
stephan
fde3a84ddd Latest preprocessor for various cleanups and fixes. Duplicate the tester1 concurrency warning in the worker-based copy.
FossilOrigin-Name: c9b4695ffae5a3388a49643d6819355851a0fda362cdaf140c59fc934759dcac
2026-09-21 20:18:51 +00:00
stephan
c908175cbe Add new test cases for the sqlite3.oo1.Stmt.get() overloads which take both a client-specified type ID and an array or object target.
FossilOrigin-Name: 24bddf2aff01962a35c42422e322c12582ea77e2c7ddd5f8754d12c454ce8a1d
2026-09-21 07:29:41 +00:00
stephan
ae9c436852 User new, more compare JS syntax in a couple of places. No functional changes.
FossilOrigin-Name: 0d747adadf56a0aa3bd5666954a9f7c75c394254dbb938f28ddcd987ffff01b2
2026-09-19 08:13:27 +00:00
stephan
46c7da50b3 Minor internal API doc update.
FossilOrigin-Name: 346c56e02c39858b4364e4c8b8e4c88237e64470066ebb2687ae06d2b0e978b8
2026-09-18 08:00:34 +00:00
stephan
d457639847 Performance improvements in some of the JS sqlite3.oo1 APIs, based on analysis and suggestions from Jure Rotar.
FossilOrigin-Name: 8c6c586c3e42dd1d0af4f374b01a660bfc6afb47fd3b34cd7ef16c198ec66d0a
2026-09-18 07:56:22 +00:00
stephan
5a04cfc091 Add a note to ext/wasm/tester1 about running tests in concurrent tabs.
FossilOrigin-Name: 8ce64bed3bac4038b2fd96758d4bd92cb26ac515ec50cbfc94ef296e5c6fe558
2026-09-18 07:55:02 +00:00
stephan
6f5c0659c2 Typo fix in JS test code.
FossilOrigin-Name: 4630ee80dcb69588ec1c88d049e313b53258e7e23fc0209ac505c92b3bc85c63
2026-09-16 08:31:09 +00:00
stephan
4ebc78674d Add a JavaScript switch/case break which does not actually change any behavior but has the potential to (A) confuse someone into thinking it's broken or (B) become broken via future code changes. Spotted in [https://github.com/sqlite/sqlite/pull/37|a PR in the sqlite github repository].
FossilOrigin-Name: a6351d0413572cf92f9d5eaf01e8777001646961cc77dd5823ca26f7a84a60f3
2026-09-15 18:11:22 +00:00
stephan
912706d94a Latest upstream libcmpp.c for #eval and #include -resolve, and removal of the clumsy @'string' literals.
FossilOrigin-Name: dc176e433555fc818fb20218d846f06477305e6524dc1d73f175de9efccb3428
2026-08-20 11:50:33 +00:00
stephan
cde725f23c Remove some stray debug output and obsolete bug-hunting comments. No functional changes.
FossilOrigin-Name: 41443d5ffe1f6852f447181071a0d9dac89df51c836d16b1bd9420a8513d2ec2
2026-08-10 12:45:11 +00:00
stephan
e9930003c1 Expose the sqlite3_backup APIs to JavaScript.
FossilOrigin-Name: fa17d89f76d50c153b6ff7ca96ae06c1ddc130abc3c0056dac3ef6d66f4f40c5
2026-08-10 12:41:17 +00:00
stephan
3d0687bade Disable Module.instantiateWasm() in node builds to match branch-3.53's behavior. Fix a sqlite3_backup test (duplicate finalize). The aforementioned world-breaking bug was caused by my browser having gotten into a funky state and needing a restart.
FossilOrigin-Name: 7d77bb088641881fca7a625d9828503d269d0ca1e245583a2dcf24a4f09390f5
2026-08-10 12:35:49 +00:00
stephan
961cc1ec09 Add tests for the sqlite3_backup JS bindings but they are disabled while tracking down an unrelated problem which prevents those tests from working (most of the sqlite3.capi methods are being mis-mapped to the sqlite3InitModule function for reasons unimaginable).
FossilOrigin-Name: cb610a8a87cfd29d70ab6b825b4a43d44fd801feecfda1bf4fb7ae181806d84b
2026-08-10 12:18:07 +00:00
stephan
6e93c8c5f1 Fix a circular dep generated by mkwasmbuilds.c
FossilOrigin-Name: f2514ace13c3bcc2ae1d39546fb095676c3540ec8fff6f3f194339660151fc77
2026-08-10 11:51:20 +00:00
stephan
46441db7e8 Merge trunk into the js-backup-bindings branch.
FossilOrigin-Name: 692c4e8ad81f142a454c2038fcdc83317dbaeb71dd6d0497edb4621297c2e35c
2026-08-10 11:23:29 +00:00
stephan
d0afe9c60b Lower the range of inputs accepted by the pstack allocator to address [bugs:4dbd096fe335f974dbd096fe3|/bugs/4dbd096fe335].
FossilOrigin-Name: fafefb59481530255a881f22b1f75b587731867d00eabea39eaec7da2199fdff
2026-08-07 05:31:08 +00:00
stephan
7dc844581a Strip out 42kb of ext/wasm/libcmpp.c (build tool) by using a destilled build shorn of the capabilities we don't use in this tree, like #pipe and loadable modules.
FossilOrigin-Name: 3ec42b829e8de23f8d050b49b48eac1220463156eb973fd4daff440e6183c868
2026-08-05 15:00:54 +00:00
stephan
648be9e67f Update ext/wasm/libcmpp.c for build portability improvements and doc updates.
FossilOrigin-Name: 48fdf51b53e9314f938fb0107ba04f6051d6c47b743c47e30c18a1be0da4015c
2026-07-30 12:17:33 +00:00
stephan
77ef17960c Add long-missing sqlite3_backup bindings to JS/WASM, in response to [forum:dc96ed27b3fdb202|forum thread dc96ed27b3]. This does not yet include tests.
FossilOrigin-Name: 90e599757416059044c643121631fc56eab2b6eea76d04b2d99eae49b8adef44
2026-07-29 12:51:52 +00:00
stephan
53d99267bb Add a JS test for [d5d8ee76d3] resp. [012550c089].
FossilOrigin-Name: f28494eeafc37320932a932044ecd66b6900632a1eccd45a9f8bed653cee3466
2026-07-26 16:05:47 +00:00
stephan
76a15f2b95 Factor an extranous local var out of the previous check-in.
FossilOrigin-Name: 422b4303dae214e23a53b181e5cdf7888d159da33e1675fd8317cbe66834b78e
2026-07-26 15:56:06 +00:00
stephan
bdde38eb0c Remove some extraneous I/O in kvvfs. Reported off-list by Jure Rotar.
FossilOrigin-Name: ce09bfe406728312761a9f227b3f82cbee7cc176dddac1a499e10480a7ee2c1c
2026-07-26 15:47:56 +00:00
stephan
fdb802581c Fix a JS container API misuse in sqlite3.oo1.DB.close() which caused its fallback cleanup of still-open statements to not actually do so. Reported off-list by Jure Rotar.
FossilOrigin-Name: d5d8ee76d337820f765cea7b279f2e5644a24d4f0e76d53b35b4d52277edb767
2026-07-26 15:39:18 +00:00
stephan
70c687859e Fix an error handling case in #base64.
FossilOrigin-Name: f8c408f66257881937ed18b77e274f71dba2d97dd44546372fa0b0a9629efbd2
2026-07-22 14:16:33 +00:00
stephan
7d1796e488 Add (#base64 -f filename) support to the preprocessor and slightly simplify the wasm embedding with it. Fix a bug in the preprocessor's @token@ call expansion when the length of the configured @ is greater than 1 byte.
FossilOrigin-Name: 1e90bedec99054f4856bfb89efc4d676486504db67bd1304c45d14c638ddfc7e
2026-07-22 14:06:41 +00:00
stephan
6ad0fcac94 Random makefile doc updates. No functional changes.
FossilOrigin-Name: 014ef252c7ea404340a5af52a6615cdddd969a4dbf30712fda538550240bb9fc
2026-07-21 20:56:55 +00:00
stephan
04ba5ef30b Random minor doc and formatting cleanups in the wasm makefile generator.
FossilOrigin-Name: a24064919bcc187d5a4d9fa67cb1810fc4e7b9c92596fd2c8e6b0a66bc37e4b3
2026-07-21 20:18:16 +00:00
stephan
adf52c4401 Restructure an errant goto which only accidentally never broke anything. Add some debug output to mkwasmbuilds.c.
FossilOrigin-Name: 0ca4e748e1682046f2e060876bcf7e8d249aa5611d939d32dc1365d3bcf12b48
2026-07-21 19:12:38 +00:00
stephan
add85ddbb3 Document the origin of the input size limit for #base64. No functional changes.
FossilOrigin-Name: 696988aac30797139060eb2718fcfda0363f1fa73df1187ea56956681d577411
2026-07-21 16:43:36 +00:00
stephan
6f1c5685db Simplify the previous checkin by removing an extraneous local var.
FossilOrigin-Name: 6382d8336e2891c556456a340daecff81766980a27071e1d5bda6262ffba6f26
2026-07-21 16:29:34 +00:00
stephan
5b04866b72 Fix the corner case of feeding #base64 empty input.
FossilOrigin-Name: 999d20197143d884158341ac36e33bc1eb8e3484228eaf532818add927c30228
2026-07-21 16:23:21 +00:00
stephan
093ca6b1af Consolidate a duplicated code block and ensure that the new filtering of the final JS files makes them read/write so that rebuilds without a clean between them work.
FossilOrigin-Name: 8b013184e42dbd7cd47c07bbb1edbb1f088dfb4efe540bfbc52a2e3c472c7b2d
2026-07-21 16:12:06 +00:00
stephan
1f2bc0ea64 Add support for (make base64.wasm=1), which embeds sqlite3.wasm into its corresponding JS file as base64. A very expensive calculator which was fed the resulting file sizes assures me that the two-file approach is, in the aggregate, more efficient both in terms of overall network bandwidth (+~20% bigger for base64) and client-side memory usage (streaming vs non-streaming wasm compilation), so we'll shelve this as an interesting experiment or maybe for use by custom builds.
FossilOrigin-Name: a167aee75198ff08b20b448fecd3267ed4a70af2472c02605318a5613f446fc6
2026-07-21 16:04:10 +00:00
stephan
bee0db8c60 This embeds sqlite3.wasm into sqlite3.js/mjs as base64 but is applied globally - it still needs to be made configurable.
FossilOrigin-Name: 0467a0f826b5b7bb65d9c74df80c7443f01824c1cc8184417849a74791f491b7
2026-07-21 13:28:52 +00:00
stephan
379e111bff An initial attempt at embedding sqlite3.wasm into sqlite3.js using base64. This produces a chicken-egg situation in the build because the input file where the blob belongs is injested by emscripten (which generates the wasm file from which that blob is to be generated), so it does not work as-is but is being set aside for later. We'll need to add a second preprocessing step which uses a different #directive delimiter to keep it hidden inside the first pass, then squeeze the wasm file in through there.
FossilOrigin-Name: 538199cf62f07a2fe7ee5775c9f01aff1644d638bc0916cf631d61376462b5cb
2026-07-21 12:57:48 +00:00