drh [Thu, 5 Jan 2023 01:26:58 +0000 (01:26 +0000)]
In the zipvfile extension (which is not part of the SQLite amalgamation, but
which is included in the CLI by default) ensure that fopen() is not invoked
using a NULL filename. Fix for the issue reported by
[forum:/forumpost/d1c96a9032e564f8|forum post d1c96a9032e564f8].
dan [Wed, 4 Jan 2023 17:46:29 +0000 (17:46 +0000)]
Ensure that LIMIT clauses may be passed through to virtual table implementations even if the WHERE clause uses operators that may only be optimized by virtual, not built-in, tables (!=, functions, MATCH etc.).
drh [Wed, 4 Jan 2023 15:18:52 +0000 (15:18 +0000)]
Enhance PRAGMA integrity_check so that it verifies that the string values
stored in indexes are byte-for-byte identical to the values in the table, and
not just equivalent according to the collating sequence.
dbsqlfuzz 686e2e205e0c0594d3fb524bea0c25e621d1a870.
stephan [Wed, 4 Jan 2023 03:14:06 +0000 (03:14 +0000)]
Remove the JS-side SQLITE_WASM_DEALLOC sanity check which triggers the problem mentioned in [688c5c13d156] and [ae0196d86ee8], for reasons covered in the code comments, per discussion in [forum:e5b20e1feb|forum post e5b20e1feb].
stephan [Mon, 2 Jan 2023 20:07:30 +0000 (20:07 +0000)]
Another reformulation of SQLITE_WASM_DEALLOC to attempt to work around a Safari-specific quirk reported in [forum:5489305f601b8c3f|forum post 5489305f601b8c3f].
stephan [Sun, 1 Jan 2023 12:22:16 +0000 (12:22 +0000)]
An alternative solution to mapping SQLITE_WASM_DEALLOC to the proper function pointer in JS, to account for a Safari-specific quirk reported in [forum:e5b20e1feb|forum post e5b20e1feb].
drh [Mon, 26 Dec 2022 15:14:24 +0000 (15:14 +0000)]
Fix an infinite loop in the MEMSYS5 auxiliary memory allocator that occurs
for memory allocations between 1GiB and 2GiB in size. Error introduced
by check-in [949133231f8f751a]. The problem only affects builds that
include the SQLITE_ENABLE_MEMSYS5 compile-time option.
stephan [Mon, 26 Dec 2022 13:00:58 +0000 (13:00 +0000)]
Add JS infrastructure which enables sqlite3.capi.sqlite3_close_v2() to clean up stale JS-to-WASM collation function conversions installed on behalf of a given db handle. The same for UDF mappings is TODO.
stephan [Mon, 26 Dec 2022 11:13:09 +0000 (11:13 +0000)]
Reimplement sqlite3.capi.sqlite3_close_v2() and sqlite3session_delete() as a hand-written bindings so that they can attempt to clean up certain (potentially) FuncPtrAdapter-installed functions before closing. Correct the create-function family of JS-to-function-pointer automated conversions to include the UDF's arity as part of the mapping's key so that (un)binding a UDF to different functions for different arities works (and add tests confirming it). Correct a broken doc link in module-symbols.html.
stephan [Sun, 25 Dec 2022 22:44:13 +0000 (22:44 +0000)]
Add sqlite3.oo1.DB.selectValues(). Correct a logic error which could cause DB.selectValue(), DB.selectArray(), and DB.selectObject() to fail to finalize a statement if a call to bind() failed. Add more session API tests.
stephan [Sun, 25 Dec 2022 17:09:34 +0000 (17:09 +0000)]
Replace the "manual" implementation of sqlite3.capi.sqlite3_exec() with a briefer "automated" one via the [7f9ace1b11a67] feature addition. Minor code-adjacent internal cleanups.
stephan [Sun, 25 Dec 2022 14:04:06 +0000 (14:04 +0000)]
Add missing sqlite3_context_db_handle() JS binding. Reimplement sqlite3_set_authorizer() and sqlite3_set_auxdata() JS bindings to take advantage of [7f9ace1b11a67]. Teach FuncPtrAdapter to emit a console.warn() message if it is invoked after the library is bootstrapped, the goal being to inform users that it's an internal API and should not be invoked from client-side code.
stephan [Sun, 25 Dec 2022 12:51:53 +0000 (12:51 +0000)]
Enhance sqlite3.wasm.xWrap.FuncPtrAdapter to be able to handle sqlite3_create_function() and friends and reimplement those bindings to use this feature (this will also simplify certain session API bindings). Interal API changes only with no client-side breakage.
stephan [Sun, 25 Dec 2022 10:22:27 +0000 (10:22 +0000)]
Simplify the signature for JS functions, as opposed to function pointers, passed to sqlite3_exec(), eliminating the superfluous initial two arguments. Update related tests to demonstrate both function-passing approaches.
stephan [Sat, 24 Dec 2022 15:28:45 +0000 (15:28 +0000)]
Replace JS-side use of SQLITE_TRANSIENT with the new SQLITE_WASM_DEALLOC, reducing the amount allocation/copying required by sqlite3_bind_blob/text() and sqlite3_result_blob/text(). Remove the 'experimental' log message from the virtual table tests.
stephan [Sat, 24 Dec 2022 01:59:42 +0000 (01:59 +0000)]
If sqlite3.oo1.DB.exec()'s callback returns a literal false, stop step()ing over results as if the end of the result set had been reached. Unrelated minor code-adjacent cleanups.
stephan [Fri, 23 Dec 2022 23:46:33 +0000 (23:46 +0000)]
Reimplement JS's sqlite3_bind_text/blob() with hand-written bindings to permit more flexible inputs. Add automated JS-to-C function conversion to sqlite3_busy_handler(). sqlite3.wasm.xWrap()'s '*' argument conversion no longer treats JS strings as C-strings: those conversions require explicit opt-in via the 'string' converter (or equivalent).
stephan [Fri, 23 Dec 2022 19:16:45 +0000 (19:16 +0000)]
Consolidate/unify how the JS bindings of the create_function/collation family of functions react to a non-UTF8 encoding: they now treat a falsy value as SQLITE_UTF8 and fail with SQLITE_FORMAT for an invalid encoding.
stephan [Fri, 23 Dec 2022 14:11:54 +0000 (14:11 +0000)]
Add sqlite3.capi JS bindings for the sqlite3session_...(), sqlite3changeset_...() and sqlite3changegroup_...() APIs, noting that they are completely untested. Aside from missing tests, these bindings reveal a slight string-argument-type shortcoming in the callback function pointer "reverse binding" which should ideally be resolved before publishing them.
drh [Wed, 21 Dec 2022 19:11:56 +0000 (19:11 +0000)]
More efficient implementation of large precisions on the "%c" format for
the built-in printf(). This is an effort to avoid a reported
timeout on a (ridiculous) query generated by OSSFuzz.
drh [Wed, 21 Dec 2022 14:13:49 +0000 (14:13 +0000)]
Ensure that the expression of a virtual column really is an expression and
not just a reference to another column, as a real expression is necessary for
the indexed expression coverage optimization to work properly.
[forum:/forumpost/07b36e3899a9ae21|Forum thread 07b36e3899a9ae21].
drh [Wed, 21 Dec 2022 12:18:06 +0000 (12:18 +0000)]
New WHERETRACE entries for adding and removing objects from the
Parse.pIdxEpr list as part of indexed expression coverage. Debug and
testing changes only - no affect on production builds.
drh [Tue, 20 Dec 2022 01:48:43 +0000 (01:48 +0000)]
Do not use indexed expressions to replace the expression being indexed on a
RIGHT JOIN as that leads to problems, as shown by
dbsqlfuzz a644e70d7683a7ca59c71861a153c1dccf8850b9.