Create parallel C and C++ test/demo shell extensions, with header tweaks to make that work. Fix a bug exposed when multiple shell extensions were loaded.
Enhance the sqlite_dbpage fix at [/info/642a0b4752743216|check-in 642a0b4752743]
from about a month ago such that it still takes a transaction on all attached
databases, but it only starts a read transaction for read-only operations,
rather than starting a write transaction for everything.
Improved explanation and commentary on the sqlite3JoinType() routine. One
of the error messages changes slightly, but besides that everything works
the same.
The ".testctrl optimizations 0x400000" command disables the generation of
OP_ReleaseReg opcodes. OP_ReleaseReg opcodes are usually only generated for
SQLITE_DEBUG builds and are used to verify that registers are descoped
propertly. But they can get in the way of code understanding when studying
bytecode dumps. So this new optimization setting is provided to
temporarily turn OP_ReleaseReg opcodes off.
Add the sqlite3Show() family of debugging interfaces under SQLITE_DEBUG.
No changes to deliverable builds. Rename SQLITE_ENABLE_SELECTTRACE to
SQLITE_ENABLE_TREETRACE in ctime.c.
Rename debugging defines and variables from SELECTTRACE to TREETRACE (and
similar) since the functionality has how expanded to include data structures
beyond SELECT statements. Should not affect deliverable builds.
Add new diagnostic "sqlite3TreeView" routines for IdList, Upsert, and for
INSERT statements. This is all debugging code. There are no changes to
release builds.
When constructing the JSON Path for the "fullpath" column of the
json_tree() and json_each() table-valued functions, be sure to quote
object labels where necessary.
For TCL extension: Adjust provided "gui" command, and document it.
For shell: Separate shell variables from binding parameters, mainly so they live longer, in the shell DB.
Add .vars dot command to reflect this separation, and specialized for shell variables.
Much code shuffling to share code between .parameters and .vars commands.
Only invoke sqlite3VdbeClearObject() from a single location, so that the
compiler is more likely to in-line the code. Performance increase and
size reduction.
Omit the Vdbe.runOnlyOnce flag (simplifying the prepared statement
implementation) and accomplish the same result by adding an "OP_Expire 1 1"
opcode to prepared statements that would normally have runOnlyOnce set.
In-line the sqlite3VdbeSerialPut() routine into the OP_MakeRecord opcode.
This allows some duplicate comparisons to be omitted, resulting in a size
reduction and performance increase.
New macro ROUND8P() which works like ROUND8() but assumes that the input is
already a multiple of the size of a pointer. It becomes a no-op for
64-bit machines, giving a small size reduction and speed boost.
Provide and use a version of sqlite3VdbeFreeCursor() that guarantees the
cursor pointer is not NULL. This saves a few bytes of code space and a
few CPU cycles.
Refactor the Vdbe.iVdbeMagic field into Vdbe.eVdbeState. Split the RUNNING
state into separate RUNNING and READY. This gives a size reduction and
performance increase.
Have the sqlite3_context object carry the encoding for the prepared statement
that it represents, so that sqlite3_result() and similar can set the encoding
according to the prepared statement, even if the database encoding has
changed.
dbsqlfuzz c409b10d0a6bccf78ab00f47e1d29d42ee5b3565
drh [Thu, 31 Mar 2022 11:12:56 +0000 (11:12 +0000)]
Refinement to [3f9887d4a58cbfdb]: The SQLITE_CONSTRAINT error should only
be returned if the prepared statement came from sqlite3_prepare_v2(). The
legacy sqlite3_prepare() is documented to return only SQLITE_ERROR.
larrybr [Thu, 31 Mar 2022 03:45:52 +0000 (03:45 +0000)]
For TCL extension: Add Tk and means to run it, optionally. Implement ScriptSupport interface.
For shell: Get scripting support thru an object interface like the others. Rename OutMode* to Export*.
For both: Provide a way to pass arguments to an extension upon load and get them into TCL's argv.
drh [Tue, 29 Mar 2022 22:57:00 +0000 (22:57 +0000)]
In setResultStrOrError(), if the input string pointer is NULL and hence the
value gets set to an SQL NULL, then the Mem.enc field is uninitialized. So
do not read it. This is a harmless OSSFuzz/ASAN found problem.
larrybr [Tue, 29 Mar 2022 21:11:30 +0000 (21:11 +0000)]
For TCL extension:
Cleanup TCL library interaction and interpreter management.
Group code into more purpose oriented functions.
Add .unknown dot command, delegating to TCL commands with "dot" names.
Drop planned .eval new dot command.
For shell:
Implement undocumented .unknown dot command, doing little.
Make dispatcher call .unknown's implementation for unknown dot command.
Fix a command lookup bug exposed by above change to unknown handling.
Add .eval dot command.
Add options to .x command aimed at control of errors in command sequences. (a WIP)
Make dispatcher report ambiguous dot command lookups, even with no extension.
drh [Tue, 29 Mar 2022 01:43:09 +0000 (01:43 +0000)]
Fix the sqlite3_result_xxxxx() routines so that they all check for and
perform any necessary text encoding conversions and check for oversize
strings and BLOBs. Thus those checks can be done where they are most
efficient and avoided in cases like OP_Function where they are more
expensive.
larrybr [Mon, 28 Mar 2022 21:42:16 +0000 (21:42 +0000)]
TCL extension polished and more smoothly integrated. A couple of bugs related to takedown fixed. Help for added features. Code cleaned up and commented.
larrybr [Sun, 27 Mar 2022 03:08:02 +0000 (03:08 +0000)]
In TCL shell extension, add TCL command "udb". This gets the TCL environment to near parity with pre-extended utility, except for query result display (TBD soon).
drh [Fri, 25 Mar 2022 01:23:37 +0000 (01:23 +0000)]
Fix the Bloom-filter optimization so that it does not use IS NULL or
IS NOT NULL constraints from the WHERE clause when operating on a LEFT JOIN.
[forum:/forumpost/031e262a89b6a9d2|Forum thread 031e262a89b6a9d2].
drh [Wed, 23 Mar 2022 10:04:52 +0000 (10:04 +0000)]
Use trickery to code the UTF-8 BOM for the --bom option on .output, .once,
and .excel in the CLI, to work around a warning in some Microsoft compilers.
[https://fossil-scm.org/forum/forumpost/bd0844268f0fab71|Fossil forum post bd0844268f0fab71].