Upgrade bundled version to SQLite 3.25.0

This commit is contained in:
gwenn 2018-09-17 18:42:19 +02:00
parent bd1756adef
commit fde3a59488
7 changed files with 14795 additions and 7084 deletions

View File

@ -16,10 +16,10 @@ install:
- rustc -V - rustc -V
- cargo -V - cargo -V
# download SQLite dll (useful only when the `bundled` feature is not set) # download SQLite dll (useful only when the `bundled` feature is not set)
- appveyor-retry appveyor DownloadFile https://sqlite.org/2018/sqlite-dll-win64-x64-3240000.zip -FileName sqlite-dll-win64-x64.zip - appveyor-retry appveyor DownloadFile https://sqlite.org/2018/sqlite-dll-win64-x64-3250000.zip -FileName sqlite-dll-win64-x64.zip
- if not defined VCPKG_DEFAULT_TRIPLET 7z e sqlite-dll-win64-x64.zip -y > nul - if not defined VCPKG_DEFAULT_TRIPLET 7z e sqlite-dll-win64-x64.zip -y > nul
# download SQLite headers (useful only when the `bundled` feature is not set) # download SQLite headers (useful only when the `bundled` feature is not set)
- appveyor-retry appveyor DownloadFile https://sqlite.org/2018/sqlite-amalgamation-3240000.zip -FileName sqlite-amalgamation.zip - appveyor-retry appveyor DownloadFile https://sqlite.org/2018/sqlite-amalgamation-3250000.zip -FileName sqlite-amalgamation.zip
- if not defined VCPKG_DEFAULT_TRIPLET 7z e sqlite-amalgamation.zip -y > nul - if not defined VCPKG_DEFAULT_TRIPLET 7z e sqlite-amalgamation.zip -y > nul
# specify where the SQLite dll has been downloaded (useful only when the `bundled` feature is not set) # specify where the SQLite dll has been downloaded (useful only when the `bundled` feature is not set)
- if not defined VCPKG_DEFAULT_TRIPLET SET SQLITE3_LIB_DIR=%APPVEYOR_BUILD_FOLDER% - if not defined VCPKG_DEFAULT_TRIPLET SET SQLITE3_LIB_DIR=%APPVEYOR_BUILD_FOLDER%

View File

