stephan [Mon, 13 Nov 2023 23:11:10 +0000 (23:11 +0000)]
JNI: add sqlite3_column_nio_buffer() and sqlite3_value_nio_buffer() using an only-slightly roundabout approach to creating properly-sized ByteBuffer objects.
stephan [Mon, 13 Nov 2023 18:35:37 +0000 (18:35 +0000)]
JNI: add sqlite3_result_nio_buffer() and tests. Discover that we cannot create sensible sqlite3_column_nio_buffer() or sqlite3_value_nio_buffer() counterparts because of ByteBuffer interface limitations.
stephan [Sat, 11 Nov 2023 14:50:01 +0000 (14:50 +0000)]
JNI wrapper1: when checking for an out-of-bounds statement column index, perform the is-statement-finalized check before the range check so that the former exception trumps the latter.
stephan [Sat, 11 Nov 2023 14:43:50 +0000 (14:43 +0000)]
Do not cache a statement's column count in the JNI wrapper1 API because an ALTER TABLE via another statement may invalidate it, as reported in [forum:6d80efd58d4591c7|forum post 6d80efd58d4591c7].
drh [Fri, 10 Nov 2023 17:49:26 +0000 (17:49 +0000)]
Ensure 8-byte alignment of data structues in sqlite3_database_file_object().
This should have appeared on trunk originally and then be cherry-picked onto
the branch. Oh well....
dan [Fri, 10 Nov 2023 15:03:18 +0000 (15:03 +0000)]
Fix an obscure problem with the join-strength-reduction optimization that could occur when mixing LEFT and RIGHT joins in the same query. [forum:/forumpost/7f74ce0bee|Forum post 7f74ce0bee].
drh [Thu, 9 Nov 2023 17:36:37 +0000 (17:36 +0000)]
Add the SQLITE_RESULT_SUBTYPE flag for application-defined functions. Add
the -DSQLITE_STRICT_SUBTYPE=1 compile-time option that raises an error if
any function invokes sqlite3_result_subtype() without the SQLITE_RESULT_SUBTYPE
flag. SQLITE_RESULT_SUBTYPE prevents an indexed value of that function from
being used to replace an equivalent expression, since the indexed expression
does not carry the subtype. Fix for the problem described at
[forum:/forumpost/68d284c86b082c3e|forum post 68d284c86b082c3e].
drh [Thu, 9 Nov 2023 15:01:56 +0000 (15:01 +0000)]
Fixes: (1) In the ->> function, instead of setting a subtype and clearing it,
do not set it in the first place, as doing the set would trigger an error
under SQLITE_STRICT_SUBTYPE. (2) Allow the SQLITE_STRICT_SUBTYPE through
the property filter on sqlite3_create_function().
drh [Thu, 9 Nov 2023 12:58:03 +0000 (12:58 +0000)]
Add the SQLITE_STRICT_SUBTYPE compile-time option. This change reveals that
the current SQLITE_RESULT_SUBTYPE design does not work unless we tag the ->>
operator with SQLITE_RESULT_SUBTYPE. But that will disable an important
optimization.
stephan [Thu, 9 Nov 2023 12:48:54 +0000 (12:48 +0000)]
Add some notes about the JNI pointer-passing approach and convert a couple of potential NullPointerExceptions into appropriate C result codes. Clarify that invocation of undefined behaviour from the Java API does not (due to the addition of defensive code) mean the same thing as it does in C (e.g. no NULL pointer dereferences).
drh [Thu, 9 Nov 2023 12:08:16 +0000 (12:08 +0000)]
Omit the new SQLITE_VALUE_SUBTYPE name. Stay with legacy SQLTIE_SUBTYPE.
Add extra documentation to sqlite3_value_subtype() and sqlite3_result_subtype()
indicating that the SQLITE_SUBTYPE and SQLITE_RESULT_SUBTYPE properties are
required on functions that use those interfaces.
drh [Wed, 8 Nov 2023 16:37:12 +0000 (16:37 +0000)]
More precise characterization of JSON functions. Indicate when functions might
return JSON (subtype 'J') and when they make use of the function argument cache.
drh [Tue, 7 Nov 2023 19:03:13 +0000 (19:03 +0000)]
Update the documentation to the sqlite3_set_auxdata() and sqlite3_get_auxdata()
routines to make it clear that they do not work as one might expect when they
are called during query planning, instead of during query execution. The JSON
routines misuse those interfaces, so add a special flag to JSON routines that
prevents them from being invoked during query planning. Fix for the problem
in [forum:/forumpost/a655ee159eca1ea5|forum post a655ee159eca1ea5].
stephan [Tue, 7 Nov 2023 17:15:55 +0000 (17:15 +0000)]
JNI: during static init record whether the current JVM supports JNI-level access to java.nio.ByteBuffer raw memory, and add sqlite3_jni_supports_nio() to query that.
stephan [Mon, 6 Nov 2023 21:57:15 +0000 (21:57 +0000)]
Add -DSQLITE_ENABLE_COLUMN_METADATA to the JNI build, as per [forum:9205518c0568fdf0|forum post 9205518c0568fdf0]. Add tests for the functions that flag enables so that the build will fail if that flag is missing.
dan [Mon, 6 Nov 2023 18:40:25 +0000 (18:40 +0000)]
Fix an fts5 problem where a transaction consisting of (a) a DELETE on rowid X, (b) a prefix query, and (c) an INSERT on rowid X, could corrupt the index.
stephan [Sun, 5 Nov 2023 03:37:33 +0000 (03:37 +0000)]
JNI wrapper1 normalizeSql() now throws UnsupportedOperationException, instead of returning null, if built without SQLITE_ENABLE_NORMALIZE. Remove SQLITE_PREPARE_NORMALIZE from the JNI interface because it's a legacy no-op.
stephan [Sat, 4 Nov 2023 23:37:11 +0000 (23:37 +0000)]
Bind collation and collation-needed to JNI wrapper1 and correct the callback return type for collation-needed callbacks in the lower-level JNI binding.
drh [Sat, 4 Nov 2023 21:44:00 +0000 (21:44 +0000)]
Ensure that the YYYY-MM-DD input to date and time functions has been normalized
prior to returning a result.
[forum:/forumpost/6bb476897e|Forum post 6bb476897e].
stephan [Sat, 4 Nov 2023 12:53:00 +0000 (12:53 +0000)]
Bind the trace API to the JNI wrapper1 API and add a way to map the native-level db/stmt types to their high-level counterparts (required for translating callbacks such as tracers).
dan [Thu, 2 Nov 2023 21:02:53 +0000 (21:02 +0000)]
Fix a spurious "misuse of aggregate function" error that could occur when an aggregate function was used within the FROM clause of a sub-select of the select that owns the aggregate. e.g. "SELECT (SELECT x FROM (SELECT sum(t1.a) AS x)) FROM t1". [forum:/forumpost/c9970a37ed | Forum post c9970a37ed].
drh [Thu, 2 Nov 2023 12:05:55 +0000 (12:05 +0000)]
Update the srctree-check.tcl script and child script so that they can be run
on a read-only source tree and so that if any inconsistencies are found, the
script returns a non-zero exit code and thus halts the build.
drh [Mon, 30 Oct 2023 19:03:17 +0000 (19:03 +0000)]
Add a cast to i64 for an integer in an sqlite3OsWrite() offset
calculation. The cast is not strictly necessary, but it helps human readers
see that the code is correct.
drh [Mon, 30 Oct 2023 12:09:48 +0000 (12:09 +0000)]
With SQLITE_ENABLE_BLOCK_ATOMIC_WRITE enabled, if a transaction is committing
and there is a new freelist page at the end of the database file which would
cause the database file size to grow, ensure that page is written and the
file size grows before the block-atomic-write commits. Fix for the
problem identified by [forum:/forumpost/3bd8d497b2|forum post 3bd8d497b2]