dan [Mon, 7 Aug 2023 17:09:25 +0000 (17:09 +0000)]
Enhance sqlite3_vtab_nochange() so that it works with "UPDATE ... FROM ..." statements. Use this to allow some updates on fts5 contentless-delete tables.
dan [Mon, 7 Aug 2023 16:15:56 +0000 (16:15 +0000)]
Changes so that sqlite3_vtab_nochange() works with "UPDATE ... FROM...". Use this to allow UPDATE on a contentless fts5 table if new values are supplied for all indexed columns.
stephan [Mon, 7 Aug 2023 11:18:44 +0000 (11:18 +0000)]
When converting a Java exception to a db error message, use Throwable.toString() instead of getMessage() so that the exception type's name is included. More internal API renaming for consistency.
stephan [Mon, 7 Aug 2023 09:44:00 +0000 (09:44 +0000)]
Rename fts5_api pContext parameters to pUserData, per /chat discussion. This is a cosmetic change made to reduce confusion between those parameters and the two other context-type parameters in that API.
stephan [Sun, 6 Aug 2023 22:09:09 +0000 (22:09 +0000)]
Rework the sqlite3_open(_v2)() order of operations so that pending auto-extension support can get ahold of the open-time Java state despite the Java/C (sqlite3*) binding not having yet been established.
stephan [Sun, 6 Aug 2023 21:29:13 +0000 (21:29 +0000)]
Completely rework how the JNI sqlite3_open(_v2) and sqlite3_prepare(_vN)() bindings deal with output pointers to give the JNI side full control over the origin of db and stmt handles (necessary for solving chicken/egg situations in auto-extensions and prepare-time trace). Lots of adjacent internal API renaming.
stephan [Sun, 6 Aug 2023 20:01:30 +0000 (20:01 +0000)]
Start adding JNI-side support for auto extensions, but hit a brick wall which requires slightly awkward semantics changes in the JNI bindings for sqlite3_open(_v2)() to resolve, so stash this #if'd out for the time being.
stephan [Sun, 6 Aug 2023 11:05:17 +0000 (11:05 +0000)]
Remove doc outdated warning about sqlite3_trace_v2() JNI binding being incompatible with MUTF-8. Use new to-string capability to simplify Fts5ExtensionApi::xColumnText() JNI binding.
stephan [Sun, 6 Aug 2023 10:14:53 +0000 (10:14 +0000)]
Bind sqlite3_db_filename() and (closely related) (A) add many more docs about the UTF-8/MUTF-8 discrepancy (B) start adding internals to enable us to perform the standard-UTF-8-to-Java conversion from C.
stephan [Sat, 5 Aug 2023 21:35:58 +0000 (21:35 +0000)]
Refactor the per-JNIEnv cache from a fixed-size static array to a linked list of dynamically-allocated entries. Uncache all per-db state (which is necessarily JNIEnv-specific) when the corresponding JNIEnv is uncached.
stephan [Sat, 5 Aug 2023 20:19:45 +0000 (20:19 +0000)]
Add SQLite3Jni.uncacheJniEnv(), a way for Java threads to clear their thread-specific cached state from the JNI bindings when they're about to terminate (or are otherwise done using the library).
stephan [Sat, 5 Aug 2023 11:16:54 +0000 (11:16 +0000)]
Bind Fts5ExtensionApi::xUserData() to JNI and extend xCreateFunction() to accept that argument. In test code, use assert() instead of exceptions if assert() is enabled so that test failures (exceptions) thrown via callbacks do not get suppressed (which they otherwise necessarily are to avoid crashing the host app).
stephan [Sat, 5 Aug 2023 00:40:28 +0000 (00:40 +0000)]
Bind the remaining Fts5ExtensionApi methods to JNI, noting that all are completely untested because the higher-level bits needed to do so are still missing.
stephan [Fri, 4 Aug 2023 16:01:55 +0000 (16:01 +0000)]
In the opfs-sahpool VFS's importDb() and exportFile() methods, throw if the actually-wrote/read amounts differ from the expected-to-write/read amounts, per feedback in [forum:a4122e986f|forum post a4122e986f].
drh [Fri, 4 Aug 2023 13:19:11 +0000 (13:19 +0000)]
Fix a bug in the jsonLookup() routine used to search JSON. Bug was
introduced by the recent (unreleased) JSON caching enhancements
check-in [a4c1af616e672a0d] merged into trunk at [df099ad713011b67].
stephan [Fri, 4 Aug 2023 08:45:25 +0000 (08:45 +0000)]
Resolve the timing/ordering issue of a JS-to-WASM-converted xDestroy() function being uninstalled from WASM right before the underlying native call tries to call it. This has been a long-unnoticed bug which appears only when removing such functions or replacing them.
drh [Thu, 3 Aug 2023 13:07:58 +0000 (13:07 +0000)]
Fix a test case whose value changes under the no_optimization permutation
due to the recent change to add the ability for SQLITE_TESTCTRL_OPTIMIZATION
to disable one-pass.
drh [Thu, 3 Aug 2023 12:41:30 +0000 (12:41 +0000)]
Unix builds now assume the presence of nanosleep() in the standard library.
The -DHAVE_NANOSLEEP=0 compile-time option can be used to build on systems
(if any still exist) where this is not the case.
drh [Wed, 2 Aug 2023 13:29:01 +0000 (13:29 +0000)]
Remove a condition from query flattening that is now taken care of by
the caller. Factor out the reverse_unordered_selects processing from the
main loop of sqlite3WhereBegin() for performance.
drh [Wed, 2 Aug 2023 12:39:56 +0000 (12:39 +0000)]
Simplify the select.c logic that enforces the optimization fence around
a MATERIALIZED common table expression. Do not allow the
reverse_unordered_selects setting to affect a fenced CTE that itself has
an ORDER BY clause.
drh [Wed, 2 Aug 2023 11:06:27 +0000 (11:06 +0000)]
Never flatten a CTE that is labeled MATERIALIZED. This is really something
of a bug fix because the documentation says that a MATERIALIZED CTE is an
optimization barrier.
drh [Wed, 2 Aug 2023 00:09:15 +0000 (00:09 +0000)]
When a query is inside an AS MATERIALIZED CTE, do not attempt the
omit-ORDER-BY optimization. If the developer specifies MATERIALIZED,
that means he wants the sort to actually happen.
drh [Tue, 1 Aug 2023 00:34:03 +0000 (00:34 +0000)]
Restore part of the UPDATE one-pass optimization that was removed by
check-in [2c56b984a0bd3be5]: only disable one-pass if the WHERE clause
contains a subquery. Allow subqueries in the SET expressions.
Fix for performance problem reported by
[forum:/forumpost/8ab195fd44e75ed0|forum post 8ab195fd44e75ed0].
The original column-cache implementation from check-in [ab1edcc7fedcf279]
(merged to trunk at [771fe35074b50b8d]) is unsound. This check-in fixes
the issue. Had to give back a little performance, the optimization is still
a overall win.
stephan [Mon, 31 Jul 2023 13:52:46 +0000 (13:52 +0000)]
Experimentally change the JNI sqlite3_trace_v2() callback type to have more convenient access to the current Java-side sqlite3_stmt at the cost of some uncomfortably fiddly current-statement tracking in the JNI layer. Subject to change.
stephan [Mon, 31 Jul 2023 12:10:32 +0000 (12:10 +0000)]
Add some JNI-internal metrics, accessible via passing -v when running Tester1.java. Document an OpenJDK bug which leads to incorrect -Xlint:jni warnings.
stephan [Mon, 31 Jul 2023 10:55:30 +0000 (10:55 +0000)]
Correct a mis-cast in the JNI wrapper which just happened to accidentally work. Update JNI binding of sqlite3_context_db_handle() to return the bound-at-open() db instance instead of a new/temp proxy object.
stephan [Sun, 30 Jul 2023 10:47:38 +0000 (10:47 +0000)]
Internal JNI refacoring to support the pending sqlite3_collation_needed() callback. Correct a bug in the linked-list handling of PerDbStateJni which triggered an assert().