sqlite-amalgamation-3410000.zip

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4196 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2023-02-26 03:12:14 +00:00
parent 8c9d687d50
commit 2ed3295f77
4 changed files with 4487 additions and 1774 deletions

1814
deps/sqlite/shell.c vendored

File diff suppressed because it is too large Load Diff

3751
deps/sqlite/sqlite3.c vendored

File diff suppressed because it is too large Load Diff

236
deps/sqlite/sqlite3.h vendored
View File

@ -146,9 +146,9 @@ extern "C" {
** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()]. ** [sqlite_version()] and [sqlite_source_id()].
*/ */
#define SQLITE_VERSION "3.40.1" #define SQLITE_VERSION "3.41.0"
#define SQLITE_VERSION_NUMBER 3040001 #define SQLITE_VERSION_NUMBER 3041000
#define SQLITE_SOURCE_ID "2022-12-28 14:03:47 df5c253c0b3dd24916e4ec7cf77d3db5294cc9fd45ae7b9c5e82ad8197f38a24" #define SQLITE_SOURCE_ID "2023-02-21 18:09:37 05941c2a04037fc3ed2ffae11f5d2260706f89431f463518740f72ada350866d"
/* /*
** CAPI3REF: Run-Time Library Version Numbers ** CAPI3REF: Run-Time Library Version Numbers
@ -563,6 +563,7 @@ SQLITE_API int sqlite3_exec(
#define SQLITE_CONSTRAINT_DATATYPE (SQLITE_CONSTRAINT |(12<<8)) #define SQLITE_CONSTRAINT_DATATYPE (SQLITE_CONSTRAINT |(12<<8))
#define SQLITE_NOTICE_RECOVER_WAL (SQLITE_NOTICE | (1<<8)) #define SQLITE_NOTICE_RECOVER_WAL (SQLITE_NOTICE | (1<<8))
#define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2<<8)) #define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2<<8))
#define SQLITE_NOTICE_RBU (SQLITE_NOTICE | (3<<8))
#define SQLITE_WARNING_AUTOINDEX (SQLITE_WARNING | (1<<8)) #define SQLITE_WARNING_AUTOINDEX (SQLITE_WARNING | (1<<8))
#define SQLITE_AUTH_USER (SQLITE_AUTH | (1<<8)) #define SQLITE_AUTH_USER (SQLITE_AUTH | (1<<8))
#define SQLITE_OK_LOAD_PERMANENTLY (SQLITE_OK | (1<<8)) #define SQLITE_OK_LOAD_PERMANENTLY (SQLITE_OK | (1<<8))
@ -1175,7 +1176,6 @@ struct sqlite3_io_methods {
** in wal mode after the client has finished copying pages from the wal ** in wal mode after the client has finished copying pages from the wal
** file to the database file, but before the *-shm file is updated to ** file to the database file, but before the *-shm file is updated to
** record the fact that the pages have been checkpointed. ** record the fact that the pages have been checkpointed.
** </ul>
** **
** <li>[[SQLITE_FCNTL_EXTERNAL_READER]] ** <li>[[SQLITE_FCNTL_EXTERNAL_READER]]
** The EXPERIMENTAL [SQLITE_FCNTL_EXTERNAL_READER] opcode is used to detect ** The EXPERIMENTAL [SQLITE_FCNTL_EXTERNAL_READER] opcode is used to detect
@ -1188,16 +1188,16 @@ struct sqlite3_io_methods {
** the database is not a wal-mode db, or if there is no such connection in any ** the database is not a wal-mode db, or if there is no such connection in any
** other process. This opcode cannot be used to detect transactions opened ** other process. This opcode cannot be used to detect transactions opened
** by clients within the current process, only within other processes. ** by clients within the current process, only within other processes.
** </ul>
** **
** <li>[[SQLITE_FCNTL_CKSM_FILE]] ** <li>[[SQLITE_FCNTL_CKSM_FILE]]
** Used by the cksmvfs VFS module only. ** The [SQLITE_FCNTL_CKSM_FILE] opcode is for use interally by the
** [checksum VFS shim] only.
** **
** <li>[[SQLITE_FCNTL_RESET_CACHE]] ** <li>[[SQLITE_FCNTL_RESET_CACHE]]
** If there is currently no transaction open on the database, and the ** If there is currently no transaction open on the database, and the
** database is not a temp db, then this file-control purges the contents ** database is not a temp db, then the [SQLITE_FCNTL_RESET_CACHE] file-control
** of the in-memory page cache. If there is an open transaction, or if ** purges the contents of the in-memory page cache. If there is an open
** the db is a temp-db, it is a no-op, not an error. ** transaction, or if the db is a temp-db, this opcode is a no-op, not an error.
** </ul> ** </ul>
*/ */
#define SQLITE_FCNTL_LOCKSTATE 1 #define SQLITE_FCNTL_LOCKSTATE 1
@ -2184,7 +2184,7 @@ struct sqlite3_mem_methods {
** configuration for a database connection can only be changed when that ** configuration for a database connection can only be changed when that
** connection is not currently using lookaside memory, or in other words ** connection is not currently using lookaside memory, or in other words
** when the "current value" returned by ** when the "current value" returned by
** [sqlite3_db_status](D,[SQLITE_CONFIG_LOOKASIDE],...) is zero. ** [sqlite3_db_status](D,[SQLITE_DBSTATUS_LOOKASIDE_USED],...) is zero.
** Any attempt to change the lookaside memory configuration when lookaside ** Any attempt to change the lookaside memory configuration when lookaside
** memory is in use leaves the configuration unchanged and returns ** memory is in use leaves the configuration unchanged and returns
** [SQLITE_BUSY].)^</dd> ** [SQLITE_BUSY].)^</dd>
@ -2334,8 +2334,12 @@ struct sqlite3_mem_methods {
** <li> sqlite3_db_config(db, SQLITE_DBCONFIG_RESET_DATABASE, 0, 0); ** <li> sqlite3_db_config(db, SQLITE_DBCONFIG_RESET_DATABASE, 0, 0);
** </ol> ** </ol>
** Because resetting a database is destructive and irreversible, the ** Because resetting a database is destructive and irreversible, the
** process requires the use of this obscure API and multiple steps to help ** process requires the use of this obscure API and multiple steps to
** ensure that it does not happen by accident. ** help ensure that it does not happen by accident. Because this
** feature must be capable of resetting corrupt databases, and
** shutting down virtual tables may require access to that corrupt
** storage, the library must abandon any installed virtual tables
** without calling their xDestroy() methods.
** **
** [[SQLITE_DBCONFIG_DEFENSIVE]] <dt>SQLITE_DBCONFIG_DEFENSIVE</dt> ** [[SQLITE_DBCONFIG_DEFENSIVE]] <dt>SQLITE_DBCONFIG_DEFENSIVE</dt>
** <dd>The SQLITE_DBCONFIG_DEFENSIVE option activates or deactivates the ** <dd>The SQLITE_DBCONFIG_DEFENSIVE option activates or deactivates the
@ -2674,8 +2678,12 @@ SQLITE_API sqlite3_int64 sqlite3_total_changes64(sqlite3*);
** ^A call to sqlite3_interrupt(D) that occurs when there are no running ** ^A call to sqlite3_interrupt(D) that occurs when there are no running
** SQL statements is a no-op and has no effect on SQL statements ** SQL statements is a no-op and has no effect on SQL statements
** that are started after the sqlite3_interrupt() call returns. ** that are started after the sqlite3_interrupt() call returns.
**
** ^The [sqlite3_is_interrupted(D)] interface can be used to determine whether
** or not an interrupt is currently in effect for [database connection] D.
*/ */
SQLITE_API void sqlite3_interrupt(sqlite3*); SQLITE_API void sqlite3_interrupt(sqlite3*);
SQLITE_API int sqlite3_is_interrupted(sqlite3*);
/* /*
** CAPI3REF: Determine If An SQL Statement Is Complete ** CAPI3REF: Determine If An SQL Statement Is Complete
@ -3293,8 +3301,8 @@ SQLITE_API SQLITE_DEPRECATED void *sqlite3_profile(sqlite3*,
** <dd>^An SQLITE_TRACE_PROFILE callback provides approximately the same ** <dd>^An SQLITE_TRACE_PROFILE callback provides approximately the same
** information as is provided by the [sqlite3_profile()] callback. ** information as is provided by the [sqlite3_profile()] callback.
** ^The P argument is a pointer to the [prepared statement] and the ** ^The P argument is a pointer to the [prepared statement] and the
** X argument points to a 64-bit integer which is the estimated of ** X argument points to a 64-bit integer which is approximately
** the number of nanosecond that the prepared statement took to run. ** the number of nanoseconds that the prepared statement took to run.
** ^The SQLITE_TRACE_PROFILE callback is invoked when the statement finishes. ** ^The SQLITE_TRACE_PROFILE callback is invoked when the statement finishes.
** **
** [[SQLITE_TRACE_ROW]] <dt>SQLITE_TRACE_ROW</dt> ** [[SQLITE_TRACE_ROW]] <dt>SQLITE_TRACE_ROW</dt>
@ -3357,7 +3365,7 @@ SQLITE_API int sqlite3_trace_v2(
** **
** ^The sqlite3_progress_handler(D,N,X,P) interface causes the callback ** ^The sqlite3_progress_handler(D,N,X,P) interface causes the callback
** function X to be invoked periodically during long running calls to ** function X to be invoked periodically during long running calls to
** [sqlite3_exec()], [sqlite3_step()] and [sqlite3_get_table()] for ** [sqlite3_step()] and [sqlite3_prepare()] and similar for
** database connection D. An example use for this ** database connection D. An example use for this
** interface is to keep a GUI updated during a large query. ** interface is to keep a GUI updated during a large query.
** **
@ -3382,6 +3390,13 @@ SQLITE_API int sqlite3_trace_v2(
** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their ** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
** database connections for the meaning of "modify" in this paragraph. ** database connections for the meaning of "modify" in this paragraph.
** **
** The progress handler callback would originally only be invoked from the
** bytecode engine. It still might be invoked during [sqlite3_prepare()]
** and similar because those routines might force a reparse of the schema
** which involves running the bytecode engine. However, beginning with
** SQLite version 3.41.0, the progress handler callback might also be
** invoked directly from [sqlite3_prepare()] while analyzing and generating
** code for complex queries.
*/ */
SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
@ -3418,13 +3433,18 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
** **
** <dl> ** <dl>
** ^(<dt>[SQLITE_OPEN_READONLY]</dt> ** ^(<dt>[SQLITE_OPEN_READONLY]</dt>
** <dd>The database is opened in read-only mode. If the database does not ** <dd>The database is opened in read-only mode. If the database does
** already exist, an error is returned.</dd>)^ ** not already exist, an error is returned.</dd>)^
** **
** ^(<dt>[SQLITE_OPEN_READWRITE]</dt> ** ^(<dt>[SQLITE_OPEN_READWRITE]</dt>
** <dd>The database is opened for reading and writing if possible, or reading ** <dd>The database is opened for reading and writing if possible, or
** only if the file is write protected by the operating system. In either ** reading only if the file is write protected by the operating
** case the database must already exist, otherwise an error is returned.</dd>)^ ** system. In either case the database must already exist, otherwise
** an error is returned. For historical reasons, if opening in
** read-write mode fails due to OS-level permissions, an attempt is
** made to open it in read-only mode. [sqlite3_db_readonly()] can be
** used to determine whether the database is actually
** read-write.</dd>)^
** **
** ^(<dt>[SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]</dt> ** ^(<dt>[SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]</dt>
** <dd>The database is opened for reading and writing, and is created if ** <dd>The database is opened for reading and writing, and is created if
@ -5405,10 +5425,21 @@ SQLITE_API int sqlite3_create_window_function(
** from top-level SQL, and cannot be used in VIEWs or TRIGGERs nor in ** from top-level SQL, and cannot be used in VIEWs or TRIGGERs nor in
** schema structures such as [CHECK constraints], [DEFAULT clauses], ** schema structures such as [CHECK constraints], [DEFAULT clauses],
** [expression indexes], [partial indexes], or [generated columns]. ** [expression indexes], [partial indexes], or [generated columns].
** The SQLITE_DIRECTONLY flags is a security feature which is recommended ** <p>
** for all [application-defined SQL functions], and especially for functions ** The SQLITE_DIRECTONLY flag is recommended for any
** that have side-effects or that could potentially leak sensitive ** [application-defined SQL function]
** information. ** that has side-effects or that could potentially leak sensitive information.
** This will prevent attacks in which an application is tricked
** into using a database file that has had its schema surreptiously
** modified to invoke the application-defined function in ways that are
** harmful.
** <p>
** Some people say it is good practice to set SQLITE_DIRECTONLY on all
** [application-defined SQL functions], regardless of whether or not they
** are security sensitive, as doing so prevents those functions from being used
** inside of the database schema, and thus ensures that the database
** can be inspected and modified using generic tools (such as the [CLI])
** that do not have access to the application-defined functions.
** </dd> ** </dd>
** **
** [[SQLITE_INNOCUOUS]] <dt>SQLITE_INNOCUOUS</dt><dd> ** [[SQLITE_INNOCUOUS]] <dt>SQLITE_INNOCUOUS</dt><dd>
@ -5549,16 +5580,6 @@ SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int6
** then the conversion is performed. Otherwise no conversion occurs. ** then the conversion is performed. Otherwise no conversion occurs.
** The [SQLITE_INTEGER | datatype] after conversion is returned.)^ ** The [SQLITE_INTEGER | datatype] after conversion is returned.)^
** **
** ^(The sqlite3_value_encoding(X) interface returns one of [SQLITE_UTF8],
** [SQLITE_UTF16BE], or [SQLITE_UTF16LE] according to the current encoding
** of the value X, assuming that X has type TEXT.)^ If sqlite3_value_type(X)
** returns something other than SQLITE_TEXT, then the return value from
** sqlite3_value_encoding(X) is meaningless. ^Calls to
** sqlite3_value_text(X), sqlite3_value_text16(X), sqlite3_value_text16be(X),
** sqlite3_value_text16le(X), sqlite3_value_bytes(X), or
** sqlite3_value_bytes16(X) might change the encoding of the value X and
** thus change the return from subsequent calls to sqlite3_value_encoding(X).
**
** ^Within the [xUpdate] method of a [virtual table], the ** ^Within the [xUpdate] method of a [virtual table], the
** sqlite3_value_nochange(X) interface returns true if and only if ** sqlite3_value_nochange(X) interface returns true if and only if
** the column corresponding to X is unchanged by the UPDATE operation ** the column corresponding to X is unchanged by the UPDATE operation
@ -5623,6 +5644,27 @@ SQLITE_API int sqlite3_value_type(sqlite3_value*);
SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*); SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);
SQLITE_API int sqlite3_value_nochange(sqlite3_value*); SQLITE_API int sqlite3_value_nochange(sqlite3_value*);
SQLITE_API int sqlite3_value_frombind(sqlite3_value*); SQLITE_API int sqlite3_value_frombind(sqlite3_value*);
/*
** CAPI3REF: Report the internal text encoding state of an sqlite3_value object
** METHOD: sqlite3_value
**
** ^(The sqlite3_value_encoding(X) interface returns one of [SQLITE_UTF8],
** [SQLITE_UTF16BE], or [SQLITE_UTF16LE] according to the current text encoding
** of the value X, assuming that X has type TEXT.)^ If sqlite3_value_type(X)
** returns something other than SQLITE_TEXT, then the return value from
** sqlite3_value_encoding(X) is meaningless. ^Calls to
** [sqlite3_value_text(X)], [sqlite3_value_text16(X)], [sqlite3_value_text16be(X)],
** [sqlite3_value_text16le(X)], [sqlite3_value_bytes(X)], or
** [sqlite3_value_bytes16(X)] might change the encoding of the value X and
** thus change the return from subsequent calls to sqlite3_value_encoding(X).
**
** This routine is intended for used by applications that test and validate
** the SQLite implementation. This routine is inquiring about the opaque
** internal state of an [sqlite3_value] object. Ordinary applications should
** not need to know what the internal state of an sqlite3_value object is and
** hence should not need to use this interface.
*/
SQLITE_API int sqlite3_value_encoding(sqlite3_value*); SQLITE_API int sqlite3_value_encoding(sqlite3_value*);
/* /*
@ -7003,15 +7045,6 @@ SQLITE_API int sqlite3_cancel_auto_extension(void(*xEntryPoint)(void));
*/ */
SQLITE_API void sqlite3_reset_auto_extension(void); SQLITE_API void sqlite3_reset_auto_extension(void);
/*
** The interface to the virtual-table mechanism is currently considered
** to be experimental. The interface might change in incompatible ways.
** If this is a problem for you, do not use the interface at this time.
**
** When the virtual-table mechanism stabilizes, we will declare the
** interface fixed, support it indefinitely, and remove this comment.
*/
/* /*
** Structures used by the virtual table interface ** Structures used by the virtual table interface
*/ */
@ -7130,10 +7163,10 @@ struct sqlite3_module {
** when the omit flag is true there is no guarantee that the constraint will ** when the omit flag is true there is no guarantee that the constraint will
** not be checked again using byte code.)^ ** not be checked again using byte code.)^
** **
** ^The idxNum and idxPtr values are recorded and passed into the ** ^The idxNum and idxStr values are recorded and passed into the
** [xFilter] method. ** [xFilter] method.
** ^[sqlite3_free()] is used to free idxPtr if and only if ** ^[sqlite3_free()] is used to free idxStr if and only if
** needToFreeIdxPtr is true. ** needToFreeIdxStr is true.
** **
** ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in ** ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in
** the correct order to satisfy the ORDER BY clause so that no separate ** the correct order to satisfy the ORDER BY clause so that no separate
@ -7253,7 +7286,7 @@ struct sqlite3_index_info {
** the [sqlite3_vtab_collation()] interface. For most real-world virtual ** the [sqlite3_vtab_collation()] interface. For most real-world virtual
** tables, the collating sequence of constraints does not matter (for example ** tables, the collating sequence of constraints does not matter (for example
** because the constraints are numeric) and so the sqlite3_vtab_collation() ** because the constraints are numeric) and so the sqlite3_vtab_collation()
** interface is no commonly needed. ** interface is not commonly needed.
*/ */
#define SQLITE_INDEX_CONSTRAINT_EQ 2 #define SQLITE_INDEX_CONSTRAINT_EQ 2
#define SQLITE_INDEX_CONSTRAINT_GT 4 #define SQLITE_INDEX_CONSTRAINT_GT 4
@ -7412,16 +7445,6 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3*, const char *zSQL);
*/ */
SQLITE_API int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg); SQLITE_API int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg);
/*
** The interface to the virtual-table mechanism defined above (back up
** to a comment remarkably similar to this one) is currently considered
** to be experimental. The interface might change in incompatible ways.
** If this is a problem for you, do not use the interface at this time.
**
** When the virtual-table mechanism stabilizes, we will declare the
** interface fixed, support it indefinitely, and remove this comment.
*/
/* /*
** CAPI3REF: A Handle To An Open BLOB ** CAPI3REF: A Handle To An Open BLOB
** KEYWORDS: {BLOB handle} {BLOB handles} ** KEYWORDS: {BLOB handle} {BLOB handles}
@ -9625,7 +9648,7 @@ SQLITE_API int sqlite3_vtab_nochange(sqlite3_context*);
** <li><p> Otherwise, "BINARY" is returned. ** <li><p> Otherwise, "BINARY" is returned.
** </ol> ** </ol>
*/ */
SQLITE_API SQLITE_EXPERIMENTAL const char *sqlite3_vtab_collation(sqlite3_index_info*,int); SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
/* /*
** CAPI3REF: Determine if a virtual table query is DISTINCT ** CAPI3REF: Determine if a virtual table query is DISTINCT
@ -9782,21 +9805,20 @@ SQLITE_API int sqlite3_vtab_in(sqlite3_index_info*, int iCons, int bHandle);
** is undefined and probably harmful. ** is undefined and probably harmful.
** **
** The X parameter in a call to sqlite3_vtab_in_first(X,P) or ** The X parameter in a call to sqlite3_vtab_in_first(X,P) or
** sqlite3_vtab_in_next(X,P) must be one of the parameters to the ** sqlite3_vtab_in_next(X,P) should be one of the parameters to the
** xFilter method which invokes these routines, and specifically ** xFilter method which invokes these routines, and specifically
** a parameter that was previously selected for all-at-once IN constraint ** a parameter that was previously selected for all-at-once IN constraint
** processing use the [sqlite3_vtab_in()] interface in the ** processing use the [sqlite3_vtab_in()] interface in the
** [xBestIndex|xBestIndex method]. ^(If the X parameter is not ** [xBestIndex|xBestIndex method]. ^(If the X parameter is not
** an xFilter argument that was selected for all-at-once IN constraint ** an xFilter argument that was selected for all-at-once IN constraint
** processing, then these routines return [SQLITE_MISUSE])^ or perhaps ** processing, then these routines return [SQLITE_ERROR].)^
** exhibit some other undefined or harmful behavior.
** **
** ^(Use these routines to access all values on the right-hand side ** ^(Use these routines to access all values on the right-hand side
** of the IN constraint using code like the following: ** of the IN constraint using code like the following:
** **
** <blockquote><pre> ** <blockquote><pre>
** &nbsp; for(rc=sqlite3_vtab_in_first(pList, &pVal); ** &nbsp; for(rc=sqlite3_vtab_in_first(pList, &pVal);
** &nbsp; rc==SQLITE_OK && pVal ** &nbsp; rc==SQLITE_OK && pVal;
** &nbsp; rc=sqlite3_vtab_in_next(pList, &pVal) ** &nbsp; rc=sqlite3_vtab_in_next(pList, &pVal)
** &nbsp; ){ ** &nbsp; ){
** &nbsp; // do something with pVal ** &nbsp; // do something with pVal
@ -9894,6 +9916,10 @@ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **
** managed by the prepared statement S and will be automatically freed when ** managed by the prepared statement S and will be automatically freed when
** S is finalized. ** S is finalized.
** **
** Not all values are available for all query elements. When a value is
** not available, the output variable is set to -1 if the value is numeric,
** or to NULL if it is a string (SQLITE_SCANSTAT_NAME).
**
** <dl> ** <dl>
** [[SQLITE_SCANSTAT_NLOOP]] <dt>SQLITE_SCANSTAT_NLOOP</dt> ** [[SQLITE_SCANSTAT_NLOOP]] <dt>SQLITE_SCANSTAT_NLOOP</dt>
** <dd>^The [sqlite3_int64] variable pointed to by the V parameter will be ** <dd>^The [sqlite3_int64] variable pointed to by the V parameter will be
@ -9921,12 +9947,24 @@ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **
** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN] ** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN]
** description for the X-th loop. ** description for the X-th loop.
** **
** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECT</dt> ** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECTID</dt>
** <dd>^The "int" variable pointed to by the V parameter will be set to the ** <dd>^The "int" variable pointed to by the V parameter will be set to the
** "select-id" for the X-th loop. The select-id identifies which query or ** id for the X-th query plan element. The id value is unique within the
** subquery the loop is part of. The main query has a select-id of zero. ** statement. The select-id is the same value as is output in the first
** The select-id is the same value as is output in the first column ** column of an [EXPLAIN QUERY PLAN] query.
** of an [EXPLAIN QUERY PLAN] query. **
** [[SQLITE_SCANSTAT_PARENTID]] <dt>SQLITE_SCANSTAT_PARENTID</dt>
** <dd>The "int" variable pointed to by the V parameter will be set to the
** the id of the parent of the current query element, if applicable, or
** to zero if the query element has no parent. This is the same value as
** returned in the second column of an [EXPLAIN QUERY PLAN] query.
**
** [[SQLITE_SCANSTAT_NCYCLE]] <dt>SQLITE_SCANSTAT_NCYCLE</dt>
** <dd>The sqlite3_int64 output value is set to the number of cycles,
** according to the processor time-stamp counter, that elapsed while the
** query element was being processed. This value is not available for
** all query elements - if it is unavailable the output variable is
** set to -1.
** </dl> ** </dl>
*/ */
#define SQLITE_SCANSTAT_NLOOP 0 #define SQLITE_SCANSTAT_NLOOP 0
@ -9935,12 +9973,14 @@ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **
#define SQLITE_SCANSTAT_NAME 3 #define SQLITE_SCANSTAT_NAME 3
#define SQLITE_SCANSTAT_EXPLAIN 4 #define SQLITE_SCANSTAT_EXPLAIN 4
#define SQLITE_SCANSTAT_SELECTID 5 #define SQLITE_SCANSTAT_SELECTID 5
#define SQLITE_SCANSTAT_PARENTID 6
#define SQLITE_SCANSTAT_NCYCLE 7
/* /*
** CAPI3REF: Prepared Statement Scan Status ** CAPI3REF: Prepared Statement Scan Status
** METHOD: sqlite3_stmt ** METHOD: sqlite3_stmt
** **
** This interface returns information about the predicted and measured ** These interfaces return information about the predicted and measured
** performance for pStmt. Advanced applications can use this ** performance for pStmt. Advanced applications can use this
** interface to compare the predicted and the measured performance and ** interface to compare the predicted and the measured performance and
** issue warnings and/or rerun [ANALYZE] if discrepancies are found. ** issue warnings and/or rerun [ANALYZE] if discrepancies are found.
@ -9951,19 +9991,25 @@ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **
** **
** The "iScanStatusOp" parameter determines which status information to return. ** The "iScanStatusOp" parameter determines which status information to return.
** The "iScanStatusOp" must be one of the [scanstatus options] or the behavior ** The "iScanStatusOp" must be one of the [scanstatus options] or the behavior
** of this interface is undefined. ** of this interface is undefined. ^The requested measurement is written into
** ^The requested measurement is written into a variable pointed to by ** a variable pointed to by the "pOut" parameter.
** the "pOut" parameter.
** Parameter "idx" identifies the specific loop to retrieve statistics for.
** Loops are numbered starting from zero. ^If idx is out of range - less than
** zero or greater than or equal to the total number of loops used to implement
** the statement - a non-zero value is returned and the variable that pOut
** points to is unchanged.
** **
** ^Statistics might not be available for all loops in all statements. ^In cases ** The "flags" parameter must be passed a mask of flags. At present only
** where there exist loops with no available statistics, this function behaves ** one flag is defined - SQLITE_SCANSTAT_COMPLEX. If SQLITE_SCANSTAT_COMPLEX
** as if the loop did not exist - it returns non-zero and leave the variable ** is specified, then status information is available for all elements
** that pOut points to unchanged. ** of a query plan that are reported by "EXPLAIN QUERY PLAN" output. If
** SQLITE_SCANSTAT_COMPLEX is not specified, then only query plan elements
** that correspond to query loops (the "SCAN..." and "SEARCH..." elements of
** the EXPLAIN QUERY PLAN output) are available. Invoking API
** sqlite3_stmt_scanstatus() is equivalent to calling
** sqlite3_stmt_scanstatus_v2() with a zeroed flags parameter.
**
** Parameter "idx" identifies the specific query element to retrieve statistics
** for. Query elements are numbered starting from zero. A value of -1 may be
** to query for statistics regarding the entire query. ^If idx is out of range
** - less than -1 or greater than or equal to the total number of query
** elements used to implement the statement - a non-zero value is returned and
** the variable that pOut points to is unchanged.
** **
** See also: [sqlite3_stmt_scanstatus_reset()] ** See also: [sqlite3_stmt_scanstatus_reset()]
*/ */
@ -9973,6 +10019,19 @@ SQLITE_API int sqlite3_stmt_scanstatus(
int iScanStatusOp, /* Information desired. SQLITE_SCANSTAT_* */ int iScanStatusOp, /* Information desired. SQLITE_SCANSTAT_* */
void *pOut /* Result written here */ void *pOut /* Result written here */
); );
SQLITE_API int sqlite3_stmt_scanstatus_v2(
sqlite3_stmt *pStmt, /* Prepared statement for which info desired */
int idx, /* Index of loop to report on */
int iScanStatusOp, /* Information desired. SQLITE_SCANSTAT_* */
int flags, /* Mask of flags defined below */
void *pOut /* Result written here */
);
/*
** CAPI3REF: Prepared Statement Scan Status
** KEYWORDS: {scan status flags}
*/
#define SQLITE_SCANSTAT_COMPLEX 0x0001
/* /*
** CAPI3REF: Zero Scan-Status Counters ** CAPI3REF: Zero Scan-Status Counters
@ -10063,6 +10122,10 @@ SQLITE_API int sqlite3_db_cacheflush(sqlite3*);
** function is not defined for operations on WITHOUT ROWID tables, or for ** function is not defined for operations on WITHOUT ROWID tables, or for
** DELETE operations on rowid tables. ** DELETE operations on rowid tables.
** **
** ^The sqlite3_preupdate_hook(D,C,P) function returns the P argument from
** the previous call on the same [database connection] D, or NULL for
** the first call on D.
**
** The [sqlite3_preupdate_old()], [sqlite3_preupdate_new()], ** The [sqlite3_preupdate_old()], [sqlite3_preupdate_new()],
** [sqlite3_preupdate_count()], and [sqlite3_preupdate_depth()] interfaces ** [sqlite3_preupdate_count()], and [sqlite3_preupdate_depth()] interfaces
** provide additional information about a preupdate event. These routines ** provide additional information about a preupdate event. These routines
@ -10468,6 +10531,19 @@ SQLITE_API int sqlite3_deserialize(
# undef double # undef double
#endif #endif
#if defined(__wasi__)
# undef SQLITE_WASI
# define SQLITE_WASI 1
# undef SQLITE_OMIT_WAL
# define SQLITE_OMIT_WAL 1/* because it requires shared memory APIs */
# ifndef SQLITE_OMIT_LOAD_EXTENSION
# define SQLITE_OMIT_LOAD_EXTENSION
# endif
# ifndef SQLITE_THREADSAFE
# define SQLITE_THREADSAFE 0
# endif
#endif
#ifdef __cplusplus #ifdef __cplusplus
} /* End of the 'extern "C"' block */ } /* End of the 'extern "C"' block */
#endif #endif

View File

@ -359,6 +359,8 @@ struct sqlite3_api_routines {
const char *(*db_name)(sqlite3*,int); const char *(*db_name)(sqlite3*,int);
/* Version 3.40.0 and later */ /* Version 3.40.0 and later */
int (*value_encoding)(sqlite3_value*); int (*value_encoding)(sqlite3_value*);
/* Version 3.41.0 and later */
int (*is_interrupted)(sqlite3*);
}; };
/* /*
@ -685,6 +687,8 @@ typedef int (*sqlite3_loadext_entry)(
#define sqlite3_db_name sqlite3_api->db_name #define sqlite3_db_name sqlite3_api->db_name
/* Version 3.40.0 and later */ /* Version 3.40.0 and later */
#define sqlite3_value_encoding sqlite3_api->value_encoding #define sqlite3_value_encoding sqlite3_api->value_encoding
/* Version 3.41.0 and later */
#define sqlite3_is_interrupted sqlite3_api->is_interrupted
#endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */ #endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)