|
|
|
@ -123,9 +123,9 @@ extern "C" { |
|
|
|
** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
|
|
|
** [sqlite_version()] and [sqlite_source_id()]. |
|
|
|
*/ |
|
|
|
#define SQLITE_VERSION "3.24.0" |
|
|
|
#define SQLITE_VERSION_NUMBER 3024000 |
|
|
|
#define SQLITE_SOURCE_ID "2018-06-04 19:24:41 c7ee0833225bfd8c5ec2f9bf62b97c4e04d03bd9566366d5221ac8fb199a87ca" |
|
|
|
#define SQLITE_VERSION "3.25.0" |
|
|
|
#define SQLITE_VERSION_NUMBER 3025000 |
|
|
|
#define SQLITE_SOURCE_ID "2018-09-15 04:01:47 b63af6c3bd33152742648d5d2e8dc5d5fcbcdd27df409272b6aea00a6f761760" |
|
|
|
|
|
|
|
/* |
|
|
|
** 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_RETRY (SQLITE_ERROR | (2<<8)) |
|
|
|
#define SQLITE_ERROR_SNAPSHOT (SQLITE_ERROR | (3<<8)) |
|
|
|
#define SQLITE_IOERR_READ (SQLITE_IOERR | (1<<8)) |
|
|
|
#define SQLITE_IOERR_SHORT_READ (SQLITE_IOERR | (2<<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_FULLPATH (SQLITE_CANTOPEN | (3<<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_SEQUENCE (SQLITE_CORRUPT | (2<<8)) |
|
|
|
#define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8)) |
|
|
|
@ -886,7 +888,8 @@ struct sqlite3_io_methods { |
|
|
|
** <li>[[SQLITE_FCNTL_PERSIST_WAL]] |
|
|
|
** ^The [SQLITE_FCNTL_PERSIST_WAL] opcode is used to set or query the |
|
|
|
** 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 |
|
|
|
** closes. Setting persistent WAL mode causes those files to persist after |
|
|
|
** 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 |
|
|
|
** for up to M milliseconds before failing, where M is the single |
|
|
|
** 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> |
|
|
|
*/ |
|
|
|
#define SQLITE_FCNTL_LOCKSTATE 1 |
|
|
|
@ -1107,6 +1130,7 @@ struct sqlite3_io_methods { |
|
|
|
#define SQLITE_FCNTL_COMMIT_ATOMIC_WRITE 32 |
|
|
|
#define SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE 33 |
|
|
|
#define SQLITE_FCNTL_LOCK_TIMEOUT 34 |
|
|
|
#define SQLITE_FCNTL_DATA_VERSION 35 |
|
|
|
|
|
|
|
/* deprecated names */ |
|
|
|
#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 |
|
|
|
** a badly corrupted database file: |
|
|
|
** <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_exec](db, "[VACUUM]", 0, 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 |
|
|
|
** 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 |
|
|
|
** while [sqlite3_changes()] is running then the value returned |
|
|
|
** 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*); |
|
|
|
|
|
|
|
@ -2292,13 +2327,26 @@ SQLITE_API int sqlite3_changes(sqlite3*); |
|
|
|
** count, but those made as part of REPLACE constraint resolution are |
|
|
|
** not. ^Changes to a view that are intercepted by INSTEAD OF triggers |
|
|
|
** are not counted. |
|
|
|
** |
|
|
|
** See also the [sqlite3_changes()] interface, the |
|
|
|
** [count_changes pragma], and the [total_changes() SQL function]. |
|
|
|
** |
|
|
|
** This the [sqlite3_total_changes(D)] interface only reports the number |
|
|
|
** 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 |
|
|
|
** while [sqlite3_total_changes()] is running then the value |
|
|
|
** 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*); |
|
|
|
|
|
|
|
@ -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 |
|
|
|
** returns the numeric [result code] or [extended result code] for that |
|
|
|
** API call. |
|
|
|
** If the most recent API call was successful, |
|
|
|
** then the return value from sqlite3_errcode() is undefined. |
|
|
|
** ^The sqlite3_extended_errcode() |
|
|
|
** interface is the same except that it always returns the |
|
|
|
** [extended result code] even when extended result codes are |
|
|
|
** 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 |
|
|
|
** text that describes the error, as either UTF-8 or UTF-16 respectively. |
|
|
|
** ^(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 |
|
|
|
** [sqlite3_free()]. |
|
|
|
** |
|
|
|
** ^(If a memory allocation error occurs during the evaluation of any |
|
|
|
** of these routines, a default value is returned. The default value |
|
|
|
** is either the integer 0, the floating point number 0.0, or a NULL |
|
|
|
** pointer. Subsequent calls to [sqlite3_errcode()] will return |
|
|
|
** [SQLITE_NOMEM].)^ |
|
|
|
** As long as the input parameters are correct, these routines will 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_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 double sqlite3_column_double(sqlite3_stmt*, int iCol); |
|
|
|
@ -4595,11 +4668,13 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt); |
|
|
|
** |
|
|
|
** ^These functions (collectively known as "function creation routines") |
|
|
|
** are used to add SQL functions or aggregates or to redefine the behavior |
|
|
|
** of existing SQL functions or aggregates. The only differences between |
|
|
|
** these routines are the text encoding expected for |
|
|
|
** the second parameter (the name of the function being created) |
|
|
|
** and the presence or absence of a destructor callback for |
|
|
|
** the application data pointer. |
|
|
|
** of existing SQL functions or aggregates. The only differences between |
|
|
|
** the three "sqlite3_create_function*" routines are the text encoding |
|
|
|
** expected for the second parameter (the name of the function being |
|
|
|
** created) and the presence or absence of a destructor callback for |
|
|
|
** 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 |
|
|
|
** 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 |
|
|
|
** 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 |
|
|
|
** aggregate. ^A scalar SQL function requires an implementation of the xFunc |
|
|
|
** 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 |
|
|
|
** callbacks. |
|
|
|
** |
|
|
|
** ^(If the ninth parameter to sqlite3_create_function_v2() 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 of the tenth parameter 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(). |
|
|
|
** ^The sixth, seventh, eighth and ninth parameters (xStep, xFinal, xValue |
|
|
|
** and xInverse) passed to sqlite3_create_window_function are pointers to |
|
|
|
** C-language callbacks that implement the new function. xStep and xFinal |
|
|
|
** must both be non-NULL. xValue and xInverse may either both be NULL, in |
|
|
|
** which case a regular aggregate function is created, or must both be |
|
|
|
** non-NULL, in which case the new function may be used as either an aggregate |
|
|
|
** or aggregate window function. More details regarding the implementation |
|
|
|
** of aggregate window functions are |
|
|
|
** [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 |
|
|
|
** 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(*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 |
|
|
|
@ -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 |
|
|
|
** 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 double sqlite3_value_double(sqlite3_value*); |
|
|
|
@ -6323,6 +6442,7 @@ struct sqlite3_index_info { |
|
|
|
#define SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70 |
|
|
|
#define SQLITE_INDEX_CONSTRAINT_ISNULL 71 |
|
|
|
#define SQLITE_INDEX_CONSTRAINT_IS 72 |
|
|
|
#define SQLITE_INDEX_CONSTRAINT_FUNCTION 150 |
|
|
|
|
|
|
|
/* |
|
|
|
** 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 |
|
|
|
** METHOD: sqlite3 |
|
|
|
** KEYWORDS: {file control} |
|
|
|
** |
|
|
|
** ^The [sqlite3_file_control()] interface makes a direct call to the |
|
|
|
** 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 |
|
|
|
** 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 |
|
|
|
** 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] |
|
|
|
** case is a short-circuit path which does not actually invoke the |
|
|
|
** underlying sqlite3_io_methods.xFileControl method. |
|
|
|
** the space pointed to by the 4th parameter. The |
|
|
|
** [SQLITE_FCNTL_JOURNAL_POINTER] works similarly except that it returns |
|
|
|
** 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 |
|
|
|
** open database file, then SQLITE_ERROR is returned. ^This error |
|
|
|
@ -8836,7 +8964,6 @@ SQLITE_API int sqlite3_system_errno(sqlite3*); |
|
|
|
/* |
|
|
|
** CAPI3REF: Database Snapshot |
|
|
|
** KEYWORDS: {snapshot} {sqlite3_snapshot} |
|
|
|
** EXPERIMENTAL |
|
|
|
** |
|
|
|
** An instance of the snapshot object records the state of a [WAL mode] |
|
|
|
** 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 |
|
|
|
** transaction that sees that historical version of the database rather than |
|
|
|
** 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 { |
|
|
|
unsigned char hidden[48]; |
|
|
|
@ -8865,7 +8987,7 @@ typedef struct sqlite3_snapshot { |
|
|
|
|
|
|
|
/* |
|
|
|
** CAPI3REF: Record A Database Snapshot |
|
|
|
** EXPERIMENTAL |
|
|
|
** CONSTRUCTOR: sqlite3_snapshot |
|
|
|
** |
|
|
|
** ^The [sqlite3_snapshot_get(D,S,P)] interface attempts to make a |
|
|
|
** new [sqlite3_snapshot] object that records the current state of |
|
|
|
@ -8881,7 +9003,7 @@ typedef struct sqlite3_snapshot { |
|
|
|
** in this case. |
|
|
|
** |
|
|
|
** <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. |
|
|
|
** |
|
|
|
@ -8904,7 +9026,7 @@ typedef struct sqlite3_snapshot { |
|
|
|
** to avoid a memory leak. |
|
|
|
** |
|
|
|
** 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( |
|
|
|
sqlite3 *db, |
|
|
|
@ -8914,24 +9036,35 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_get( |
|
|
|
|
|
|
|
/* |
|
|
|
** CAPI3REF: Start a read transaction on an historical snapshot |
|
|
|
** EXPERIMENTAL |
|
|
|
** METHOD: sqlite3_snapshot |
|
|
|
** |
|
|
|
** ^The [sqlite3_snapshot_open(D,S,P)] interface either starts a new read |
|
|
|
** transaction or upgrades an existing one for schema S of |
|
|
|
** [database connection] D such that the read transaction refers to |
|
|
|
** historical [snapshot] P, rather than the most recent change to the |
|
|
|
** database. ^The [sqlite3_snapshot_open()] interface returns SQLITE_OK |
|
|
|
** on success 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. |
|
|
|
** |
|
|
|
** ^The [sqlite3_snapshot_open(D,S,P)] interface starts a |
|
|
|
** read transaction for schema S of |
|
|
|
** [database connection] D such that the read transaction |
|
|
|
** refers to historical [snapshot] P, rather than the most |
|
|
|
** recent change to the database. |
|
|
|
** ^The [sqlite3_snapshot_open()] interface returns SQLITE_OK on success |
|
|
|
** or an appropriate [error code] if it fails. |
|
|
|
** |
|
|
|
** ^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 |
|
|
|
** database connection D does not know that the database file for |
|
|
|
** 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.) |
|
|
|
** |
|
|
|
** 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( |
|
|
|
sqlite3 *db, |
|
|
|
@ -8952,20 +9085,20 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_open( |
|
|
|
|
|
|
|
/* |
|
|
|
** CAPI3REF: Destroy a snapshot |
|
|
|
** EXPERIMENTAL |
|
|
|
** DESTRUCTOR: sqlite3_snapshot |
|
|
|
** |
|
|
|
** ^The [sqlite3_snapshot_free(P)] interface destroys [sqlite3_snapshot] P. |
|
|
|
** The application must eventually free every [sqlite3_snapshot] object |
|
|
|
** using this routine to avoid a memory leak. |
|
|
|
** |
|
|
|
** 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*); |
|
|
|
|
|
|
|
/* |
|
|
|
** 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 |
|
|
|
** 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 |
|
|
|
** 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. |
|
|
|
** |
|
|
|
** This interface is only available if SQLite is compiled with the |
|
|
|
** [SQLITE_ENABLE_SNAPSHOT] option. |
|
|
|
*/ |
|
|
|
SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_cmp( |
|
|
|
sqlite3_snapshot *p1, |
|
|
|
@ -8992,23 +9128,26 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_cmp( |
|
|
|
|
|
|
|
/* |
|
|
|
** CAPI3REF: Recover snapshots from a wal file |
|
|
|
** EXPERIMENTAL |
|
|
|
** METHOD: sqlite3_snapshot |
|
|
|
** |
|
|
|
** If all connections disconnect from a database file but do not perform |
|
|
|
** a checkpoint, the existing wal file is opened along with the database |
|
|
|
** file the next time the database is opened. At this point it is only |
|
|
|
** possible to successfully call sqlite3_snapshot_open() to open the most |
|
|
|
** recent snapshot of the database (the one at the head of the wal file), |
|
|
|
** even though the wal file may contain other valid snapshots for which |
|
|
|
** clients have sqlite3_snapshot handles. |
|
|
|
** If a [WAL file] remains on disk after all database connections close |
|
|
|
** (either through the use of the [SQLITE_FCNTL_PERSIST_WAL] [file control] |
|
|
|
** or because the last process to have the database opened exited without |
|
|
|
** calling [sqlite3_close()]) and a new connection is subsequently opened |
|
|
|
** on that database and [WAL file], the [sqlite3_snapshot_open()] interface |
|
|
|
** will only be able to open the last transaction added to the WAL file |
|
|
|
** 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 |
|
|
|
** 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. |
|
|
|
** |
|
|
|
** 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); |
|
|
|
|
|
|
|
@ -9119,7 +9258,7 @@ SQLITE_API int sqlite3_deserialize( |
|
|
|
** in the P argument is held in memory obtained from [sqlite3_malloc64()] |
|
|
|
** and that SQLite should take ownership of this memory and automatically |
|
|
|
** 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 |
|
|
|
** 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 |
|
|
|
** when tokenizing query text (it should not - to do would be |
|
|
|
** 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. |
|
|
|
** </ol> |
|
|
|
** |
|
|
|
@ -11325,7 +11464,7 @@ struct Fts5ExtensionApi { |
|
|
|
** 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 |
|
|
|
** 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> |
|
|
|
** ... MATCH '1s*'</codeblock> |
|
|
|
|