stephan [Fri, 11 Jul 2025 19:52:36 +0000 (19:52 +0000)]
wasm: introduce the sqlite3.oo1.DB.wrapHandle() and Stmt.wrapHandle() APIs, which enable clients to wrap (sqlite3*) resp. (sqlite3_stmt*) pointers in their oo1 API counterparts, optionally with or without taking over ownership of the pointer.
stephan [Fri, 11 Jul 2025 11:06:25 +0000 (11:06 +0000)]
speedtest1: in WASM builds, disable the "app" test set by default because that one set is triggering file-not-found errors for the db file for reasons not yet understood.
stephan [Fri, 11 Jul 2025 10:27:06 +0000 (10:27 +0000)]
Do not export the numerous Emscripten HEAPxy symbols and remove the last remaining JS code which references them. They have long-since been replaced by internal equivalents and a specific feature check on one of them (which is also no longer needed) is triggering an exception from Emscripten. More details are in [https://github.com/emscripten-core/emscripten/issues/24656 | Emscripten ticket #24656], noting that this is not an Emscripten bug but an Emscripten behavior change brought it to light.
Add the estkey column to the jobs table of testrunner.db. The plan is to
use this to collect measurements that will help generate improved ETAs for
a test run.
stephan [Wed, 9 Jul 2025 13:43:53 +0000 (13:43 +0000)]
wasm: DB.wrapHandle() no longer accepts a DB object as its first argument, as there's no apparent use case for proxying one DB object with another. Doc improvements for the new code.
stephan [Wed, 9 Jul 2025 13:13:01 +0000 (13:13 +0000)]
wasm: add a few tests demonstrating that oo1.Stmt.paramaterCount's new impl does not change visible behaviors. Add the c-pp-filtered files to 'make clean'.
Adjustments to test/incrblob4.test so that it works on both Linux and Mac
in spite of error message differences between those platforms. Minor change
to termIsEquivalent() to provide 100% MC/DC.
New optimizations to detect early when queries return no rows due to
tables being empty. This includes the EXISTS-to-JOIN optimization that
tries to transform EXISTS constraints into additional terms of the FROM
clause.
dan [Tue, 8 Jul 2025 14:54:20 +0000 (14:54 +0000)]
If SQLITE_DEBUG is defined, fts5 does extra checks as part of integrity-check. Ensure that errors from these extra checks are only reported if the other, normal, tests all pass. This fixes a test case in fts5corrupt3.test that was failing if SQLITE_DEBUG was defined.
Rework the fix to the problem described by
[forum:/forumpost/b9647a113b465950|forum post b9647a113b] so that it
provides a more complete fix that covers cases that were not resolved by
the original fix, and so that it does not cause performance regressions.
Simplifications to the row-value IN operator logic. Do not let the query
planner accept a WhereLoop for a row-value IN operator that uses the same
index column more than once.
stephan [Mon, 7 Jul 2025 12:11:26 +0000 (12:11 +0000)]
Work around the Emscripten 4.10 regression described in [https://github.com/emscripten-core/emscripten/issues/24656 | Emscripten ticket #24656]. Problem reported off-list by BrickViking.
Back out the fix at [ba7d5bad32ad6aac] because it does not always work and because
it causes a performance regression. Add new test cases for row-value lookups of
indexes that contain redundant columns, three of which are currently failing. This
branch is seeking an improved solution to the redundant index column problem for
row-value lookups.
stephan [Sun, 6 Jul 2025 15:01:44 +0000 (15:01 +0000)]
Experimentally add sqlite3.oo1.DB/Stmt.wrapHandle(), which allow DB/Stmt instances to wrap a (sqlite3*)/(sqlite3_stmt*) optionally with or without taking ownership of it. The intent is to enable mix-and-match use of the C API, the oo1 API, and any other hypothetical API which exposes those pointers. oo1.Stmt.parameterCount is now a property access interceptor like Stmt.columnCount is, but that doesn't change how it's used.
Enhance the EXISTS-to-JOIN optimization so that it works on EXISTS subqueries
that do not have a WHERE clause, and so that it works on nested EXISTS
subqueries.
Fix an uninitialized variable added yesterday by [d27d34fb746280e7].
This problem was discovered overnight by
[https://github.com/google/oss-fuzz|OSSFuzz].
When attempting to optimize "expr AND false" to "false" and
"expr IN ()" to "false", take care not to delete aggregate functions
in the "expr" as doing so can change the meaning of the query.
See [forum:/forumpost/f4878de3e7dd4764|forum thread f4878de3e7].
drh [Mon, 30 Jun 2025 20:19:19 +0000 (20:19 +0000)]
Compute WhereLevel.addrBrk and .addrHalt early so that those labels can be
used to abort loops early. Use this to improve performance on two more
of the cases described by [forum:/forumpost/52651713ac|forum post 52651713ac].
drh [Mon, 30 Jun 2025 16:41:40 +0000 (16:41 +0000)]
Strive to skip the evaluation of scalar subqueries that are part of a
larger expression if the result from the scalar subquery does not change the
result of the overall expression.
drh [Mon, 30 Jun 2025 10:30:47 +0000 (10:30 +0000)]
Factor out the code that tries to avoid evaluating subquery operands if the
other operand is NULL into a subroutine, so that it can be more easily reused
by other parts of the code generator.
drh [Sat, 28 Jun 2025 17:59:15 +0000 (17:59 +0000)]
Improve the bytecode generated for comparisons so that if one operand is
a subquery and the other operand evaluates to NULL, the subquery operand
is not even computed. This fixes 5 of the 12 slow queries described
in [forum:/forumpost/52651713ac|forum post 52651713ac].
drh [Tue, 24 Jun 2025 15:58:32 +0000 (15:58 +0000)]
Range check the column index on the sqlite3_preupdate_old() interface
and return SQLITE_MISUSE if too large.
[forum:/forumpost/b617e497287235d0|Forum post b617e49728].
stephan [Sat, 21 Jun 2025 14:38:53 +0000 (14:38 +0000)]
Rework how JS's oo1.DB.exec() flags its Stmt objects to make certain Stmt APIs illegal (i.e. throwing) if called while that Stmt is being step()ped by DB.exec() (which can happen via client-provided per-result-row callbacks). This is an internal change only - the API is unaffected. Remove some unrelated dead code.
stephan [Thu, 19 Jun 2025 10:25:50 +0000 (10:25 +0000)]
Expose the column metadata APIs to WASM (which does not require a non-default sqlite3.c build, contrary to my prior mistaken claims). This adds only 424 bytes to sqlite3.wasm and 660 bytes to sqlite3.js.