1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-05-01 08:24:53 +03:00

5088 Commits

Author SHA1 Message Date
stephan
f858182689 JS: add a mechanism to the Worker1 exec API to fetch the last_insert_rowid(), as requested in [forum:56bc35390183f5d5|forum post 56bc353901].
FossilOrigin-Name: c22c48360756b1c7e2f5a9c01aff799bc188e100d364931de0dc3686e5de57a9
2025-02-09 02:41:35 +00:00
stephan
d8452a9517 Reorder a piece of ext/wasm/GNUmakefile to correct the timing of various var accesses. Fixes a problem [https://github.com/sqlite/sqlite-wasm/pull/99|reported in the downstream npm subproject] and explains the confusion in [4aa025a943a4024094b9] (which has been reverted).
FossilOrigin-Name: 65798c09a00662a3598f01571d6f3a2dc750c3d0b127c344590539244afe4aa7
2025-02-07 12:33:48 +00:00
stephan
3c013479c3 Fix a dependencies/order-of-operations bug in ext/wasm/GNUmakefile which causes creation of files filtered via c-pp to fail if the ext/wasm/jswasm dir did not exist beforehand.
FossilOrigin-Name: 4bac76138853a89484d3ac0486a9ed5143aa671b13b4b3abb704c1487213b388
2025-02-06 13:18:49 +00:00
drh
31c3599ed0 Fix a harmless unused-parameter compiler warning introduced by [75f3d8744879].
FossilOrigin-Name: 9f28f6694f97d5ee0345b45f9bf81e3fdce0990ce32fb9bdbbaac079126a67c9
2025-02-05 16:08:11 +00:00
drh
e85b2cac0f Test case for the FTS3 fix in the previous check-in.
FossilOrigin-Name: 459d8f695ef868d0ec09920ab2035eebd36a66051f9905e2605f4600623faa47
2025-02-03 23:27:27 +00:00
drh
51dd67080a Fix a potential UAF in FTS3.
FossilOrigin-Name: 75f3d87448793fc7fd68d817874d561842e029a2d6c1ea4abcec39764cd38469
2025-02-03 23:19:42 +00:00
drh
c2b446f16a Fix for a potential UAF in FTS5.
FossilOrigin-Name: e33f2fedda17b4f3678fc23c438093c256b0c125da5f1ac42ecaf3d604d54b6a
2025-02-03 18:05:54 +00:00
stephan
6e5802fc74 Improve the JS-side sqlite3_set_auxdata() test to also trigger the case that the aux data actually gets reused. Test changes only, no library code.
FossilOrigin-Name: 9f27379d860518e6e097a2c999da04176812260a61bf11fe495c3efd76971806
2025-02-03 18:01:42 +00:00
dan
9e639d2490 Fix a use-after-free case in fts5 provoked by fuzzdata8.db. Tcl test case pending.
FossilOrigin-Name: a4962df665084e423e020be9a2834b6886a8e3feb461cff5358b61398a2a20d2
2025-02-03 17:54:55 +00:00
stephan
3cd34ab981 Rework [76c8435a] to eliminate automatic JS-to-WASM function conversions of sqlite3_set_auxdata() destructors because it can leads to leaks on every call of a UDF. This feature never worked before [76c8435a] but fixing it was ill-conceived because of the memory leakage it introduces. WASM function pointers can still be used as destructors in this context.
FossilOrigin-Name: 3fb993af0caf041da934cea29c039b27c468be0b75bce1537a6425767cf9bf8d
2025-02-03 17:34:12 +00:00
stephan
c97abeac0b Add a test app to assist in validating the SAHPool digest calculation fix.
FossilOrigin-Name: a1e304b8020025cc73a658bd8c7697d59b4f3ad96cac0a3e36553a3207d13dc6
2025-02-03 17:21:54 +00:00
stephan
40ce00b546 Initial work on a fix for the SAHPool VFS's effectively-no-op digest calculation, as reported in [https://github.com/sqlite/sqlite-wasm/issues/97|ticket #97 of the downstream npm subproject]. This requires more testing alongside databases created before this version to ensure that it's backwards-compatible.
FossilOrigin-Name: 9234c33f92d92bfddc6211c9c587f1072e70837c0ffe1416ef7d84d59bacd364
2025-02-03 16:26:30 +00:00
stephan
d98689f4d3 Add a more complete test for [76c8435a] and add some commentary about (A) the inability to automatically clean up automatically-generated WASM proxy functions for sqlite3_set_auxdata() destructors and (B) how to deal with (A) to avoid leaking WASM proxy functions.
FossilOrigin-Name: d693c2dddbd10a2e0b77893b04b11502e30b768f1b06814105f7f35172845fb9
2025-02-03 14:55:56 +00:00
stephan
d256b56880 Correct the FuncPtrAdapter signature for the JS binding of sqlite3_set_auxdata(). Reported in [https://github.com/sqlite/sqlite-wasm/issues/92|the npm subproject, ticket #92].
FossilOrigin-Name: 76c8435a5f390001038b8ee94322ff478c9d5f29501ed1c5891c952a41e377aa
2025-02-03 14:04:27 +00:00
stephan
14613b1b1d URL typo fix in code comments. No code changes.
FossilOrigin-Name: 002a123094e4ef14eb5ec28033adca6083ba2717e1eaa23e80595e37a947e6c2
2025-02-02 12:15:25 +00:00
drh
c49bfdbbee Add a missing "db2 close" to the ext/session/session_gen.test test module.
FossilOrigin-Name: 4068f586ddadd3a818645574f7584fcee6d373dbf45805c545100883b495598a
2025-02-01 23:49:01 +00:00
stephan
fdc17e0bc8 JS doc typo fixes. No functional changes.
FossilOrigin-Name: e0d9c74c1cdddb2321131255b94f9cda6530be3f2a06aed4abb54dcda092481e
2025-02-01 09:44:48 +00:00
stephan
82f3052e61 Expose the new SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE/WRITE and SQLITE_DBCONFIG_ENABLE_COMMENTS (from [325e547a21955]) to JS/WASM.
FossilOrigin-Name: 8da1a9af66f905c683e9c3445d609b5c0e11ac912be192c468ddd79f237837f4
2025-01-31 18:45:03 +00:00
stephan
cee7609074 Minor cleanups in the opfs-sahpool pause/unpause API demo.
FossilOrigin-Name: e205cdc468e02eefdeb8d391d921aa2d4d28a8b7b87036d6d937a9928261a413
2025-01-31 17:47:47 +00:00
stephan
a75321d735 Add the conventional license header to sahpool-worker.js and correct the date on the header in sahpool-pausing.js.
FossilOrigin-Name: f7c3026b0d2e33cc4e3b906810d860b155b1ff714bbe4e1eb9ee392122217efa
2025-01-31 16:34:52 +00:00
stephan
cb0da053ed Add a small test app demonstrating cooperative semi-concurrency of the opfs-sahpool VFS using its un/pauseVfs() APIs.
FossilOrigin-Name: 09570c55a23e5af76dd2153a5b28a493f498d7d4a08b0089f3074d0a2c5d3d29
2025-01-31 16:25:18 +00:00
stephan
654c94d683 Cleanups in the opfs-sahpool VFS pause/unpause feature and its tests.
FossilOrigin-Name: 184ba37702f63196deca91d273e798ca895fbb301938e6264bc82815a4e33149
2025-01-31 14:25:38 +00:00
stephan
d4bfa3465e Merge trunk into opfs-sahpool-pause branch.
FossilOrigin-Name: 775a547eca2b0b3dbb6c03990236128a095cc34d28caec44b9a5072510c75b63
2025-01-31 12:39:07 +00:00
stephan
efbf481541 Minor wasm-specific doc touchups.
FossilOrigin-Name: 56b618da9073db8b8d5dafa177a3c9e4c4d927bf512e14b0e6d23937f91ce4cf
2025-01-31 12:30:37 +00:00
dan
4f8f1965f7 Fix bug in sessions handling of FK constraints introduced by [e09a0c02] (released in 3.48.0). Bug was preventing a changeset containing FK violations from being applied even when the xConflict(CHANGESET_FOREIGN_KEY) returned OMIT.
FossilOrigin-Name: d7c07581203a0a88456588e49e51b40a8341b0e7121809f75be0ee882d91650f
2025-01-29 18:53:19 +00:00
stephan
cb46f1bb95 Simplify how OpfsSAHPoolUtil.unpauseVfs()'s returned promise is handled.
FossilOrigin-Name: d651b8da5a84cd54d71f15bd34e4db685674ef73f26f5cc26b7af5321a2ec05e
2025-01-29 11:28:18 +00:00
stephan
8883deb30e Add experimental support to pause/unpause an SAHPool OPFS VFS, as discussed in [forum:fe8cdb8431c32455|forum post fe8cdb8431c32455], the intent being enable a page to relinquish, perhaps temporarily, the VFS such that the VFS's storage can be accessed by another page/tab.
FossilOrigin-Name: 1d2683fe9e4be01c3137e750900f54d287e7d96185e66924d24b50f4647e7ef1
2025-01-29 11:08:11 +00:00
dan
9dcf3d08c9 Fix sessions module handling of tables with generated columns.
FossilOrigin-Name: 437fb316389bc3c24c5cdb4d01edfc81e2c2e9f2b399fc2a95b05d279361d8ec
2025-01-28 19:03:37 +00:00
drh
0424f255ef Fix a copy/paste typo in the output of vfstrace for xDlClose().
FossilOrigin-Name: 1d57b57c85bb8cb9b8a1808b771bb91eeb8150efd14f9064a390e533e715bab7
2025-01-28 18:03:22 +00:00
drh
50637ca5c5 Apparently I got the logic of [abfe488ed67e2e35] confused, even backwards.
Change it so that the SQLITE_USE_W32_FOR_CONSOLE_IO macro causes Win32 APIs
to be used for console I/O and for stdio to be used otherwise.  This is
reported to be necessary for builds that use a C-language runtime other than
the one provided by Microsoft.  This changes if for Windows only.  It is a
bug fix, though we don't have a test case that will demonstrate a malfunction.

FossilOrigin-Name: 925e97e6f4238f02259a0c95b1fc668ae32a95329242f8eeae236ef207aca112
2025-01-28 01:10:45 +00:00
drh
e097db7210 Make two private routines in FTS "static" so that they are not callable from
outside of SQLite itself.

FossilOrigin-Name: 9b11bed0448b95319206b413c35f23bb80f3f4c0a4394d40f2e64066400a01ed
2025-01-26 23:34:49 +00:00
stephan
8bfb186728 Replace a handful of hard tabs in string literals with \t in mkwasmbuilds.c.
FossilOrigin-Name: e8e4d497a7b6aae450cb93927c7583fcce3fe971cd3691f9d9cad605de3cfb1f
2025-01-24 12:54:59 +00:00
stephan
4331e6bd1d Minor additions to ext/wasm/README.md.
FossilOrigin-Name: 85747ea1654c74d330614aa174ede4a989b6456eb1fc5eb0fc9f2d1418b6ef99
2025-01-24 09:21:39 +00:00
stephan
dfb5f32758 Update ext/wasm/README.md to reflect simplifications permitted by the current configure script behavior.
FossilOrigin-Name: 9abb56c6acb1c84c2df8534ca3ebb2894afd68bc7b8331d4d12611896c576749
2025-01-24 09:18:19 +00:00
stephan
c70631623c Remove extraneous are-we-making-clean guards from the generated wasm build rules, as that guard is set at a higher level. Rename a makefile call()able for consistency.
FossilOrigin-Name: 7f9074e2a7ff62bdcf343895e80a51224de62a22afbbf82068ec5fea7eeda0bb
2025-01-24 08:58:54 +00:00
stephan
07a2e5d1ed wasm: de-list demo-worker1-promiser-esm.html from the test pages because (per Chrome 131) "Module scripts don't support importScripts()", where "don't" means "they used to but no longer do".
FossilOrigin-Name: 4aa025a943a4024094b91f13abfb8945bbbb8334e3ec904dee5315852845bfe1
2025-01-23 22:23:31 +00:00
stephan
02e81f72a0 When running wasm-opt, ignore any failure because it will fail for unknown flags and the set of legal flags will change from version to version. Document the size-reduction effect (or non-effect) of a dozen-odd wasm-opt flags and retain those which demonstrate a wasm file size reduction in -Oz builds (our production build mode). Total size savings: roughly 13kb.
FossilOrigin-Name: c9dc581e0287e3462ac55f80ca76e7e98d31157022052c892517363c45287a7b
2025-01-23 19:44:09 +00:00
stephan
726a047a47 Remove some now-dead makefile code, rename a var for consistency, and fix a recipe bug introduced in the previous checkin in the bundler-friendly build.
FossilOrigin-Name: 0acd4ef3addb311476f4a670be0c4c4a0f3f88b0420886d4c1c3c3027dd51d73
2025-01-23 16:11:24 +00:00
stephan
efafde5eb4 Initial support for post-processing wasm files with wasm-opt (if it's available). This currently shaves 12kb off of the release-mode build of sqlite3.wasm but there are many dozens of wasm-opt flags left to try.
FossilOrigin-Name: 5d16e3f28364de2d6b6456a6fc56bf604b9106c3ae15719f2862192ae3020cc1
2025-01-23 15:58:01 +00:00
stephan
72543206e5 Move small parts of ext/wasm/GNUmakefile into ext/wasm/config.make.in and have the configure script populate that, rather than dynamically determining those values on each 'make' invocation. Add a configure-time check for the optional wasm-opt binary in prep for pending experimentation with using it to reduce the wasm file sizes.
FossilOrigin-Name: 0a426a549577b883e2de7cd0605041cc97b57f53ee6657bc318b0bfde7b62677
2025-01-23 14:09:02 +00:00
stephan
c9bf7ed9ad Remove unnecessary --minify 0 emcc flag from the wasm build, as -g3 implies that capability along with other anti-minification features we rely on.
FossilOrigin-Name: 10c91f9cd074e8d35af1c7f8251ac18e5dd91fa14df3fe4e1fb44441c4f08c7a
2025-01-23 11:21:29 +00:00
dan
b80d01a182 Have fts5 better handle OOM errors from sqlite3_blob_close().
FossilOrigin-Name: f418350f3f83147bc5817a885be6e39ff9ff5722742a88d17600729c53c65010
2025-01-21 14:34:59 +00:00
dan
467e20ad1d Fix an assert() that could fail if a virtual table called sqlite3_step() from within the xSync() method while committing a "PRAGMA defer_foreign_keys=1" transaction.
FossilOrigin-Name: 39bdbb3f6dd1d30d180526d35c11f789f5e9d45b99ead72fd4a3b136afab66b1
2025-01-20 18:26:58 +00:00
drh
d0c6c6586e Fix a potential one-byte buffer overrun when reading from the Windows
console in the CLI. [forum:/forumpost/95e17b8f5c|Forum post 95e17b8f5c].

FossilOrigin-Name: 4d96759694c91301410f53a3f737a049c33e8b259b0954ff659714aff8b21ae8
2025-01-17 10:39:04 +00:00
stephan
ec50c5a2a4 wasm: after generating the .js/.mjs file, strip out all of the generated pieces which create Emscripten call() bindings for the sqlite3 APIs, as we don't use those binding, so both the setup time and the memory they use installing WASM proxy bindings is wasted. This eliminates some 200 superfluous/unused bindings from the init process.
FossilOrigin-Name: 020d2c7528be6f11a5b2b849d7b2f04e47abe2b0842520ff60eb7defb3768e1c
2025-01-16 13:10:06 +00:00
stephan
3202b11f66 Replace use of Emscripten's Module.postRun() with a custom callback so that we get consistent library init timing with both Emscripten 3.1.x and 4.0.x. Details and discussion are in [https://github.com/emscripten-core/emscripten/issues/23420|Emscripten ticket #23420].
FossilOrigin-Name: 4863a70ac61ff6f868429f16f0141484ea98f973fde1a9aff879252d0f1dbb6b
2025-01-16 09:27:40 +00:00
stephan
3ba9adc5c1 Teach tool/stripccomments.c that a backslash immediately preceeding a forward slash means that that forward slash cannot be the start of a comment. This is intended to allow JavaScript regular expressions containing \/* (like [https://github.com/emscripten-core/emscripten/issues/23412|the one introduced in emsdk 4.0.0]) to pass through properly. Re-enable comment-stripping in the JS dist builds.
FossilOrigin-Name: db21d6cc9d1c425deffc0e4e92173caf586e6ac66110c71a4930b21e3e7f84b9
2025-01-15 21:09:19 +00:00
stephan
c738052394 Work around [https://github.com/emscripten-core/emscripten/issues/23420|a behavior change in emsdk 4.0.0] which breaks the load/init timing of the wasm module.
FossilOrigin-Name: 00a750184bcf1a94bf4e7f1d5029a42671e87e2997ae97be07bd900d3702883d
2025-01-15 20:53:14 +00:00
stephan
73d9eb1bb3 Fix a typo in a wasm makefile var name, noting that this doesn't actually fix anything because the var in question is not used when building 'clean' or 'distclean'.
FossilOrigin-Name: 7cfc75a625095e41c3e952d4a209fdbb344df0d3dd9b0103e9e6a986dfe53c89
2025-01-15 15:27:02 +00:00
stephan
4ea86ac0e3 Disable the C-style comment stripper in the JS dist build, as explained in [forum:529c20d344|forum post 529c20d344].
FossilOrigin-Name: a9475e7614f8e44252abf273d0e0522c247df12624e40108ce98ad4aaf320f2d
2025-01-15 14:28:56 +00:00