stephan [Wed, 22 Nov 2023 17:11:39 +0000 (17:11 +0000)]
Correct the URL for loading sqlite3-worker1-bundler-friendly.mjs from sqlite3-worker1-promiser-bundler-friendly.js, so that the promiser can be used in bundler-using environments. Problem reported via email.
drh [Mon, 20 Nov 2023 15:54:00 +0000 (15:54 +0000)]
Back out an incorrect change to the sqlite3ExprCompareSkip() function that
was added way back on 2019-08-22 for [44578865fa7baf97|check-in 44578865fa7ba]
and which was only today discovered to be incorrect by
[forum:/forumpost/45ec3d9788|forum post 45ec3d9788].
drh [Mon, 20 Nov 2023 13:06:59 +0000 (13:06 +0000)]
Convert an assert in OP_VCheck into a branch that aborts the opcode, as this
can happen on some very obscure conditions, as discovered by dbsqlfuzz.
Test case in TH3.
drh [Fri, 17 Nov 2023 17:25:30 +0000 (17:25 +0000)]
Add an assert() to prove the sqlite3_prepare() always either returns
SQLITE_OK or else leaves *ppStmt set to NULL. See
[forum:/forumpost/70bb8576c6c084c2|forum post 70bb8576c6c084c2].
drh [Fri, 17 Nov 2023 11:58:26 +0000 (11:58 +0000)]
Fix an incorrect assert() associated with ALTER TABLE where an unknown
aggregate function contains an ORDER BY clause.
dbsqlfuzz e0900262dadd5c78c2226ad6a435c7f0255be2cd.
larrybr [Thu, 16 Nov 2023 18:31:05 +0000 (18:31 +0000)]
Simplify and make more rational how console I/O package features are selected. (Motivated by Fiddle and other command-line utilities to soon use the package.) No substantive code-execution changes.
dan [Wed, 15 Nov 2023 19:19:04 +0000 (19:19 +0000)]
Changes so that if SQLITE_ENABLE_SETLK_TIMEOUT is defined as 2 instead of 1, all blocking locks are taken for a single millisecond and the default busy-handler invoked as normal.
stephan [Wed, 15 Nov 2023 08:29:42 +0000 (08:29 +0000)]
JNI: clear out the sqlite3_context native pointer after calling UDF callbacks which do not have an argv (as was already done for those which have an argv). Add related tests and code commentary.
stephan [Tue, 14 Nov 2023 14:38:11 +0000 (14:38 +0000)]
JNI: add Sqlite.Stmt.step(boolean) overload which returns the result code of sqlite3_step() unless passed true, in which case it throws for any result other than ROW or DONE. The intent is to simplify handling of LOCKED and BUSY errors.
stephan [Tue, 14 Nov 2023 05:33:44 +0000 (05:33 +0000)]
JNI: use ByteBuffer.limit() instead of ByteBuffer.capacity() when figuring out where the logical end of a ByteBuffer is, for reasons explained at length in new code comments. This is unfortunately slower but is the correct way to do it.
stephan [Tue, 14 Nov 2023 02:43:30 +0000 (02:43 +0000)]
JNI: change sqlite3_prepare_multi()'s exception-handling semantics to be more C-like and, to support that, add the package-private sqlite3_jni_db_error() method to set the db error state from package-level Java code.
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.
larrybr [Mon, 13 Nov 2023 05:24:00 +0000 (05:24 +0000)]
Enhance console_io to permit emits limited in various ways, such as valid UTF-8, upto control chars, or with counted limits, all getting away from 0-termination as the sole limit. In CLI, use this capability to avoid certain emit-chars-singly procedures that were breaking up UTF-8 characters. This fixes broken json mode output (on Windows) and (maybe) C-literal-like emits.
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].
larrybr [Sat, 11 Nov 2023 06:20:38 +0000 (06:20 +0000)]
Pervasive changes to console_io.{c,h} in support of simplifying ubiquitous emit ops in shell, and to get better control of console streams that might be opened only via .read or .output commands. Changes to shell to use {s,o,e}put{f,z}(...) calls for initial testing, but this check-in has few such conversions so that most will be in a separate check-in. Many renames to better follow recent coding convention. This code seems to be working, but has not been tested on difficult platforms or with multiple console hosts yet. So it is a WIP.
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].