Merge pull request #1381 from gwenn/3.43.0

Upgrade SQLite bundled version to 3.43.0
This commit is contained in:
gwenn 2023-08-26 13:08:10 +02:00 committed by GitHub
commit 714ce2e171
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 5934 additions and 2696 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

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.42.0" #define SQLITE_VERSION "3.43.0"
#define SQLITE_VERSION_NUMBER 3042000 #define SQLITE_VERSION_NUMBER 3043000
#define SQLITE_SOURCE_ID "2023-05-16 12:36:15 831d0fb2836b71c9bc51067c49fee4b8f18047814f2ff22d817d25195cf350b0" #define SQLITE_SOURCE_ID "2023-08-24 12:36:59 0f80b798b3f4b81a7bb4233c58294edd0f1156f36b6ecf5ab8e83631d468778c"
/* /*
** CAPI3REF: Run-Time Library Version Numbers ** CAPI3REF: Run-Time Library Version Numbers
@ -528,6 +528,7 @@ SQLITE_API int sqlite3_exec(
#define SQLITE_IOERR_ROLLBACK_ATOMIC (SQLITE_IOERR | (31<<8)) #define SQLITE_IOERR_ROLLBACK_ATOMIC (SQLITE_IOERR | (31<<8))
#define SQLITE_IOERR_DATA (SQLITE_IOERR | (32<<8)) #define SQLITE_IOERR_DATA (SQLITE_IOERR | (32<<8))
#define SQLITE_IOERR_CORRUPTFS (SQLITE_IOERR | (33<<8)) #define SQLITE_IOERR_CORRUPTFS (SQLITE_IOERR | (33<<8))
#define SQLITE_IOERR_IN_PAGE (SQLITE_IOERR | (34<<8))
#define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8)) #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8))
#define SQLITE_LOCKED_VTAB (SQLITE_LOCKED | (2<<8)) #define SQLITE_LOCKED_VTAB (SQLITE_LOCKED | (2<<8))
#define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8)) #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8))
@ -1190,7 +1191,7 @@ struct sqlite3_io_methods {
** by clients within the current process, only within other processes. ** by clients within the current process, only within other processes.
** **
** <li>[[SQLITE_FCNTL_CKSM_FILE]] ** <li>[[SQLITE_FCNTL_CKSM_FILE]]
** The [SQLITE_FCNTL_CKSM_FILE] opcode is for use interally by the ** The [SQLITE_FCNTL_CKSM_FILE] opcode is for use internally by the
** [checksum VFS shim] only. ** [checksum VFS shim] only.
** **
** <li>[[SQLITE_FCNTL_RESET_CACHE]] ** <li>[[SQLITE_FCNTL_RESET_CACHE]]
@ -2454,7 +2455,7 @@ struct sqlite3_mem_methods {
** the [VACUUM] command will fail with an obscure error when attempting to ** the [VACUUM] command will fail with an obscure error when attempting to
** process a table with generated columns and a descending index. This is ** process a table with generated columns and a descending index. This is
** not considered a bug since SQLite versions 3.3.0 and earlier do not support ** not considered a bug since SQLite versions 3.3.0 and earlier do not support
** either generated columns or decending indexes. ** either generated columns or descending indexes.
** </dd> ** </dd>
** **
** [[SQLITE_DBCONFIG_STMT_SCANSTATUS]] ** [[SQLITE_DBCONFIG_STMT_SCANSTATUS]]
@ -2735,6 +2736,7 @@ SQLITE_API sqlite3_int64 sqlite3_total_changes64(sqlite3*);
** **
** ^The [sqlite3_is_interrupted(D)] interface can be used to determine whether ** ^The [sqlite3_is_interrupted(D)] interface can be used to determine whether
** or not an interrupt is currently in effect for [database connection] D. ** or not an interrupt is currently in effect for [database connection] D.
** It returns 1 if an interrupt is currently in effect, or 0 otherwise.
*/ */
SQLITE_API void sqlite3_interrupt(sqlite3*); SQLITE_API void sqlite3_interrupt(sqlite3*);
SQLITE_API int sqlite3_is_interrupted(sqlite3*); SQLITE_API int sqlite3_is_interrupted(sqlite3*);
@ -3388,8 +3390,10 @@ SQLITE_API SQLITE_DEPRECATED void *sqlite3_profile(sqlite3*,
** M argument should be the bitwise OR-ed combination of ** M argument should be the bitwise OR-ed combination of
** zero or more [SQLITE_TRACE] constants. ** zero or more [SQLITE_TRACE] constants.
** **
** ^Each call to either sqlite3_trace() or sqlite3_trace_v2() overrides ** ^Each call to either sqlite3_trace(D,X,P) or sqlite3_trace_v2(D,M,X,P)
** (cancels) any prior calls to sqlite3_trace() or sqlite3_trace_v2(). ** overrides (cancels) all prior calls to sqlite3_trace(D,X,P) or
** sqlite3_trace_v2(D,M,X,P) for the [database connection] D. Each
** database connection may have at most one trace callback.
** **
** ^The X callback is invoked whenever any of the events identified by ** ^The X callback is invoked whenever any of the events identified by
** mask M occur. ^The integer return value from the callback is currently ** mask M occur. ^The integer return value from the callback is currently
@ -3758,7 +3762,7 @@ SQLITE_API int sqlite3_open_v2(
** as F) must be one of: ** as F) must be one of:
** <ul> ** <ul>
** <li> A database filename pointer created by the SQLite core and ** <li> A database filename pointer created by the SQLite core and
** passed into the xOpen() method of a VFS implemention, or ** passed into the xOpen() method of a VFS implementation, or
** <li> A filename obtained from [sqlite3_db_filename()], or ** <li> A filename obtained from [sqlite3_db_filename()], or
** <li> A new filename constructed using [sqlite3_create_filename()]. ** <li> A new filename constructed using [sqlite3_create_filename()].
** </ul> ** </ul>
@ -3871,7 +3875,7 @@ SQLITE_API sqlite3_file *sqlite3_database_file_object(const char*);
/* /*
** CAPI3REF: Create and Destroy VFS Filenames ** CAPI3REF: Create and Destroy VFS Filenames
** **
** These interfces are provided for use by [VFS shim] implementations and ** These interfaces are provided for use by [VFS shim] implementations and
** are not useful outside of that context. ** are not useful outside of that context.
** **
** The sqlite3_create_filename(D,J,W,N,P) allocates memory to hold a version of ** The sqlite3_create_filename(D,J,W,N,P) allocates memory to hold a version of
@ -4418,6 +4422,41 @@ SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
*/ */
SQLITE_API int sqlite3_stmt_isexplain(sqlite3_stmt *pStmt); SQLITE_API int sqlite3_stmt_isexplain(sqlite3_stmt *pStmt);
/*
** CAPI3REF: Change The EXPLAIN Setting For A Prepared Statement
** METHOD: sqlite3_stmt
**
** The sqlite3_stmt_explain(S,E) interface changes the EXPLAIN
** setting for [prepared statement] S. If E is zero, then S becomes
** a normal prepared statement. If E is 1, then S behaves as if
** its SQL text began with "[EXPLAIN]". If E is 2, then S behaves as if
** its SQL text began with "[EXPLAIN QUERY PLAN]".
**
** Calling sqlite3_stmt_explain(S,E) might cause S to be reprepared.
** SQLite tries to avoid a reprepare, but a reprepare might be necessary
** on the first transition into EXPLAIN or EXPLAIN QUERY PLAN mode.
**
** Because of the potential need to reprepare, a call to
** sqlite3_stmt_explain(S,E) will fail with SQLITE_ERROR if S cannot be
** reprepared because it was created using [sqlite3_prepare()] instead of
** the newer [sqlite3_prepare_v2()] or [sqlite3_prepare_v3()] interfaces and
** hence has no saved SQL text with which to reprepare.
**
** Changing the explain setting for a prepared statement does not change
** the original SQL text for the statement. Hence, if the SQL text originally
** began with EXPLAIN or EXPLAIN QUERY PLAN, but sqlite3_stmt_explain(S,0)
** is called to convert the statement into an ordinary statement, the EXPLAIN
** or EXPLAIN QUERY PLAN keywords will still appear in the sqlite3_sql(S)
** output, even though the statement now acts like a normal SQL statement.
**
** This routine returns SQLITE_OK if the explain mode is successfully
** changed, or an error code if the explain mode could not be changed.
** The explain mode cannot be changed while a statement is active.
** Hence, it is good practice to call [sqlite3_reset(S)]
** immediately prior to calling sqlite3_stmt_explain(S,E).
*/
SQLITE_API int sqlite3_stmt_explain(sqlite3_stmt *pStmt, int eMode);
/* /*
** CAPI3REF: Determine If A Prepared Statement Has Been Reset ** CAPI3REF: Determine If A Prepared Statement Has Been Reset
** METHOD: sqlite3_stmt ** METHOD: sqlite3_stmt
@ -4581,7 +4620,7 @@ typedef struct sqlite3_context sqlite3_context;
** with it may be passed. ^It is called to dispose of the BLOB or string even ** with it may be passed. ^It is called to dispose of the BLOB or string even
** if the call to the bind API fails, except the destructor is not called if ** if the call to the bind API fails, except the destructor is not called if
** the third parameter is a NULL pointer or the fourth parameter is negative. ** the third parameter is a NULL pointer or the fourth parameter is negative.
** ^ (2) The special constant, [SQLITE_STATIC], may be passsed to indicate that ** ^ (2) The special constant, [SQLITE_STATIC], may be passed to indicate that
** the application remains responsible for disposing of the object. ^In this ** the application remains responsible for disposing of the object. ^In this
** case, the object and the provided pointer to it must remain valid until ** case, the object and the provided pointer to it must remain valid until
** either the prepared statement is finalized or the same SQL parameter is ** either the prepared statement is finalized or the same SQL parameter is
@ -5260,14 +5299,26 @@ SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt);
** ^The [sqlite3_reset(S)] interface resets the [prepared statement] S ** ^The [sqlite3_reset(S)] interface resets the [prepared statement] S
** back to the beginning of its program. ** back to the beginning of its program.
** **
** ^If the most recent call to [sqlite3_step(S)] for the ** ^The return code from [sqlite3_reset(S)] indicates whether or not
** [prepared statement] S returned [SQLITE_ROW] or [SQLITE_DONE], ** the previous evaluation of prepared statement S completed successfully.
** or if [sqlite3_step(S)] has never before been called on S, ** ^If [sqlite3_step(S)] has never before been called on S or if
** then [sqlite3_reset(S)] returns [SQLITE_OK]. ** [sqlite3_step(S)] has not been called since the previous call
** to [sqlite3_reset(S)], then [sqlite3_reset(S)] will return
** [SQLITE_OK].
** **
** ^If the most recent call to [sqlite3_step(S)] for the ** ^If the most recent call to [sqlite3_step(S)] for the
** [prepared statement] S indicated an error, then ** [prepared statement] S indicated an error, then
** [sqlite3_reset(S)] returns an appropriate [error code]. ** [sqlite3_reset(S)] returns an appropriate [error code].
** ^The [sqlite3_reset(S)] interface might also return an [error code]
** if there were no prior errors but the process of resetting
** the prepared statement caused a new error. ^For example, if an
** [INSERT] statement with a [RETURNING] clause is only stepped one time,
** that one call to [sqlite3_step(S)] might return SQLITE_ROW but
** the overall statement might still fail and the [sqlite3_reset(S)] call
** might return SQLITE_BUSY if locking constraints prevent the
** database change from committing. Therefore, it is important that
** applications check the return code from [sqlite3_reset(S)] even if
** no prior call to [sqlite3_step(S)] indicated a problem.
** **
** ^The [sqlite3_reset(S)] interface does not change the values ** ^The [sqlite3_reset(S)] interface does not change the values
** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S. ** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S.
@ -5484,7 +5535,7 @@ SQLITE_API int sqlite3_create_window_function(
** [application-defined SQL function] ** [application-defined SQL function]
** that has side-effects or that could potentially leak sensitive information. ** that has side-effects or that could potentially leak sensitive information.
** This will prevent attacks in which an application is tricked ** This will prevent attacks in which an application is tricked
** into using a database file that has had its schema surreptiously ** into using a database file that has had its schema surreptitiously
** modified to invoke the application-defined function in ways that are ** modified to invoke the application-defined function in ways that are
** harmful. ** harmful.
** <p> ** <p>
@ -8161,7 +8212,8 @@ SQLITE_API int sqlite3_test_control(int op, ...);
#define SQLITE_TESTCTRL_TRACEFLAGS 31 #define SQLITE_TESTCTRL_TRACEFLAGS 31
#define SQLITE_TESTCTRL_TUNE 32 #define SQLITE_TESTCTRL_TUNE 32
#define SQLITE_TESTCTRL_LOGEST 33 #define SQLITE_TESTCTRL_LOGEST 33
#define SQLITE_TESTCTRL_LAST 33 /* Largest TESTCTRL */ #define SQLITE_TESTCTRL_USELONGDOUBLE 34
#define SQLITE_TESTCTRL_LAST 34 /* Largest TESTCTRL */
/* /*
** CAPI3REF: SQL Keyword Checking ** CAPI3REF: SQL Keyword Checking
@ -9193,8 +9245,8 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p);
** blocked connection already has a registered unlock-notify callback, ** blocked connection already has a registered unlock-notify callback,
** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is ** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is
** called with a NULL pointer as its second argument, then any existing ** called with a NULL pointer as its second argument, then any existing
** unlock-notify callback is canceled. ^The blocked connections ** unlock-notify callback is cancelled. ^The blocked connections
** unlock-notify callback may also be canceled by closing the blocked ** unlock-notify callback may also be cancelled by closing the blocked
** connection using [sqlite3_close()]. ** connection using [sqlite3_close()].
** **
** The unlock-notify callback is not reentrant. If an application invokes ** The unlock-notify callback is not reentrant. If an application invokes
@ -9617,7 +9669,7 @@ SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);
** [[SQLITE_VTAB_DIRECTONLY]]<dt>SQLITE_VTAB_DIRECTONLY</dt> ** [[SQLITE_VTAB_DIRECTONLY]]<dt>SQLITE_VTAB_DIRECTONLY</dt>
** <dd>Calls of the form ** <dd>Calls of the form
** [sqlite3_vtab_config](db,SQLITE_VTAB_DIRECTONLY) from within the ** [sqlite3_vtab_config](db,SQLITE_VTAB_DIRECTONLY) from within the
** the [xConnect] or [xCreate] methods of a [virtual table] implmentation ** the [xConnect] or [xCreate] methods of a [virtual table] implementation
** prohibits that virtual table from being used from within triggers and ** prohibits that virtual table from being used from within triggers and
** views. ** views.
** </dd> ** </dd>
@ -9807,7 +9859,7 @@ SQLITE_API int sqlite3_vtab_distinct(sqlite3_index_info*);
** communicated to the xBestIndex method as a ** communicated to the xBestIndex method as a
** [SQLITE_INDEX_CONSTRAINT_EQ] constraint.)^ If xBestIndex wants to use ** [SQLITE_INDEX_CONSTRAINT_EQ] constraint.)^ If xBestIndex wants to use
** this constraint, it must set the corresponding ** this constraint, it must set the corresponding
** aConstraintUsage[].argvIndex to a postive integer. ^(Then, under ** aConstraintUsage[].argvIndex to a positive integer. ^(Then, under
** the usual mode of handling IN operators, SQLite generates [bytecode] ** the usual mode of handling IN operators, SQLite generates [bytecode]
** that invokes the [xFilter|xFilter() method] once for each value ** that invokes the [xFilter|xFilter() method] once for each value
** on the right-hand side of the IN operator.)^ Thus the virtual table ** on the right-hand side of the IN operator.)^ Thus the virtual table
@ -10236,7 +10288,7 @@ SQLITE_API int sqlite3_db_cacheflush(sqlite3*);
** When the [sqlite3_blob_write()] API is used to update a blob column, ** When the [sqlite3_blob_write()] API is used to update a blob column,
** the pre-update hook is invoked with SQLITE_DELETE. This is because the ** the pre-update hook is invoked with SQLITE_DELETE. This is because the
** in this case the new values are not available. In this case, when a ** in this case the new values are not available. In this case, when a
** callback made with op==SQLITE_DELETE is actuall a write using the ** callback made with op==SQLITE_DELETE is actually a write using the
** sqlite3_blob_write() API, the [sqlite3_preupdate_blobwrite()] returns ** sqlite3_blob_write() API, the [sqlite3_preupdate_blobwrite()] returns
** the index of the column being written. In other cases, where the ** the index of the column being written. In other cases, where the
** pre-update hook is being invoked for some other reason, including a ** pre-update hook is being invoked for some other reason, including a
@ -12754,7 +12806,7 @@ struct Fts5PhraseIter {
** See xPhraseFirstColumn above. ** See xPhraseFirstColumn above.
*/ */
struct Fts5ExtensionApi { struct Fts5ExtensionApi {
int iVersion; /* Currently always set to 3 */ int iVersion; /* Currently always set to 2 */
void *(*xUserData)(Fts5Context*); void *(*xUserData)(Fts5Context*);
@ -12983,8 +13035,8 @@ struct Fts5ExtensionApi {
** as separate queries of the FTS index are required for each synonym. ** as separate queries of the FTS index are required for each synonym.
** **
** When using methods (2) or (3), it is important that the tokenizer only ** When using methods (2) or (3), it is important that the tokenizer only
** provide synonyms when tokenizing document text (method (2)) or query ** provide synonyms when tokenizing document text (method (3)) or query
** text (method (3)), not both. Doing so will not cause any errors, but is ** text (method (2)), not both. Doing so will not cause any errors, but is
** inefficient. ** inefficient.
*/ */
typedef struct Fts5Tokenizer Fts5Tokenizer; typedef struct Fts5Tokenizer Fts5Tokenizer;
@ -13032,7 +13084,7 @@ struct fts5_api {
int (*xCreateTokenizer)( int (*xCreateTokenizer)(
fts5_api *pApi, fts5_api *pApi,
const char *zName, const char *zName,
void *pContext, void *pUserData,
fts5_tokenizer *pTokenizer, fts5_tokenizer *pTokenizer,
void (*xDestroy)(void*) void (*xDestroy)(void*)
); );
@ -13041,7 +13093,7 @@ struct fts5_api {
int (*xFindTokenizer)( int (*xFindTokenizer)(
fts5_api *pApi, fts5_api *pApi,
const char *zName, const char *zName,
void **ppContext, void **ppUserData,
fts5_tokenizer *pTokenizer fts5_tokenizer *pTokenizer
); );
@ -13049,7 +13101,7 @@ struct fts5_api {
int (*xCreateFunction)( int (*xCreateFunction)(
fts5_api *pApi, fts5_api *pApi,
const char *zName, const char *zName,
void *pContext, void *pUserData,
fts5_extension_function xFunction, fts5_extension_function xFunction,
void (*xDestroy)(void*) void (*xDestroy)(void*)
); );

View File

@ -361,6 +361,8 @@ struct sqlite3_api_routines {
int (*value_encoding)(sqlite3_value*); int (*value_encoding)(sqlite3_value*);
/* Version 3.41.0 and later */ /* Version 3.41.0 and later */
int (*is_interrupted)(sqlite3*); int (*is_interrupted)(sqlite3*);
/* Version 3.43.0 and later */
int (*stmt_explain)(sqlite3_stmt*,int);
}; };
/* /*
@ -689,6 +691,8 @@ typedef int (*sqlite3_loadext_entry)(
#define sqlite3_value_encoding sqlite3_api->value_encoding #define sqlite3_value_encoding sqlite3_api->value_encoding
/* Version 3.41.0 and later */ /* Version 3.41.0 and later */
#define sqlite3_is_interrupted sqlite3_api->is_interrupted #define sqlite3_is_interrupted sqlite3_api->is_interrupted
/* Version 3.43.0 and later */
#define sqlite3_stmt_explain sqlite3_api->stmt_explain
#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)

View File

@ -9,7 +9,7 @@ export SQLITE3_LIB_DIR="$SCRIPT_DIR/sqlite3"
export SQLITE3_INCLUDE_DIR="$SQLITE3_LIB_DIR" export SQLITE3_INCLUDE_DIR="$SQLITE3_LIB_DIR"
# Download and extract amalgamation # Download and extract amalgamation
SQLITE=sqlite-amalgamation-3420000 SQLITE=sqlite-amalgamation-3430000
curl -O https://sqlite.org/2023/$SQLITE.zip curl -O https://sqlite.org/2023/$SQLITE.zip
unzip -p "$SQLITE.zip" "$SQLITE/sqlite3.c" > "$SQLITE3_LIB_DIR/sqlite3.c" unzip -p "$SQLITE.zip" "$SQLITE/sqlite3.c" > "$SQLITE3_LIB_DIR/sqlite3.c"
unzip -p "$SQLITE.zip" "$SQLITE/sqlite3.h" > "$SQLITE3_LIB_DIR/sqlite3.h" unzip -p "$SQLITE.zip" "$SQLITE/sqlite3.h" > "$SQLITE3_LIB_DIR/sqlite3.h"

View File

@ -142,7 +142,9 @@ mod test {
let db = Connection::open_in_memory()?; let db = Connection::open_in_memory()?;
db.execute_batch("CREATE TABLE x AS SELECT 'data'")?; db.execute_batch("CREATE TABLE x AS SELECT 'data'")?;
let data = db.serialize(DatabaseName::Main)?; let data = db.serialize(DatabaseName::Main)?;
let Data::Owned(data) = data else { panic!("expected OwnedData")}; let Data::Owned(data) = data else {
panic!("expected OwnedData")
};
assert!(data.sz > 0); assert!(data.sz > 0);
Ok(()) Ok(())
} }
@ -152,7 +154,9 @@ mod test {
let src = Connection::open_in_memory()?; let src = Connection::open_in_memory()?;
src.execute_batch("CREATE TABLE x AS SELECT 'data'")?; src.execute_batch("CREATE TABLE x AS SELECT 'data'")?;
let data = src.serialize(DatabaseName::Main)?; let data = src.serialize(DatabaseName::Main)?;
let Data::Owned(data) = data else { panic!("expected OwnedData")}; let Data::Owned(data) = data else {
panic!("expected OwnedData")
};
let mut dst = Connection::open_in_memory()?; let mut dst = Connection::open_in_memory()?;
dst.deserialize(DatabaseName::Main, data, false)?; dst.deserialize(DatabaseName::Main, data, false)?;