@ -1,6 +1,6 @@
[package] [package]
name = "libsqlite3-sys" name = "libsqlite3-sys"
version = "0.9.3" version = "0.9.4"
authors = ["John Gallagher <jgallagher@bignerdranch.com>"] authors = ["John Gallagher <jgallagher@bignerdranch.com>"]
repository = "https://github.com/jgallagher/rusqlite" repository = "https://github.com/jgallagher/rusqlite"
description = "Native bindings to the libsqlite3 library" description = "Native bindings to the libsqlite3 library"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -123,9 +123,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.24.0" #define SQLITE_VERSION "3.25.0"
#define SQLITE_VERSION_NUMBER 3024000 #define SQLITE_VERSION_NUMBER 3025000
#define SQLITE_SOURCE_ID "2018-06-04 19:24:41 c7ee0833225bfd8c5ec2f9bf62b97c4e04d03bd9566366d5221ac8fb199a87ca" #define SQLITE_SOURCE_ID "2018-09-15 04:01:47 b63af6c3bd33152742648d5d2e8dc5d5fcbcdd27df409272b6aea00a6f761760"
/* /*
** CAPI3REF: Run-Time Library Version Numbers ** CAPI3REF: Run-Time Library Version Numbers
@ -472,6 +472,7 @@ SQLITE_API int sqlite3_exec(
*/ */
#define SQLITE_ERROR_MISSING_COLLSEQ (SQLITE_ERROR | (1<<8)) #define SQLITE_ERROR_MISSING_COLLSEQ (SQLITE_ERROR | (1<<8))
#define SQLITE_ERROR_RETRY (SQLITE_ERROR | (2<<8)) #define SQLITE_ERROR_RETRY (SQLITE_ERROR | (2<<8))
#define SQLITE_ERROR_SNAPSHOT (SQLITE_ERROR | (3<<8))
#define SQLITE_IOERR_READ (SQLITE_IOERR | (1<<8)) #define SQLITE_IOERR_READ (SQLITE_IOERR | (1<<8))
#define SQLITE_IOERR_SHORT_READ (SQLITE_IOERR | (2<<8)) #define SQLITE_IOERR_SHORT_READ (SQLITE_IOERR | (2<<8))
#define SQLITE_IOERR_WRITE (SQLITE_IOERR | (3<<8)) #define SQLITE_IOERR_WRITE (SQLITE_IOERR | (3<<8))
@ -511,6 +512,7 @@ SQLITE_API int sqlite3_exec(
#define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8))
#define SQLITE_CANTOPEN_FULLPATH (SQLITE_CANTOPEN | (3<<8)) #define SQLITE_CANTOPEN_FULLPATH (SQLITE_CANTOPEN | (3<<8))
#define SQLITE_CANTOPEN_CONVPATH (SQLITE_CANTOPEN | (4<<8)) #define SQLITE_CANTOPEN_CONVPATH (SQLITE_CANTOPEN | (4<<8))
#define SQLITE_CANTOPEN_DIRTYWAL (SQLITE_CANTOPEN | (5<<8)) /* Not Used */
#define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1<<8)) #define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1<<8))
#define SQLITE_CORRUPT_SEQUENCE (SQLITE_CORRUPT | (2<<8)) #define SQLITE_CORRUPT_SEQUENCE (SQLITE_CORRUPT | (2<<8))
#define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8)) #define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8))
@ -886,7 +888,8 @@ struct sqlite3_io_methods {
** <li>[[SQLITE_FCNTL_PERSIST_WAL]] ** <li>[[SQLITE_FCNTL_PERSIST_WAL]]
** ^The [SQLITE_FCNTL_PERSIST_WAL] opcode is used to set or query the ** ^The [SQLITE_FCNTL_PERSIST_WAL] opcode is used to set or query the
** persistent [WAL | Write Ahead Log] setting. By default, the auxiliary ** persistent [WAL | Write Ahead Log] setting. By default, the auxiliary
** write ahead log and shared memory files used for transaction control ** write ahead log ([WAL file]) and shared memory
** files used for transaction control
** are automatically deleted when the latest connection to the database ** are automatically deleted when the latest connection to the database
** closes. Setting persistent WAL mode causes those files to persist after ** closes. Setting persistent WAL mode causes those files to persist after
** close. Persisting the files is useful when other processes that do not ** close. Persisting the files is useful when other processes that do not
@ -1072,6 +1075,26 @@ struct sqlite3_io_methods {
** a file lock using the xLock or xShmLock methods of the VFS to wait ** a file lock using the xLock or xShmLock methods of the VFS to wait
** for up to M milliseconds before failing, where M is the single ** for up to M milliseconds before failing, where M is the single
** unsigned integer parameter. ** unsigned integer parameter.
**
** <li>[[SQLITE_FCNTL_DATA_VERSION]]
** The [SQLITE_FCNTL_DATA_VERSION] opcode is used to detect changes to
** a database file. The argument is a pointer to a 32-bit unsigned integer.
** The "data version" for the pager is written into the pointer. The
** "data version" changes whenever any change occurs to the corresponding
** database file, either through SQL statements on the same database
** connection or through transactions committed by separate database
** connections possibly in other processes. The [sqlite3_total_changes()]
** interface can be used to find if any database on the connection has changed,
** but that interface responds to changes on TEMP as well as MAIN and does
** not provide a mechanism to detect changes to MAIN only. Also, the
** [sqlite3_total_changes()] interface responds to internal changes only and
** omits changes made by other database connections. The
** [PRAGMA data_version] command provide a mechanism to detect changes to
** a single attached database that occur due to other database connections,
** but omits changes implemented by the database connection on which it is
** called. This file control is the only mechanism to detect changes that
** happen either internally or externally and that are associated with
** a particular attached database.
** </ul> ** </ul>
*/ */
#define SQLITE_FCNTL_LOCKSTATE 1 #define SQLITE_FCNTL_LOCKSTATE 1
@ -1107,6 +1130,7 @@ struct sqlite3_io_methods {
#define SQLITE_FCNTL_COMMIT_ATOMIC_WRITE 32 #define SQLITE_FCNTL_COMMIT_ATOMIC_WRITE 32
#define SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE 33 #define SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE 33
#define SQLITE_FCNTL_LOCK_TIMEOUT 34 #define SQLITE_FCNTL_LOCK_TIMEOUT 34
#define SQLITE_FCNTL_DATA_VERSION 35
/* deprecated names */ /* deprecated names */
#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE #define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
@ -2121,6 +2145,12 @@ struct sqlite3_mem_methods {
** with no schema and no content. The following process works even for ** with no schema and no content. The following process works even for
** a badly corrupted database file: ** a badly corrupted database file:
** <ol> ** <ol>
** <li> If the database connection is newly opened, make sure it has read the
** database schema by preparing then discarding some query against the
** database, or calling sqlite3_table_column_metadata(), ignoring any
** errors. This step is only necessary if the application desires to keep
** the database in WAL mode after the reset if it was in WAL mode before
** the reset.
** <li> sqlite3_db_config(db, SQLITE_DBCONFIG_RESET_DATABASE, 1, 0); ** <li> sqlite3_db_config(db, SQLITE_DBCONFIG_RESET_DATABASE, 1, 0);
** <li> [sqlite3_exec](db, "[VACUUM]", 0, 0, 0); ** <li> [sqlite3_exec](db, "[VACUUM]", 0, 0, 0);
** <li> sqlite3_db_config(db, SQLITE_DBCONFIG_RESET_DATABASE, 0, 0); ** <li> sqlite3_db_config(db, SQLITE_DBCONFIG_RESET_DATABASE, 0, 0);
@ -2269,12 +2299,17 @@ SQLITE_API void sqlite3_set_last_insert_rowid(sqlite3*,sqlite3_int64);
** program, the value returned reflects the number of rows modified by the ** program, the value returned reflects the number of rows modified by the
** previous INSERT, UPDATE or DELETE statement within the same trigger. ** previous INSERT, UPDATE or DELETE statement within the same trigger.
** **
** See also the [sqlite3_total_changes()] interface, the
** [count_changes pragma], and the [changes() SQL function].
**
** If a separate thread makes changes on the same database connection ** If a separate thread makes changes on the same database connection
** while [sqlite3_changes()] is running then the value returned ** while [sqlite3_changes()] is running then the value returned
** is unpredictable and not meaningful. ** is unpredictable and not meaningful.
**
** See also:
** <ul>
** <li> the [sqlite3_total_changes()] interface
** <li> the [count_changes pragma]
** <li> the [changes() SQL function]
** <li> the [data_version pragma]
** </ul>
*/ */
SQLITE_API int sqlite3_changes(sqlite3*); SQLITE_API int sqlite3_changes(sqlite3*);
@ -2293,12 +2328,25 @@ SQLITE_API int sqlite3_changes(sqlite3*);
** not. ^Changes to a view that are intercepted by INSTEAD OF triggers ** not. ^Changes to a view that are intercepted by INSTEAD OF triggers
** are not counted. ** are not counted.
** **
** See also the [sqlite3_changes()] interface, the ** This the [sqlite3_total_changes(D)] interface only reports the number
** [count_changes pragma], and the [total_changes() SQL function]. ** of rows that changed due to SQL statement run against database
** connection D. Any changes by other database connections are ignored.
** To detect changes against a database file from other database
** connections use the [PRAGMA data_version] command or the
** [SQLITE_FCNTL_DATA_VERSION] [file control].
** **
** If a separate thread makes changes on the same database connection ** If a separate thread makes changes on the same database connection
** while [sqlite3_total_changes()] is running then the value ** while [sqlite3_total_changes()] is running then the value
** returned is unpredictable and not meaningful. ** returned is unpredictable and not meaningful.
**
** See also:
** <ul>
** <li> the [sqlite3_changes()] interface
** <li> the [count_changes pragma]
** <li> the [changes() SQL function]
** <li> the [data_version pragma]
** <li> the [SQLITE_FCNTL_DATA_VERSION] [file control]
** </ul>
*/ */
SQLITE_API int sqlite3_total_changes(sqlite3*); SQLITE_API int sqlite3_total_changes(sqlite3*);
@ -3354,13 +3402,24 @@ SQLITE_API sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int
** [database connection] D failed, then the sqlite3_errcode(D) interface ** [database connection] D failed, then the sqlite3_errcode(D) interface
** returns the numeric [result code] or [extended result code] for that ** returns the numeric [result code] or [extended result code] for that
** API call. ** API call.
** If the most recent API call was successful,
** then the return value from sqlite3_errcode() is undefined.
** ^The sqlite3_extended_errcode() ** ^The sqlite3_extended_errcode()
** interface is the same except that it always returns the ** interface is the same except that it always returns the
** [extended result code] even when extended result codes are ** [extended result code] even when extended result codes are
** disabled. ** disabled.
** **
** The values returned by sqlite3_errcode() and/or
** sqlite3_extended_errcode() might change with each API call.
** Except, there are some interfaces that are guaranteed to never
** change the value of the error code. The error-code preserving
** interfaces are:
**
** <ul>
** <li> sqlite3_errcode()
** <li> sqlite3_extended_errcode()
** <li> sqlite3_errmsg()
** <li> sqlite3_errmsg16()
** </ul>
**
** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
** text that describes the error, as either UTF-8 or UTF-16 respectively. ** text that describes the error, as either UTF-8 or UTF-16 respectively.
** ^(Memory to hold the error message string is managed internally. ** ^(Memory to hold the error message string is managed internally.
@ -4514,11 +4573,25 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
** from [sqlite3_column_blob()], [sqlite3_column_text()], etc. into ** from [sqlite3_column_blob()], [sqlite3_column_text()], etc. into
** [sqlite3_free()]. ** [sqlite3_free()].
** **
** ^(If a memory allocation error occurs during the evaluation of any ** As long as the input parameters are correct, these routines will only
** of these routines, a default value is returned. The default value ** fail if an out-of-memory error occurs during a format conversion.
** is either the integer 0, the floating point number 0.0, or a NULL ** Only the following subset of interfaces are subject to out-of-memory
** pointer. Subsequent calls to [sqlite3_errcode()] will return ** errors:
** [SQLITE_NOMEM].)^ **
** <ul>
** <li> sqlite3_column_blob()
** <li> sqlite3_column_text()
** <li> sqlite3_column_text16()
** <li> sqlite3_column_bytes()
** <li> sqlite3_column_bytes16()
** </ul>
**
** If an out-of-memory error occurs, then the return value from these
** routines is the same as if the column had contained an SQL NULL value.
** Valid SQL NULL returns can be distinguished from out-of-memory errors
** by invoking the [sqlite3_errcode()] immediately after the suspect
** return value is obtained and before any
** other SQLite interface is called on the same [database connection].
*/ */
SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol); SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol);
SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol); SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol);
@ -4596,10 +4669,12 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
** ^These functions (collectively known as "function creation routines") ** ^These functions (collectively known as "function creation routines")
** are used to add SQL functions or aggregates or to redefine the behavior ** are used to add SQL functions or aggregates or to redefine the behavior
** of existing SQL functions or aggregates. The only differences between ** of existing SQL functions or aggregates. The only differences between
** these routines are the text encoding expected for ** the three "sqlite3_create_function*" routines are the text encoding
** the second parameter (the name of the function being created) ** expected for the second parameter (the name of the function being
** and the presence or absence of a destructor callback for ** created) and the presence or absence of a destructor callback for
** the application data pointer. ** the application data pointer. Function sqlite3_create_window_function()
** is similar, but allows the user to supply the extra callback functions
** needed by [aggregate window functions].
** **
** ^The first parameter is the [database connection] to which the SQL ** ^The first parameter is the [database connection] to which the SQL
** function is to be added. ^If an application uses more than one database ** function is to be added. ^If an application uses more than one database
@ -4645,7 +4720,8 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
** ^(The fifth parameter is an arbitrary pointer. The implementation of the ** ^(The fifth parameter is an arbitrary pointer. The implementation of the
** function can gain access to this pointer using [sqlite3_user_data()].)^ ** function can gain access to this pointer using [sqlite3_user_data()].)^
** **
** ^The sixth, seventh and eighth parameters, xFunc, xStep and xFinal, are ** ^The sixth, seventh and eighth parameters passed to the three
** "sqlite3_create_function*" functions, xFunc, xStep and xFinal, are
** pointers to C-language functions that implement the SQL function or ** pointers to C-language functions that implement the SQL function or
** aggregate. ^A scalar SQL function requires an implementation of the xFunc ** aggregate. ^A scalar SQL function requires an implementation of the xFunc
** callback only; NULL pointers must be passed as the xStep and xFinal ** callback only; NULL pointers must be passed as the xStep and xFinal
@ -4654,15 +4730,24 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
** SQL function or aggregate, pass NULL pointers for all three function ** SQL function or aggregate, pass NULL pointers for all three function
** callbacks. ** callbacks.
** **
** ^(If the ninth parameter to sqlite3_create_function_v2() is not NULL, ** ^The sixth, seventh, eighth and ninth parameters (xStep, xFinal, xValue
** then it is destructor for the application data pointer. ** and xInverse) passed to sqlite3_create_window_function are pointers to
** The destructor is invoked when the function is deleted, either by being ** C-language callbacks that implement the new function. xStep and xFinal
** overloaded or when the database connection closes.)^ ** must both be non-NULL. xValue and xInverse may either both be NULL, in
** ^The destructor is also invoked if the call to ** which case a regular aggregate function is created, or must both be
** sqlite3_create_function_v2() fails. ** non-NULL, in which case the new function may be used as either an aggregate
** ^When the destructor callback of the tenth parameter is invoked, it ** or aggregate window function. More details regarding the implementation
** is passed a single argument which is a copy of the application data ** of aggregate window functions are
** pointer which was the fifth parameter to sqlite3_create_function_v2(). ** [user-defined window functions|available here].
**
** ^(If the final parameter to sqlite3_create_function_v2() or
** sqlite3_create_window_function() is not NULL, then it is destructor for
** the application data pointer. The destructor is invoked when the function
** is deleted, either by being overloaded or when the database connection
** closes.)^ ^The destructor is also invoked if the call to
** sqlite3_create_function_v2() fails. ^When the destructor callback is
** invoked, it is passed a single argument which is a copy of the application
** data pointer which was the fifth parameter to sqlite3_create_function_v2().
** **
** ^It is permitted to register multiple implementations of the same ** ^It is permitted to register multiple implementations of the same
** functions with the same name but with either differing numbers of ** functions with the same name but with either differing numbers of
@ -4715,6 +4800,18 @@ SQLITE_API int sqlite3_create_function_v2(
void (*xFinal)(sqlite3_context*), void (*xFinal)(sqlite3_context*),
void(*xDestroy)(void*) void(*xDestroy)(void*)
); );
SQLITE_API int sqlite3_create_window_function(
sqlite3 *db,
const char *zFunctionName,
int nArg,
int eTextRep,
void *pApp,
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
void (*xFinal)(sqlite3_context*),
void (*xValue)(sqlite3_context*),
void (*xInverse)(sqlite3_context*,int,sqlite3_value**),
void(*xDestroy)(void*)
);
/* /*
** CAPI3REF: Text Encodings ** CAPI3REF: Text Encodings
@ -4857,6 +4954,28 @@ SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int6
** **
** These routines must be called from the same thread as ** These routines must be called from the same thread as
** the SQL function that supplied the [sqlite3_value*] parameters. ** the SQL function that supplied the [sqlite3_value*] parameters.
**
** As long as the input parameter is correct, these routines can only
** fail if an out-of-memory error occurs during a format conversion.
** Only the following subset of interfaces are subject to out-of-memory
** errors:
**
** <ul>
** <li> sqlite3_value_blob()
** <li> sqlite3_value_text()
** <li> sqlite3_value_text16()
** <li> sqlite3_value_text16le()
** <li> sqlite3_value_text16be()
** <li> sqlite3_value_bytes()
** <li> sqlite3_value_bytes16()
** </ul>
**
** If an out-of-memory error occurs, then the return value from these
** routines is the same as if the column had contained an SQL NULL value.
** Valid SQL NULL returns can be distinguished from out-of-memory errors
** by invoking the [sqlite3_errcode()] immediately after the suspect
** return value is obtained and before any
** other SQLite interface is called on the same [database connection].
*/ */
SQLITE_API const void *sqlite3_value_blob(sqlite3_value*); SQLITE_API const void *sqlite3_value_blob(sqlite3_value*);
SQLITE_API double sqlite3_value_double(sqlite3_value*); SQLITE_API double sqlite3_value_double(sqlite3_value*);
@ -6323,6 +6442,7 @@ struct sqlite3_index_info {
#define SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70 #define SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70
#define SQLITE_INDEX_CONSTRAINT_ISNULL 71 #define SQLITE_INDEX_CONSTRAINT_ISNULL 71
#define SQLITE_INDEX_CONSTRAINT_IS 72 #define SQLITE_INDEX_CONSTRAINT_IS 72
#define SQLITE_INDEX_CONSTRAINT_FUNCTION 150
/* /*
** CAPI3REF: Register A Virtual Table Implementation ** CAPI3REF: Register A Virtual Table Implementation
@ -6999,6 +7119,7 @@ SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*);
/* /*
** CAPI3REF: Low-Level Control Of Database Files ** CAPI3REF: Low-Level Control Of Database Files
** METHOD: sqlite3 ** METHOD: sqlite3
** KEYWORDS: {file control}
** **
** ^The [sqlite3_file_control()] interface makes a direct call to the ** ^The [sqlite3_file_control()] interface makes a direct call to the
** xFileControl method for the [sqlite3_io_methods] object associated ** xFileControl method for the [sqlite3_io_methods] object associated
@ -7013,11 +7134,18 @@ SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*);
** the xFileControl method. ^The return value of the xFileControl ** the xFileControl method. ^The return value of the xFileControl
** method becomes the return value of this routine. ** method becomes the return value of this routine.
** **
** A few opcodes for [sqlite3_file_control()] are handled directly
** by the SQLite core and never invoke the
** sqlite3_io_methods.xFileControl method.
** ^The [SQLITE_FCNTL_FILE_POINTER] value for the op parameter causes ** ^The [SQLITE_FCNTL_FILE_POINTER] value for the op parameter causes
** a pointer to the underlying [sqlite3_file] object to be written into ** a pointer to the underlying [sqlite3_file] object to be written into
** the space pointed to by the 4th parameter. ^The [SQLITE_FCNTL_FILE_POINTER] ** the space pointed to by the 4th parameter. The
** case is a short-circuit path which does not actually invoke the ** [SQLITE_FCNTL_JOURNAL_POINTER] works similarly except that it returns
** underlying sqlite3_io_methods.xFileControl method. ** the [sqlite3_file] object associated with the journal file instead of
** the main database. The [SQLITE_FCNTL_VFS_POINTER] opcode returns
** a pointer to the underlying [sqlite3_vfs] object for the file.
** The [SQLITE_FCNTL_DATA_VERSION] returns the data version counter
** from the pager.
** **
** ^If the second parameter (zDbName) does not match the name of any ** ^If the second parameter (zDbName) does not match the name of any
** open database file, then SQLITE_ERROR is returned. ^This error ** open database file, then SQLITE_ERROR is returned. ^This error
@ -8836,7 +8964,6 @@ SQLITE_API int sqlite3_system_errno(sqlite3*);
/* /*
** CAPI3REF: Database Snapshot ** CAPI3REF: Database Snapshot
** KEYWORDS: {snapshot} {sqlite3_snapshot} ** KEYWORDS: {snapshot} {sqlite3_snapshot}
** EXPERIMENTAL
** **
** An instance of the snapshot object records the state of a [WAL mode] ** An instance of the snapshot object records the state of a [WAL mode]
** database for some specific point in history. ** database for some specific point in history.
@ -8853,11 +8980,6 @@ SQLITE_API int sqlite3_system_errno(sqlite3*);
** version of the database file so that it is possible to later open a new read ** version of the database file so that it is possible to later open a new read
** transaction that sees that historical version of the database rather than ** transaction that sees that historical version of the database rather than
** the most recent version. ** the most recent version.
**
** The constructor for this object is [sqlite3_snapshot_get()]. The
** [sqlite3_snapshot_open()] method causes a fresh read transaction to refer
** to an historical snapshot (if possible). The destructor for
** sqlite3_snapshot objects is [sqlite3_snapshot_free()].
*/ */
typedef struct sqlite3_snapshot { typedef struct sqlite3_snapshot {
unsigned char hidden[48]; unsigned char hidden[48];
@ -8865,7 +8987,7 @@ typedef struct sqlite3_snapshot {
/* /*
** CAPI3REF: Record A Database Snapshot ** CAPI3REF: Record A Database Snapshot
** EXPERIMENTAL ** CONSTRUCTOR: sqlite3_snapshot
** **
** ^The [sqlite3_snapshot_get(D,S,P)] interface attempts to make a ** ^The [sqlite3_snapshot_get(D,S,P)] interface attempts to make a
** new [sqlite3_snapshot] object that records the current state of ** new [sqlite3_snapshot] object that records the current state of
@ -8881,7 +9003,7 @@ typedef struct sqlite3_snapshot {
** in this case. ** in this case.
** **
** <ul> ** <ul>
** <li> The database handle must be in [autocommit mode]. ** <li> The database handle must not be in [autocommit mode].
** **
** <li> Schema S of [database connection] D must be a [WAL mode] database. ** <li> Schema S of [database connection] D must be a [WAL mode] database.
** **
@ -8904,7 +9026,7 @@ typedef struct sqlite3_snapshot {
** to avoid a memory leak. ** to avoid a memory leak.
** **
** The [sqlite3_snapshot_get()] interface is only available when the ** The [sqlite3_snapshot_get()] interface is only available when the
** SQLITE_ENABLE_SNAPSHOT compile-time option is used. ** [SQLITE_ENABLE_SNAPSHOT] compile-time option is used.
*/ */
SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_get( SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_get(
sqlite3 *db, sqlite3 *db,
@ -8914,24 +9036,35 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_get(
/* /*
** CAPI3REF: Start a read transaction on an historical snapshot ** CAPI3REF: Start a read transaction on an historical snapshot
** EXPERIMENTAL ** METHOD: sqlite3_snapshot
** **
** ^The [sqlite3_snapshot_open(D,S,P)] interface starts a ** ^The [sqlite3_snapshot_open(D,S,P)] interface either starts a new read
** read transaction for schema S of ** transaction or upgrades an existing one for schema S of
** [database connection] D such that the read transaction ** [database connection] D such that the read transaction refers to
** refers to historical [snapshot] P, rather than the most ** historical [snapshot] P, rather than the most recent change to the
** recent change to the database. ** database. ^The [sqlite3_snapshot_open()] interface returns SQLITE_OK
** ^The [sqlite3_snapshot_open()] interface returns SQLITE_OK on success ** on success or an appropriate [error code] if it fails.
** or an appropriate [error code] if it fails. **
** ^In order to succeed, the database connection must not be in
** [autocommit mode] when [sqlite3_snapshot_open(D,S,P)] is called. If there
** is already a read transaction open on schema S, then the database handle
** must have no active statements (SELECT statements that have been passed
** to sqlite3_step() but not sqlite3_reset() or sqlite3_finalize()).
** SQLITE_ERROR is returned if either of these conditions is violated, or
** if schema S does not exist, or if the snapshot object is invalid.
**
** ^A call to sqlite3_snapshot_open() will fail to open if the specified
** snapshot has been overwritten by a [checkpoint]. In this case
** SQLITE_ERROR_SNAPSHOT is returned.
**
** If there is already a read transaction open when this function is
** invoked, then the same read transaction remains open (on the same
** database snapshot) if SQLITE_ERROR, SQLITE_BUSY or SQLITE_ERROR_SNAPSHOT
** is returned. If another error code - for example SQLITE_PROTOCOL or an
** SQLITE_IOERR error code - is returned, then the final state of the
** read transaction is undefined. If SQLITE_OK is returned, then the
** read transaction is now open on database snapshot P.
** **
** ^In order to succeed, a call to [sqlite3_snapshot_open(D,S,P)] must be
** the first operation following the [BEGIN] that takes the schema S
** out of [autocommit mode].
** ^In other words, schema S must not currently be in
** a transaction for [sqlite3_snapshot_open(D,S,P)] to work, but the
** database connection D must be out of [autocommit mode].
** ^A [snapshot] will fail to open if it has been overwritten by a
** [checkpoint].
** ^(A call to [sqlite3_snapshot_open(D,S,P)] will fail if the ** ^(A call to [sqlite3_snapshot_open(D,S,P)] will fail if the
** database connection D does not know that the database file for ** database connection D does not know that the database file for
** schema S is in [WAL mode]. A database connection might not know ** schema S is in [WAL mode]. A database connection might not know
@ -8942,7 +9075,7 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_get(
** database connection in order to make it ready to use snapshots.) ** database connection in order to make it ready to use snapshots.)
** **
** The [sqlite3_snapshot_open()] interface is only available when the ** The [sqlite3_snapshot_open()] interface is only available when the
** SQLITE_ENABLE_SNAPSHOT compile-time option is used. ** [SQLITE_ENABLE_SNAPSHOT] compile-time option is used.
*/ */
SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_open( SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_open(
sqlite3 *db, sqlite3 *db,
@ -8952,20 +9085,20 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_open(
/* /*
** CAPI3REF: Destroy a snapshot ** CAPI3REF: Destroy a snapshot
** EXPERIMENTAL ** DESTRUCTOR: sqlite3_snapshot
** **
** ^The [sqlite3_snapshot_free(P)] interface destroys [sqlite3_snapshot] P. ** ^The [sqlite3_snapshot_free(P)] interface destroys [sqlite3_snapshot] P.
** The application must eventually free every [sqlite3_snapshot] object ** The application must eventually free every [sqlite3_snapshot] object
** using this routine to avoid a memory leak. ** using this routine to avoid a memory leak.
** **
** The [sqlite3_snapshot_free()] interface is only available when the ** The [sqlite3_snapshot_free()] interface is only available when the
** SQLITE_ENABLE_SNAPSHOT compile-time option is used. ** [SQLITE_ENABLE_SNAPSHOT] compile-time option is used.
*/ */
SQLITE_API SQLITE_EXPERIMENTAL void sqlite3_snapshot_free(sqlite3_snapshot*); SQLITE_API SQLITE_EXPERIMENTAL void sqlite3_snapshot_free(sqlite3_snapshot*);
/* /*
** CAPI3REF: Compare the ages of two snapshot handles. ** CAPI3REF: Compare the ages of two snapshot handles.
** EXPERIMENTAL ** METHOD: sqlite3_snapshot
** **
** The sqlite3_snapshot_cmp(P1, P2) interface is used to compare the ages ** The sqlite3_snapshot_cmp(P1, P2) interface is used to compare the ages
** of two valid snapshot handles. ** of two valid snapshot handles.
@ -8984,6 +9117,9 @@ SQLITE_API SQLITE_EXPERIMENTAL void sqlite3_snapshot_free(sqlite3_snapshot*);
** Otherwise, this API returns a negative value if P1 refers to an older ** Otherwise, this API returns a negative value if P1 refers to an older
** snapshot than P2, zero if the two handles refer to the same database ** snapshot than P2, zero if the two handles refer to the same database
** snapshot, and a positive value if P1 is a newer snapshot than P2. ** snapshot, and a positive value if P1 is a newer snapshot than P2.
**
** This interface is only available if SQLite is compiled with the
** [SQLITE_ENABLE_SNAPSHOT] option.
*/ */
SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_cmp( SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_cmp(
sqlite3_snapshot *p1, sqlite3_snapshot *p1,
@ -8992,23 +9128,26 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_cmp(
/* /*
** CAPI3REF: Recover snapshots from a wal file ** CAPI3REF: Recover snapshots from a wal file
** EXPERIMENTAL ** METHOD: sqlite3_snapshot
** **
** If all connections disconnect from a database file but do not perform ** If a [WAL file] remains on disk after all database connections close
** a checkpoint, the existing wal file is opened along with the database ** (either through the use of the [SQLITE_FCNTL_PERSIST_WAL] [file control]
** file the next time the database is opened. At this point it is only ** or because the last process to have the database opened exited without
** possible to successfully call sqlite3_snapshot_open() to open the most ** calling [sqlite3_close()]) and a new connection is subsequently opened
** recent snapshot of the database (the one at the head of the wal file), ** on that database and [WAL file], the [sqlite3_snapshot_open()] interface
** even though the wal file may contain other valid snapshots for which ** will only be able to open the last transaction added to the WAL file
** clients have sqlite3_snapshot handles. ** even though the WAL file contains other valid transactions.
** **
** This function attempts to scan the wal file associated with database zDb ** This function attempts to scan the WAL file associated with database zDb
** of database handle db and make all valid snapshots available to ** of database handle db and make all valid snapshots available to
** sqlite3_snapshot_open(). It is an error if there is already a read ** sqlite3_snapshot_open(). It is an error if there is already a read
** transaction open on the database, or if the database is not a wal mode ** transaction open on the database, or if the database is not a WAL mode
** database. ** database.
** **
** SQLITE_OK is returned if successful, or an SQLite error code otherwise. ** SQLITE_OK is returned if successful, or an SQLite error code otherwise.
**
** This interface is only available if SQLite is compiled with the
** [SQLITE_ENABLE_SNAPSHOT] option.
*/ */
SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const char *zDb); SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const char *zDb);
@ -9119,7 +9258,7 @@ SQLITE_API int sqlite3_deserialize(
** in the P argument is held in memory obtained from [sqlite3_malloc64()] ** in the P argument is held in memory obtained from [sqlite3_malloc64()]
** and that SQLite should take ownership of this memory and automatically ** and that SQLite should take ownership of this memory and automatically
** free it when it has finished using it. Without this flag, the caller ** free it when it has finished using it. Without this flag, the caller
** is resposible for freeing any dynamically allocated memory. ** is responsible for freeing any dynamically allocated memory.
** **
** The SQLITE_DESERIALIZE_RESIZEABLE flag means that SQLite is allowed to ** The SQLITE_DESERIALIZE_RESIZEABLE flag means that SQLite is allowed to
** grow the size of the database using calls to [sqlite3_realloc64()]. This ** grow the size of the database using calls to [sqlite3_realloc64()]. This
@ -11297,7 +11436,7 @@ struct Fts5ExtensionApi {
** This way, even if the tokenizer does not provide synonyms ** This way, even if the tokenizer does not provide synonyms
** when tokenizing query text (it should not - to do would be ** when tokenizing query text (it should not - to do would be
** inefficient), it doesn't matter if the user queries for ** inefficient), it doesn't matter if the user queries for
** 'first + place' or '1st + place', as there are entires in the ** 'first + place' or '1st + place', as there are entries in the
** FTS index corresponding to both forms of the first token. ** FTS index corresponding to both forms of the first token.
** </ol> ** </ol>
** **
@ -11325,7 +11464,7 @@ struct Fts5ExtensionApi {
** extra data to the FTS index or require FTS5 to query for multiple terms, ** extra data to the FTS index or require FTS5 to query for multiple terms,
** so it is efficient in terms of disk space and query speed. However, it ** so it is efficient in terms of disk space and query speed. However, it
** does not support prefix queries very well. If, as suggested above, the ** does not support prefix queries very well. If, as suggested above, the
** token "first" is subsituted for "1st" by the tokenizer, then the query: ** token "first" is substituted for "1st" by the tokenizer, then the query:
** **
** <codeblock> ** <codeblock>
** ... MATCH '1s*'</codeblock> ** ... MATCH '1s*'</codeblock>

View File

@ -310,6 +310,12 @@ struct sqlite3_api_routines {
int (*str_errcode)(sqlite3_str*); int (*str_errcode)(sqlite3_str*);
int (*str_length)(sqlite3_str*); int (*str_length)(sqlite3_str*);
char *(*str_value)(sqlite3_str*); char *(*str_value)(sqlite3_str*);
int (*create_window_function)(sqlite3*,const char*,int,int,void*,
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
void (*xFinal)(sqlite3_context*),
void (*xValue)(sqlite3_context*),
void (*xInv)(sqlite3_context*,int,sqlite3_value**),
void(*xDestroy)(void*));
}; };
/* /*
@ -595,6 +601,8 @@ typedef int (*sqlite3_loadext_entry)(
#define sqlite3_str_errcode sqlite3_api->str_errcode #define sqlite3_str_errcode sqlite3_api->str_errcode
#define sqlite3_str_length sqlite3_api->str_length #define sqlite3_str_length sqlite3_api->str_length
#define sqlite3_str_value sqlite3_api->str_value #define sqlite3_str_value sqlite3_api->str_value
/* Version 3.25.0 and later */
#define sqlite3_create_window_function sqlite3_api->create_window_function
#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

@ -1,10 +1,10 @@
SCRIPT_DIR=$(cd "$(dirname "$_")" && pwd) SCRIPT_DIR=$(cd "$(dirname "$_")" && pwd)
echo $SCRIPT_DIR echo $SCRIPT_DIR
cd $SCRIPT_DIR cd $SCRIPT_DIR
SQLITE3_LIB_DIR=$SCRIPT_DIR/sqlite3 export SQLITE3_LIB_DIR=$SCRIPT_DIR/sqlite3
# Download and extract amalgamation # Download and extract amalgamation
SQLITE=sqlite-amalgamation-3240000 SQLITE=sqlite-amalgamation-3250000
curl -O http://sqlite.org/2018/$SQLITE.zip curl -O http://sqlite.org/2018/$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
@ -13,7 +13,7 @@ rm -f $SQLITE.zip
# Regenerate bindgen file # Regenerate bindgen file
rm -f $SQLITE3_LIB_DIR/bindgen_bundled_version.rs rm -f $SQLITE3_LIB_DIR/bindgen_bundled_version.rs
SQLITE3_INCLUDE_DIR=$SQLITE3_LIB_DIR export SQLITE3_INCLUDE_DIR=$SQLITE3_LIB_DIR
cargo update cargo update
# Just to make sure there is only one bindgen.rs file in target dir # Just to make sure there is only one bindgen.rs file in target dir
find $SCRIPT_DIR/target -type f -name bindgen.rs -exec rm {} \; find $SCRIPT_DIR/target -type f -name bindgen.rs -exec rm {} \;