stephan [Mon, 3 Feb 2025 17:34:12 +0000 (17:34 +0000)]
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.
stephan [Mon, 3 Feb 2025 14:55:56 +0000 (14:55 +0000)]
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.
drh [Mon, 3 Feb 2025 14:44:16 +0000 (14:44 +0000)]
Fix the build process on Windows so that it generates identical sqlite3.c,
sqlite3.h, and shell.c files on Windows and Unix. This patch also includes
a change to JS bindings that got caught up in the branch.
stephan [Mon, 3 Feb 2025 14:04:27 +0000 (14:04 +0000)]
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].
stephan [Fri, 31 Jan 2025 11:45:55 +0000 (11:45 +0000)]
Correct a typo in tool/emcc.sh.in which could cause all of the configure-time work to locate the emcc binary to go unused. Reported in [forum:feb325cdde5b6f37|forum post feb325cdde5b6f37].
stephan [Thu, 30 Jan 2025 11:19:16 +0000 (11:19 +0000)]
Fix build regression, introduced in [d2fe6b05f38d9d] (3.48.0), in which SQLITE_OMIT and SQLITE_ENABLE flags passed to configure via CFLAGS were not propagated to the OPT_FEATURE_FLAGS list. Reported in [forum:9801e54665afd728|forum post 9801e54665afd728].
dan [Wed, 29 Jan 2025 18:53:19 +0000 (18:53 +0000)]
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.
drh [Tue, 28 Jan 2025 20:32:48 +0000 (20:32 +0000)]
Enhance the if() and iif() SQL functions so that they support any
number of arguments greater than or equal to two.
Suggested by [forum:/forumpost/40f7867f75f80|forum post 40f7867f75f80].
drh [Tue, 28 Jan 2025 01:10:45 +0000 (01:10 +0000)]
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.
drh [Tue, 28 Jan 2025 00:48:01 +0000 (00:48 +0000)]
Remove an ALWAYS() in the star-query heuristic that is sometimes false if you
have a corrupt database. dbsqlfuzz c37ba7728d79859b79c8341b59297e88fba017d3.
Test case in TH3.
drh [Sat, 25 Jan 2025 23:04:05 +0000 (23:04 +0000)]
Revise the strategy used by the star-query heuristic: Instead of decreasing
the cost of all fact-table WhereLoops, increase the run-cost of WhereLoops that
are SCANs of dimension tables.
drh [Fri, 24 Jan 2025 16:37:31 +0000 (16:37 +0000)]
Improve the star-query heuristic so that it does a better job of identifying
actual star queries. Also includes improved diagnostic output from the
query planner.
drh [Fri, 24 Jan 2025 14:51:15 +0000 (14:51 +0000)]
When looking for star-queries, do not count a table as a dimension table
if that table is separated from the fact table by an OUTER or CROSS join
or if the table is a self-join.
stephan [Fri, 24 Jan 2025 08:58:54 +0000 (08:58 +0000)]
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.
stephan [Thu, 23 Jan 2025 22:23:31 +0000 (22:23 +0000)]
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".
stephan [Thu, 23 Jan 2025 19:44:09 +0000 (19:44 +0000)]
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.
stephan [Thu, 23 Jan 2025 16:11:24 +0000 (16:11 +0000)]
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.
stephan [Thu, 23 Jan 2025 15:58:01 +0000 (15:58 +0000)]
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.
stephan [Thu, 23 Jan 2025 14:09:02 +0000 (14:09 +0000)]
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.
stephan [Wed, 22 Jan 2025 21:34:53 +0000 (21:34 +0000)]
Replace the use of the Autools in ./autoconf/ with Autosetup and extend its configure script to include many of the flags available in the canonical build.
drh [Wed, 22 Jan 2025 19:37:47 +0000 (19:37 +0000)]
Add two new sqlite3_db_config() options that enable the ATTACH command
to create new database files and to open databases read/write. Both
default to on for backwards compatibility.
drh [Wed, 22 Jan 2025 17:18:53 +0000 (17:18 +0000)]
Add the -q/--quiet option to test/speedtest.tcl. Automatically enable
-DSQLITE_OMIT_LOAD_EXTENSION and -DSQLITE_THREADSAFE=0 so that no extra
libraries are required.
drh [Tue, 21 Jan 2025 16:30:55 +0000 (16:30 +0000)]
Performance improvements to the (debug-use only) Mem.pScopyFrom logic, resulting
in about 8x faster performance under -DSQLITE_DEBUG for the query in from
[forum:/forumpost/0025389d0860af82|forum post 0025389d0860af82]. This change
only affects builds that use -DSQLITE_DEBUG.
stephan [Tue, 21 Jan 2025 15:45:03 +0000 (15:45 +0000)]
Explain the lack of docs in autoconf/Makefile.in and refer interested readers to main.mk in canonical tree. Minor cleanups and fixes in tool/mkautoconfamal.sh.
drh [Tue, 21 Jan 2025 15:12:00 +0000 (15:12 +0000)]
The FuncDev.nArg field values -3 and -4 now have special meansing of 1 or more
or 2 or more arguments, respectively. This saves space in the built-in
function table, resulting in slightly faster performance and a reduced binary
size.
stephan [Mon, 20 Jan 2025 20:48:18 +0000 (20:48 +0000)]
configure script: work around msys's inability to 'exec' a '.sh' file by prefixing the call with an explicit 'sh', as reported in [forum:befb352a42a7cd6d|forum post befb352a42a7cd6d].
dan [Mon, 20 Jan 2025 18:26:58 +0000 (18:26 +0000)]
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.
stephan [Mon, 20 Jan 2025 16:14:09 +0000 (16:14 +0000)]
configure script: remove an overzealous is-a-file check in the tclsh search which fails to account for implicit .exe extensions on Windows builds. Reported in [forum:c27403ef974df9f1|forum post c27403ef974df9f1]. (Same change as [89306d1a4905] but to a different file, as that content was moved since the 3.48 release.)
stephan [Sun, 19 Jan 2025 14:53:45 +0000 (14:53 +0000)]
Move some of the auto.def functions into autosetup/sqlite-config.tcl for re-use in the pending migration of the autoconf bundle to autosetup. This is just reorg, no functional changes.