|
version 1.4, 2017/02/13 16:52:50
|
version 1.4.2.2, 2019/09/26 13:02:52
|
|
Line 1
|
Line 1
|
| /* |
/* |
| ** 2001 September 15 | ** 2001-09-15 |
| ** |
** |
| ** The author disclaims copyright to this source code. In place of |
** The author disclaims copyright to this source code. In place of |
| ** a legal notice, here is a blessing: |
** a legal notice, here is a blessing: |
|
Line 108 extern "C" {
|
Line 108 extern "C" {
|
| ** be held constant and Z will be incremented or else Y will be incremented |
** be held constant and Z will be incremented or else Y will be incremented |
| ** and Z will be reset to zero. |
** and Z will be reset to zero. |
| ** |
** |
| ** Since version 3.6.18, SQLite source code has been stored in the | ** Since [version 3.6.18] ([dateof:3.6.18]), |
| | ** SQLite source code has been stored in the |
| ** <a href="http://www.fossil-scm.org/">Fossil configuration management |
** <a href="http://www.fossil-scm.org/">Fossil configuration management |
| ** system</a>. ^The SQLITE_SOURCE_ID macro evaluates to |
** system</a>. ^The SQLITE_SOURCE_ID macro evaluates to |
| ** a string which identifies a particular check-in of SQLite |
** a string which identifies a particular check-in of SQLite |
| ** within its configuration management system. ^The SQLITE_SOURCE_ID |
** within its configuration management system. ^The SQLITE_SOURCE_ID |
| ** string contains the date and time of the check-in (UTC) and an SHA1 | ** string contains the date and time of the check-in (UTC) and a SHA1 |
| ** hash of the entire source tree. | ** or SHA3-256 hash of the entire source tree. If the source code has |
| | ** been edited in any way since it was last checked in, then the last |
| | ** four hexadecimal digits of the hash may be modified. |
| ** |
** |
| ** See also: [sqlite3_libversion()], |
** See also: [sqlite3_libversion()], |
| ** [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.14.2" | #define SQLITE_VERSION "3.29.0" |
| #define SQLITE_VERSION_NUMBER 3014002 | #define SQLITE_VERSION_NUMBER 3029000 |
| #define SQLITE_SOURCE_ID "2016-09-12 18:50:49 29dbef4b8585f753861a36d6dd102ca634197bd6" | #define SQLITE_SOURCE_ID "2019-07-10 17:32:03 fc82b73eaac8b36950e527f12c4b5dc1e147e6f4ad2217ae43ad82882a88bfa6" |
| |
|
| /* |
/* |
| ** CAPI3REF: Run-Time Library Version Numbers |
** CAPI3REF: Run-Time Library Version Numbers |
| ** KEYWORDS: sqlite3_version, sqlite3_sourceid | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| ** |
** |
| ** These interfaces provide the same information as the [SQLITE_VERSION], |
** These interfaces provide the same information as the [SQLITE_VERSION], |
| ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros |
** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros |
|
Line 138 extern "C" {
|
Line 141 extern "C" {
|
| ** |
** |
| ** <blockquote><pre> |
** <blockquote><pre> |
| ** assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER ); |
** assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER ); |
| ** assert( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)==0 ); | ** assert( strncmp(sqlite3_sourceid(),SQLITE_SOURCE_ID,80)==0 ); |
| ** assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 ); |
** assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 ); |
| ** </pre></blockquote>)^ |
** </pre></blockquote>)^ |
| ** |
** |
|
Line 148 extern "C" {
|
Line 151 extern "C" {
|
| ** function is provided for use in DLLs since DLL users usually do not have |
** function is provided for use in DLLs since DLL users usually do not have |
| ** direct access to string constants within the DLL. ^The |
** direct access to string constants within the DLL. ^The |
| ** sqlite3_libversion_number() function returns an integer equal to |
** sqlite3_libversion_number() function returns an integer equal to |
| ** [SQLITE_VERSION_NUMBER]. ^The sqlite3_sourceid() function returns | ** [SQLITE_VERSION_NUMBER]. ^(The sqlite3_sourceid() function returns |
| ** a pointer to a string constant whose value is the same as the |
** a pointer to a string constant whose value is the same as the |
| ** [SQLITE_SOURCE_ID] C preprocessor macro. | ** [SQLITE_SOURCE_ID] C preprocessor macro. Except if SQLite is built |
| | ** using an edited copy of [the amalgamation], then the last four characters |
| | ** of the hash might be different from [SQLITE_SOURCE_ID].)^ |
| ** |
** |
| ** See also: [sqlite_version()] and [sqlite_source_id()]. |
** See also: [sqlite_version()] and [sqlite_source_id()]. |
| */ |
*/ |
|
Line 184 SQLITE_API int sqlite3_libversion_number(void);
|
Line 189 SQLITE_API int sqlite3_libversion_number(void);
|
| #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS |
#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS |
| SQLITE_API int sqlite3_compileoption_used(const char *zOptName); |
SQLITE_API int sqlite3_compileoption_used(const char *zOptName); |
| SQLITE_API const char *sqlite3_compileoption_get(int N); |
SQLITE_API const char *sqlite3_compileoption_get(int N); |
| |
#else |
| |
# define sqlite3_compileoption_used(X) 0 |
| |
# define sqlite3_compileoption_get(X) ((void*)0) |
| #endif |
#endif |
| |
|
| /* |
/* |
|
Line 258 typedef struct sqlite3 sqlite3;
|
Line 266 typedef struct sqlite3 sqlite3;
|
| */ |
*/ |
| #ifdef SQLITE_INT64_TYPE |
#ifdef SQLITE_INT64_TYPE |
| typedef SQLITE_INT64_TYPE sqlite_int64; |
typedef SQLITE_INT64_TYPE sqlite_int64; |
| typedef unsigned SQLITE_INT64_TYPE sqlite_uint64; | # ifdef SQLITE_UINT64_TYPE |
| | typedef SQLITE_UINT64_TYPE sqlite_uint64; |
| | # else |
| | typedef unsigned SQLITE_INT64_TYPE sqlite_uint64; |
| | # endif |
| #elif defined(_MSC_VER) || defined(__BORLANDC__) |
#elif defined(_MSC_VER) || defined(__BORLANDC__) |
| typedef __int64 sqlite_int64; |
typedef __int64 sqlite_int64; |
| typedef unsigned __int64 sqlite_uint64; |
typedef unsigned __int64 sqlite_uint64; |
|
Line 412 SQLITE_API int sqlite3_exec(
|
Line 424 SQLITE_API int sqlite3_exec(
|
| */ |
*/ |
| #define SQLITE_OK 0 /* Successful result */ |
#define SQLITE_OK 0 /* Successful result */ |
| /* beginning-of-error-codes */ |
/* beginning-of-error-codes */ |
| #define SQLITE_ERROR 1 /* SQL error or missing database */ | #define SQLITE_ERROR 1 /* Generic error */ |
| #define SQLITE_INTERNAL 2 /* Internal logic error in SQLite */ |
#define SQLITE_INTERNAL 2 /* Internal logic error in SQLite */ |
| #define SQLITE_PERM 3 /* Access permission denied */ |
#define SQLITE_PERM 3 /* Access permission denied */ |
| #define SQLITE_ABORT 4 /* Callback routine requested an abort */ |
#define SQLITE_ABORT 4 /* Callback routine requested an abort */ |
|
Line 427 SQLITE_API int sqlite3_exec(
|
Line 439 SQLITE_API int sqlite3_exec(
|
| #define SQLITE_FULL 13 /* Insertion failed because database is full */ |
#define SQLITE_FULL 13 /* Insertion failed because database is full */ |
| #define SQLITE_CANTOPEN 14 /* Unable to open the database file */ |
#define SQLITE_CANTOPEN 14 /* Unable to open the database file */ |
| #define SQLITE_PROTOCOL 15 /* Database lock protocol error */ |
#define SQLITE_PROTOCOL 15 /* Database lock protocol error */ |
| #define SQLITE_EMPTY 16 /* Database is empty */ | #define SQLITE_EMPTY 16 /* Internal use only */ |
| #define SQLITE_SCHEMA 17 /* The database schema changed */ |
#define SQLITE_SCHEMA 17 /* The database schema changed */ |
| #define SQLITE_TOOBIG 18 /* String or BLOB exceeds size limit */ |
#define SQLITE_TOOBIG 18 /* String or BLOB exceeds size limit */ |
| #define SQLITE_CONSTRAINT 19 /* Abort due to constraint violation */ |
#define SQLITE_CONSTRAINT 19 /* Abort due to constraint violation */ |
|
Line 435 SQLITE_API int sqlite3_exec(
|
Line 447 SQLITE_API int sqlite3_exec(
|
| #define SQLITE_MISUSE 21 /* Library used incorrectly */ |
#define SQLITE_MISUSE 21 /* Library used incorrectly */ |
| #define SQLITE_NOLFS 22 /* Uses OS features not supported on host */ |
#define SQLITE_NOLFS 22 /* Uses OS features not supported on host */ |
| #define SQLITE_AUTH 23 /* Authorization denied */ |
#define SQLITE_AUTH 23 /* Authorization denied */ |
| #define SQLITE_FORMAT 24 /* Auxiliary database format error */ | #define SQLITE_FORMAT 24 /* Not used */ |
| #define SQLITE_RANGE 25 /* 2nd parameter to sqlite3_bind out of range */ |
#define SQLITE_RANGE 25 /* 2nd parameter to sqlite3_bind out of range */ |
| #define SQLITE_NOTADB 26 /* File opened that is not a database file */ |
#define SQLITE_NOTADB 26 /* File opened that is not a database file */ |
| #define SQLITE_NOTICE 27 /* Notifications from sqlite3_log() */ |
#define SQLITE_NOTICE 27 /* Notifications from sqlite3_log() */ |
|
Line 452 SQLITE_API int sqlite3_exec(
|
Line 464 SQLITE_API int sqlite3_exec(
|
| ** [result codes]. However, experience has shown that many of |
** [result codes]. However, experience has shown that many of |
| ** these result codes are too coarse-grained. They do not provide as |
** these result codes are too coarse-grained. They do not provide as |
| ** much information about problems as programmers might like. In an effort to |
** much information about problems as programmers might like. In an effort to |
| ** address this, newer versions of SQLite (version 3.3.8 and later) include | ** address this, newer versions of SQLite (version 3.3.8 [dateof:3.3.8] |
| | ** and later) include |
| ** support for additional result codes that provide more detailed information |
** support for additional result codes that provide more detailed information |
| ** about errors. These [extended result codes] are enabled or disabled |
** about errors. These [extended result codes] are enabled or disabled |
| ** on a per database connection basis using the |
** on a per database connection basis using the |
|
Line 460 SQLITE_API int sqlite3_exec(
|
Line 473 SQLITE_API int sqlite3_exec(
|
| ** the most recent error can be obtained using |
** the most recent error can be obtained using |
| ** [sqlite3_extended_errcode()]. |
** [sqlite3_extended_errcode()]. |
| */ |
*/ |
| |
#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_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)) |
|
Line 488 SQLITE_API int sqlite3_exec(
|
Line 504 SQLITE_API int sqlite3_exec(
|
| #define SQLITE_IOERR_CONVPATH (SQLITE_IOERR | (26<<8)) |
#define SQLITE_IOERR_CONVPATH (SQLITE_IOERR | (26<<8)) |
| #define SQLITE_IOERR_VNODE (SQLITE_IOERR | (27<<8)) |
#define SQLITE_IOERR_VNODE (SQLITE_IOERR | (27<<8)) |
| #define SQLITE_IOERR_AUTH (SQLITE_IOERR | (28<<8)) |
#define SQLITE_IOERR_AUTH (SQLITE_IOERR | (28<<8)) |
| |
#define SQLITE_IOERR_BEGIN_ATOMIC (SQLITE_IOERR | (29<<8)) |
| |
#define SQLITE_IOERR_COMMIT_ATOMIC (SQLITE_IOERR | (30<<8)) |
| |
#define SQLITE_IOERR_ROLLBACK_ATOMIC (SQLITE_IOERR | (31<<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_BUSY_RECOVERY (SQLITE_BUSY | (1<<8)) |
#define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8)) |
| #define SQLITE_BUSY_SNAPSHOT (SQLITE_BUSY | (2<<8)) |
#define SQLITE_BUSY_SNAPSHOT (SQLITE_BUSY | (2<<8)) |
| #define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8)) |
#define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8)) |
| #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_READONLY_RECOVERY (SQLITE_READONLY | (1<<8)) |
#define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8)) |
| #define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2<<8)) |
#define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2<<8)) |
| #define SQLITE_READONLY_ROLLBACK (SQLITE_READONLY | (3<<8)) |
#define SQLITE_READONLY_ROLLBACK (SQLITE_READONLY | (3<<8)) |
| #define SQLITE_READONLY_DBMOVED (SQLITE_READONLY | (4<<8)) |
#define SQLITE_READONLY_DBMOVED (SQLITE_READONLY | (4<<8)) |
| |
#define SQLITE_READONLY_CANTINIT (SQLITE_READONLY | (5<<8)) |
| |
#define SQLITE_READONLY_DIRECTORY (SQLITE_READONLY | (6<<8)) |
| #define SQLITE_ABORT_ROLLBACK (SQLITE_ABORT | (2<<8)) |
#define SQLITE_ABORT_ROLLBACK (SQLITE_ABORT | (2<<8)) |
| #define SQLITE_CONSTRAINT_CHECK (SQLITE_CONSTRAINT | (1<<8)) |
#define SQLITE_CONSTRAINT_CHECK (SQLITE_CONSTRAINT | (1<<8)) |
| #define SQLITE_CONSTRAINT_COMMITHOOK (SQLITE_CONSTRAINT | (2<<8)) |
#define SQLITE_CONSTRAINT_COMMITHOOK (SQLITE_CONSTRAINT | (2<<8)) |
|
Line 570 SQLITE_API int sqlite3_exec(
|
Line 594 SQLITE_API int sqlite3_exec(
|
| ** file that were written at the application level might have changed |
** file that were written at the application level might have changed |
| ** and that adjacent bytes, even bytes within the same sector are |
** and that adjacent bytes, even bytes within the same sector are |
| ** guaranteed to be unchanged. The SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN |
** guaranteed to be unchanged. The SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN |
| ** flag indicate that a file cannot be deleted when open. The | ** flag indicates that a file cannot be deleted when open. The |
| ** SQLITE_IOCAP_IMMUTABLE flag indicates that the file is on |
** SQLITE_IOCAP_IMMUTABLE flag indicates that the file is on |
| ** read-only media and cannot be changed even by processes with |
** read-only media and cannot be changed even by processes with |
| ** elevated privileges. |
** elevated privileges. |
| |
** |
| |
** The SQLITE_IOCAP_BATCH_ATOMIC property means that the underlying |
| |
** filesystem supports doing multiple write operations atomically when those |
| |
** write operations are bracketed by [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] and |
| |
** [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]. |
| */ |
*/ |
| #define SQLITE_IOCAP_ATOMIC 0x00000001 |
#define SQLITE_IOCAP_ATOMIC 0x00000001 |
| #define SQLITE_IOCAP_ATOMIC512 0x00000002 |
#define SQLITE_IOCAP_ATOMIC512 0x00000002 |
|
Line 589 SQLITE_API int sqlite3_exec(
|
Line 618 SQLITE_API int sqlite3_exec(
|
| #define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 0x00000800 |
#define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 0x00000800 |
| #define SQLITE_IOCAP_POWERSAFE_OVERWRITE 0x00001000 |
#define SQLITE_IOCAP_POWERSAFE_OVERWRITE 0x00001000 |
| #define SQLITE_IOCAP_IMMUTABLE 0x00002000 |
#define SQLITE_IOCAP_IMMUTABLE 0x00002000 |
| |
#define SQLITE_IOCAP_BATCH_ATOMIC 0x00004000 |
| |
|
| /* |
/* |
| ** CAPI3REF: File Locking Levels |
** CAPI3REF: File Locking Levels |
|
Line 720 struct sqlite3_file {
|
Line 750 struct sqlite3_file {
|
| ** <li> [SQLITE_IOCAP_ATOMIC64K] |
** <li> [SQLITE_IOCAP_ATOMIC64K] |
| ** <li> [SQLITE_IOCAP_SAFE_APPEND] |
** <li> [SQLITE_IOCAP_SAFE_APPEND] |
| ** <li> [SQLITE_IOCAP_SEQUENTIAL] |
** <li> [SQLITE_IOCAP_SEQUENTIAL] |
| |
** <li> [SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN] |
| |
** <li> [SQLITE_IOCAP_POWERSAFE_OVERWRITE] |
| |
** <li> [SQLITE_IOCAP_IMMUTABLE] |
| |
** <li> [SQLITE_IOCAP_BATCH_ATOMIC] |
| ** </ul> |
** </ul> |
| ** |
** |
| ** The SQLITE_IOCAP_ATOMIC property means that all writes of |
** The SQLITE_IOCAP_ATOMIC property means that all writes of |
|
Line 792 struct sqlite3_io_methods {
|
Line 826 struct sqlite3_io_methods {
|
| ** file space based on this hint in order to help writes to the database |
** file space based on this hint in order to help writes to the database |
| ** file run faster. |
** file run faster. |
| ** |
** |
| |
** <li>[[SQLITE_FCNTL_SIZE_LIMIT]] |
| |
** The [SQLITE_FCNTL_SIZE_LIMIT] opcode is used by in-memory VFS that |
| |
** implements [sqlite3_deserialize()] to set an upper bound on the size |
| |
** of the in-memory database. The argument is a pointer to a [sqlite3_int64]. |
| |
** If the integer pointed to is negative, then it is filled in with the |
| |
** current limit. Otherwise the limit is set to the larger of the value |
| |
** of the integer pointed to and the current database size. The integer |
| |
** pointed to is set to the new limit. |
| |
** |
| ** <li>[[SQLITE_FCNTL_CHUNK_SIZE]] |
** <li>[[SQLITE_FCNTL_CHUNK_SIZE]] |
| ** The [SQLITE_FCNTL_CHUNK_SIZE] opcode is used to request that the VFS |
** The [SQLITE_FCNTL_CHUNK_SIZE] opcode is used to request that the VFS |
| ** extends and truncates the database file in chunks of a size specified |
** extends and truncates the database file in chunks of a size specified |
|
Line 848 struct sqlite3_io_methods {
|
Line 891 struct sqlite3_io_methods {
|
| ** opcode allows these two values (10 retries and 25 milliseconds of delay) |
** opcode allows these two values (10 retries and 25 milliseconds of delay) |
| ** to be adjusted. The values are changed for all database connections |
** to be adjusted. The values are changed for all database connections |
| ** within the same process. The argument is a pointer to an array of two |
** within the same process. The argument is a pointer to an array of two |
| ** integers where the first integer i the new retry count and the second | ** integers where the first integer is the new retry count and the second |
| ** integer is the delay. If either integer is negative, then the setting |
** integer is the delay. If either integer is negative, then the setting |
| ** is not changed but instead the prior value of that setting is written |
** is not changed but instead the prior value of that setting is written |
| ** into the array entry, allowing the current retry settings to be |
** into the array entry, allowing the current retry settings to be |
|
Line 857 struct sqlite3_io_methods {
|
Line 900 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 |
|
Line 976 struct sqlite3_io_methods {
|
Line 1020 struct sqlite3_io_methods {
|
| ** on whether or not the file has been renamed, moved, or deleted since it |
** on whether or not the file has been renamed, moved, or deleted since it |
| ** was first opened. |
** was first opened. |
| ** |
** |
| |
** <li>[[SQLITE_FCNTL_WIN32_GET_HANDLE]] |
| |
** The [SQLITE_FCNTL_WIN32_GET_HANDLE] opcode can be used to obtain the |
| |
** underlying native file handle associated with a file handle. This file |
| |
** control interprets its argument as a pointer to a native file handle and |
| |
** writes the resulting value there. |
| |
** |
| ** <li>[[SQLITE_FCNTL_WIN32_SET_HANDLE]] |
** <li>[[SQLITE_FCNTL_WIN32_SET_HANDLE]] |
| ** The [SQLITE_FCNTL_WIN32_SET_HANDLE] opcode is used for debugging. This |
** The [SQLITE_FCNTL_WIN32_SET_HANDLE] opcode is used for debugging. This |
| ** opcode causes the xFileControl method to swap the file handle with the one |
** opcode causes the xFileControl method to swap the file handle with the one |
|
Line 997 struct sqlite3_io_methods {
|
Line 1047 struct sqlite3_io_methods {
|
| ** The [SQLITE_FCNTL_RBU] opcode is implemented by the special VFS used by |
** The [SQLITE_FCNTL_RBU] opcode is implemented by the special VFS used by |
| ** the RBU extension only. All other VFS should return SQLITE_NOTFOUND for |
** the RBU extension only. All other VFS should return SQLITE_NOTFOUND for |
| ** this opcode. |
** this opcode. |
| |
** |
| |
** <li>[[SQLITE_FCNTL_BEGIN_ATOMIC_WRITE]] |
| |
** If the [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] opcode returns SQLITE_OK, then |
| |
** the file descriptor is placed in "batch write mode", which |
| |
** means all subsequent write operations will be deferred and done |
| |
** atomically at the next [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]. Systems |
| |
** that do not support batch atomic writes will return SQLITE_NOTFOUND. |
| |
** ^Following a successful SQLITE_FCNTL_BEGIN_ATOMIC_WRITE and prior to |
| |
** the closing [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] or |
| |
** [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE], SQLite will make |
| |
** no VFS interface calls on the same [sqlite3_file] file descriptor |
| |
** except for calls to the xWrite method and the xFileControl method |
| |
** with [SQLITE_FCNTL_SIZE_HINT]. |
| |
** |
| |
** <li>[[SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]] |
| |
** The [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] opcode causes all write |
| |
** operations since the previous successful call to |
| |
** [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] to be performed atomically. |
| |
** This file control returns [SQLITE_OK] if and only if the writes were |
| |
** all performed successfully and have been committed to persistent storage. |
| |
** ^Regardless of whether or not it is successful, this file control takes |
| |
** the file descriptor out of batch write mode so that all subsequent |
| |
** write operations are independent. |
| |
** ^SQLite will never invoke SQLITE_FCNTL_COMMIT_ATOMIC_WRITE without |
| |
** a prior successful call to [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE]. |
| |
** |
| |
** <li>[[SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE]] |
| |
** The [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE] opcode causes all write |
| |
** operations since the previous successful call to |
| |
** [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] to be rolled back. |
| |
** ^This file control takes the file descriptor out of batch write mode |
| |
** so that all subsequent write operations are independent. |
| |
** ^SQLite will never invoke SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE without |
| |
** a prior successful call to [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE]. |
| |
** |
| |
** <li>[[SQLITE_FCNTL_LOCK_TIMEOUT]] |
| |
** The [SQLITE_FCNTL_LOCK_TIMEOUT] opcode causes attempts to obtain |
| |
** 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> |
** </ul> |
| */ |
*/ |
| #define SQLITE_FCNTL_LOCKSTATE 1 |
#define SQLITE_FCNTL_LOCKSTATE 1 |
|
Line 1026 struct sqlite3_io_methods {
|
Line 1136 struct sqlite3_io_methods {
|
| #define SQLITE_FCNTL_RBU 26 |
#define SQLITE_FCNTL_RBU 26 |
| #define SQLITE_FCNTL_VFS_POINTER 27 |
#define SQLITE_FCNTL_VFS_POINTER 27 |
| #define SQLITE_FCNTL_JOURNAL_POINTER 28 |
#define SQLITE_FCNTL_JOURNAL_POINTER 28 |
| |
#define SQLITE_FCNTL_WIN32_GET_HANDLE 29 |
| |
#define SQLITE_FCNTL_PDB 30 |
| |
#define SQLITE_FCNTL_BEGIN_ATOMIC_WRITE 31 |
| |
#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 |
| |
#define SQLITE_FCNTL_SIZE_LIMIT 36 |
| |
|
| /* deprecated names */ |
/* deprecated names */ |
| #define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE |
#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE |
|
Line 1063 typedef struct sqlite3_api_routines sqlite3_api_routin
|
Line 1181 typedef struct sqlite3_api_routines sqlite3_api_routin
|
| ** in the name of the object stands for "virtual file system". See |
** in the name of the object stands for "virtual file system". See |
| ** the [VFS | VFS documentation] for further information. |
** the [VFS | VFS documentation] for further information. |
| ** |
** |
| ** The value of the iVersion field is initially 1 but may be larger in | ** The VFS interface is sometimes extended by adding new methods onto |
| ** future versions of SQLite. Additional fields may be appended to this | ** the end. Each time such an extension occurs, the iVersion field |
| ** object when the iVersion value is increased. Note that the structure | ** is incremented. The iVersion value started out as 1 in |
| ** of the sqlite3_vfs object changes in the transaction between | ** SQLite [version 3.5.0] on [dateof:3.5.0], then increased to 2 |
| ** SQLite version 3.5.9 and 3.6.0 and yet the iVersion field was not | ** with SQLite [version 3.7.0] on [dateof:3.7.0], and then increased |
| ** modified. | ** to 3 with SQLite [version 3.7.6] on [dateof:3.7.6]. Additional fields |
| | ** may be appended to the sqlite3_vfs object and the iVersion value |
| | ** may increase again in future versions of SQLite. |
| | ** Note that the structure |
| | ** of the sqlite3_vfs object changes in the transition from |
| | ** SQLite [version 3.5.9] to [version 3.6.0] on [dateof:3.6.0] |
| | ** and yet the iVersion field was not modified. |
| ** |
** |
| ** The szOsFile field is the size of the subclassed [sqlite3_file] |
** The szOsFile field is the size of the subclassed [sqlite3_file] |
| ** structure used by this VFS. mxPathname is the maximum length of |
** structure used by this VFS. mxPathname is the maximum length of |
|
Line 1172 typedef struct sqlite3_api_routines sqlite3_api_routin
|
Line 1296 typedef struct sqlite3_api_routines sqlite3_api_routin
|
| ** ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS] |
** ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS] |
| ** to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to |
** to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to |
| ** test whether a file is readable and writable, or [SQLITE_ACCESS_READ] |
** test whether a file is readable and writable, or [SQLITE_ACCESS_READ] |
| ** to test whether a file is at least readable. The file can be a | ** to test whether a file is at least readable. The SQLITE_ACCESS_READ |
| ** directory. | ** flag is never actually used and is not implemented in the built-in |
| | ** VFSes of SQLite. The file is named by the second argument and can be a |
| | ** directory. The xAccess method returns [SQLITE_OK] on success or some |
| | ** non-zero error code if there is an I/O error or if the name of |
| | ** the file given in the second argument is illegal. If SQLITE_OK |
| | ** is returned, then non-zero or zero is written into *pResOut to indicate |
| | ** whether or not the file is accessible. |
| ** |
** |
| ** ^SQLite will always allocate at least mxPathname+1 bytes for the |
** ^SQLite will always allocate at least mxPathname+1 bytes for the |
| ** output buffer xFullPathname. The exact size of the output buffer |
** output buffer xFullPathname. The exact size of the output buffer |
|
Line 1596 struct sqlite3_mem_methods {
|
Line 1726 struct sqlite3_mem_methods {
|
| ** routines with a wrapper that simulations memory allocation failure or |
** routines with a wrapper that simulations memory allocation failure or |
| ** tracks memory usage, for example. </dd> |
** tracks memory usage, for example. </dd> |
| ** |
** |
| |
** [[SQLITE_CONFIG_SMALL_MALLOC]] <dt>SQLITE_CONFIG_SMALL_MALLOC</dt> |
| |
** <dd> ^The SQLITE_CONFIG_SMALL_MALLOC option takes single argument of |
| |
** type int, interpreted as a boolean, which if true provides a hint to |
| |
** SQLite that it should avoid large memory allocations if possible. |
| |
** SQLite will run faster if it is free to make large memory allocations, |
| |
** but some application might prefer to run slower in exchange for |
| |
** guarantees about memory fragmentation that are possible if large |
| |
** allocations are avoided. This hint is normally off. |
| |
** </dd> |
| |
** |
| ** [[SQLITE_CONFIG_MEMSTATUS]] <dt>SQLITE_CONFIG_MEMSTATUS</dt> |
** [[SQLITE_CONFIG_MEMSTATUS]] <dt>SQLITE_CONFIG_MEMSTATUS</dt> |
| ** <dd> ^The SQLITE_CONFIG_MEMSTATUS option takes single argument of type int, |
** <dd> ^The SQLITE_CONFIG_MEMSTATUS option takes single argument of type int, |
| ** interpreted as a boolean, which enables or disables the collection of |
** interpreted as a boolean, which enables or disables the collection of |
|
Line 1613 struct sqlite3_mem_methods {
|
Line 1753 struct sqlite3_mem_methods {
|
| ** </dd> |
** </dd> |
| ** |
** |
| ** [[SQLITE_CONFIG_SCRATCH]] <dt>SQLITE_CONFIG_SCRATCH</dt> |
** [[SQLITE_CONFIG_SCRATCH]] <dt>SQLITE_CONFIG_SCRATCH</dt> |
| ** <dd> ^The SQLITE_CONFIG_SCRATCH option specifies a static memory buffer | ** <dd> The SQLITE_CONFIG_SCRATCH option is no longer used. |
| ** that SQLite can use for scratch memory. ^(There are three arguments | |
| ** to SQLITE_CONFIG_SCRATCH: A pointer an 8-byte | |
| ** aligned memory buffer from which the scratch allocations will be | |
| ** drawn, the size of each scratch allocation (sz), | |
| ** and the maximum number of scratch allocations (N).)^ | |
| ** The first argument must be a pointer to an 8-byte aligned buffer | |
| ** of at least sz*N bytes of memory. | |
| ** ^SQLite will not use more than one scratch buffers per thread. | |
| ** ^SQLite will never request a scratch buffer that is more than 6 | |
| ** times the database page size. | |
| ** ^If SQLite needs needs additional | |
| ** scratch memory beyond what is provided by this configuration option, then | |
| ** [sqlite3_malloc()] will be used to obtain the memory needed.<p> | |
| ** ^When the application provides any amount of scratch memory using | |
| ** SQLITE_CONFIG_SCRATCH, SQLite avoids unnecessary large | |
| ** [sqlite3_malloc|heap allocations]. | |
| ** This can help [Robson proof|prevent memory allocation failures] due to heap | |
| ** fragmentation in low-memory embedded systems. | |
| ** </dd> |
** </dd> |
| ** |
** |
| ** [[SQLITE_CONFIG_PAGECACHE]] <dt>SQLITE_CONFIG_PAGECACHE</dt> |
** [[SQLITE_CONFIG_PAGECACHE]] <dt>SQLITE_CONFIG_PAGECACHE</dt> |
|
Line 1667 struct sqlite3_mem_methods {
|
Line 1789 struct sqlite3_mem_methods {
|
| ** [[SQLITE_CONFIG_HEAP]] <dt>SQLITE_CONFIG_HEAP</dt> |
** [[SQLITE_CONFIG_HEAP]] <dt>SQLITE_CONFIG_HEAP</dt> |
| ** <dd> ^The SQLITE_CONFIG_HEAP option specifies a static memory buffer |
** <dd> ^The SQLITE_CONFIG_HEAP option specifies a static memory buffer |
| ** that SQLite will use for all of its dynamic memory allocation needs |
** that SQLite will use for all of its dynamic memory allocation needs |
| ** beyond those provided for by [SQLITE_CONFIG_SCRATCH] and | ** beyond those provided for by [SQLITE_CONFIG_PAGECACHE]. |
| ** [SQLITE_CONFIG_PAGECACHE]. | |
| ** ^The SQLITE_CONFIG_HEAP option is only available if SQLite is compiled |
** ^The SQLITE_CONFIG_HEAP option is only available if SQLite is compiled |
| ** with either [SQLITE_ENABLE_MEMSYS3] or [SQLITE_ENABLE_MEMSYS5] and returns |
** with either [SQLITE_ENABLE_MEMSYS3] or [SQLITE_ENABLE_MEMSYS5] and returns |
| ** [SQLITE_ERROR] if invoked otherwise. |
** [SQLITE_ERROR] if invoked otherwise. |
|
Line 1854 struct sqlite3_mem_methods {
|
Line 1975 struct sqlite3_mem_methods {
|
| ** I/O required to support statement rollback. |
** I/O required to support statement rollback. |
| ** The default value for this setting is controlled by the |
** The default value for this setting is controlled by the |
| ** [SQLITE_STMTJRNL_SPILL] compile-time option. |
** [SQLITE_STMTJRNL_SPILL] compile-time option. |
| |
** |
| |
** [[SQLITE_CONFIG_SORTERREF_SIZE]] |
| |
** <dt>SQLITE_CONFIG_SORTERREF_SIZE |
| |
** <dd>The SQLITE_CONFIG_SORTERREF_SIZE option accepts a single parameter |
| |
** of type (int) - the new value of the sorter-reference size threshold. |
| |
** Usually, when SQLite uses an external sort to order records according |
| |
** to an ORDER BY clause, all fields required by the caller are present in the |
| |
** sorted records. However, if SQLite determines based on the declared type |
| |
** of a table column that its values are likely to be very large - larger |
| |
** than the configured sorter-reference size threshold - then a reference |
| |
** is stored in each sorted record and the required column values loaded |
| |
** from the database as records are returned in sorted order. The default |
| |
** value for this option is to never use this optimization. Specifying a |
| |
** negative value for this option restores the default behaviour. |
| |
** This option is only available if SQLite is compiled with the |
| |
** [SQLITE_ENABLE_SORTER_REFERENCES] compile-time option. |
| |
** |
| |
** [[SQLITE_CONFIG_MEMDB_MAXSIZE]] |
| |
** <dt>SQLITE_CONFIG_MEMDB_MAXSIZE |
| |
** <dd>The SQLITE_CONFIG_MEMDB_MAXSIZE option accepts a single parameter |
| |
** [sqlite3_int64] parameter which is the default maximum size for an in-memory |
| |
** database created using [sqlite3_deserialize()]. This default maximum |
| |
** size can be adjusted up or down for individual databases using the |
| |
** [SQLITE_FCNTL_SIZE_LIMIT] [sqlite3_file_control|file-control]. If this |
| |
** configuration setting is never used, then the default maximum is determined |
| |
** by the [SQLITE_MEMDB_DEFAULT_MAXSIZE] compile-time option. If that |
| |
** compile-time option is not set, then the default maximum is 1073741824. |
| ** </dl> |
** </dl> |
| */ |
*/ |
| #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */ |
#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */ |
|
Line 1861 struct sqlite3_mem_methods {
|
Line 2009 struct sqlite3_mem_methods {
|
| #define SQLITE_CONFIG_SERIALIZED 3 /* nil */ |
#define SQLITE_CONFIG_SERIALIZED 3 /* nil */ |
| #define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */ |
#define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */ |
| #define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */ |
#define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */ |
| #define SQLITE_CONFIG_SCRATCH 6 /* void*, int sz, int N */ | #define SQLITE_CONFIG_SCRATCH 6 /* No longer used */ |
| #define SQLITE_CONFIG_PAGECACHE 7 /* void*, int sz, int N */ |
#define SQLITE_CONFIG_PAGECACHE 7 /* void*, int sz, int N */ |
| #define SQLITE_CONFIG_HEAP 8 /* void*, int nByte, int min */ |
#define SQLITE_CONFIG_HEAP 8 /* void*, int nByte, int min */ |
| #define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */ |
#define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */ |
|
Line 1882 struct sqlite3_mem_methods {
|
Line 2030 struct sqlite3_mem_methods {
|
| #define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */ |
#define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */ |
| #define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */ |
#define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */ |
| #define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */ |
#define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */ |
| |
#define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */ |
| |
#define SQLITE_CONFIG_SORTERREF_SIZE 28 /* int nByte */ |
| |
#define SQLITE_CONFIG_MEMDB_MAXSIZE 29 /* sqlite3_int64 */ |
| |
|
| /* |
/* |
| ** CAPI3REF: Database Connection Configuration Options |
** CAPI3REF: Database Connection Configuration Options |
|
Line 1897 struct sqlite3_mem_methods {
|
Line 2048 struct sqlite3_mem_methods {
|
| ** is invoked. |
** is invoked. |
| ** |
** |
| ** <dl> |
** <dl> |
| |
** [[SQLITE_DBCONFIG_LOOKASIDE]] |
| ** <dt>SQLITE_DBCONFIG_LOOKASIDE</dt> |
** <dt>SQLITE_DBCONFIG_LOOKASIDE</dt> |
| ** <dd> ^This option takes three additional arguments that determine the |
** <dd> ^This option takes three additional arguments that determine the |
| ** [lookaside memory allocator] configuration for the [database connection]. |
** [lookaside memory allocator] configuration for the [database connection]. |
|
Line 1919 struct sqlite3_mem_methods {
|
Line 2071 struct sqlite3_mem_methods {
|
| ** 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> |
| ** |
** |
| |
** [[SQLITE_DBCONFIG_ENABLE_FKEY]] |
| ** <dt>SQLITE_DBCONFIG_ENABLE_FKEY</dt> |
** <dt>SQLITE_DBCONFIG_ENABLE_FKEY</dt> |
| ** <dd> ^This option is used to enable or disable the enforcement of |
** <dd> ^This option is used to enable or disable the enforcement of |
| ** [foreign key constraints]. There should be two additional arguments. |
** [foreign key constraints]. There should be two additional arguments. |
|
Line 1929 struct sqlite3_mem_methods {
|
Line 2082 struct sqlite3_mem_methods {
|
| ** following this call. The second parameter may be a NULL pointer, in |
** following this call. The second parameter may be a NULL pointer, in |
| ** which case the FK enforcement setting is not reported back. </dd> |
** which case the FK enforcement setting is not reported back. </dd> |
| ** |
** |
| |
** [[SQLITE_DBCONFIG_ENABLE_TRIGGER]] |
| ** <dt>SQLITE_DBCONFIG_ENABLE_TRIGGER</dt> |
** <dt>SQLITE_DBCONFIG_ENABLE_TRIGGER</dt> |
| ** <dd> ^This option is used to enable or disable [CREATE TRIGGER | triggers]. |
** <dd> ^This option is used to enable or disable [CREATE TRIGGER | triggers]. |
| ** There should be two additional arguments. |
** There should be two additional arguments. |
|
Line 1939 struct sqlite3_mem_methods {
|
Line 2093 struct sqlite3_mem_methods {
|
| ** following this call. The second parameter may be a NULL pointer, in |
** following this call. The second parameter may be a NULL pointer, in |
| ** which case the trigger setting is not reported back. </dd> |
** which case the trigger setting is not reported back. </dd> |
| ** |
** |
| |
** [[SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER]] |
| ** <dt>SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER</dt> |
** <dt>SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER</dt> |
| ** <dd> ^This option is used to enable or disable the two-argument | ** <dd> ^This option is used to enable or disable the |
| ** version of the [fts3_tokenizer()] function which is part of the | ** [fts3_tokenizer()] function which is part of the |
| ** [FTS3] full-text search engine extension. |
** [FTS3] full-text search engine extension. |
| ** There should be two additional arguments. |
** There should be two additional arguments. |
| ** The first argument is an integer which is 0 to disable fts3_tokenizer() or |
** The first argument is an integer which is 0 to disable fts3_tokenizer() or |
|
Line 1952 struct sqlite3_mem_methods {
|
Line 2107 struct sqlite3_mem_methods {
|
| ** following this call. The second parameter may be a NULL pointer, in |
** following this call. The second parameter may be a NULL pointer, in |
| ** which case the new setting is not reported back. </dd> |
** which case the new setting is not reported back. </dd> |
| ** |
** |
| |
** [[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION]] |
| ** <dt>SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION</dt> |
** <dt>SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION</dt> |
| ** <dd> ^This option is used to enable or disable the [sqlite3_load_extension()] |
** <dd> ^This option is used to enable or disable the [sqlite3_load_extension()] |
| ** interface independently of the [load_extension()] SQL function. |
** interface independently of the [load_extension()] SQL function. |
|
Line 1969 struct sqlite3_mem_methods {
|
Line 2125 struct sqlite3_mem_methods {
|
| ** be a NULL pointer, in which case the new setting is not reported back. |
** be a NULL pointer, in which case the new setting is not reported back. |
| ** </dd> |
** </dd> |
| ** |
** |
| |
** [[SQLITE_DBCONFIG_MAINDBNAME]] <dt>SQLITE_DBCONFIG_MAINDBNAME</dt> |
| |
** <dd> ^This option is used to change the name of the "main" database |
| |
** schema. ^The sole argument is a pointer to a constant UTF8 string |
| |
** which will become the new schema name in place of "main". ^SQLite |
| |
** does not make a copy of the new main schema name string, so the application |
| |
** must ensure that the argument passed into this DBCONFIG option is unchanged |
| |
** until after the database connection closes. |
| |
** </dd> |
| |
** |
| |
** [[SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE]] |
| |
** <dt>SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE</dt> |
| |
** <dd> Usually, when a database in wal mode is closed or detached from a |
| |
** database handle, SQLite checks if this will mean that there are now no |
| |
** connections at all to the database. If so, it performs a checkpoint |
| |
** operation before closing the connection. This option may be used to |
| |
** override this behaviour. The first parameter passed to this operation |
| |
** is an integer - positive to disable checkpoints-on-close, or zero (the |
| |
** default) to enable them, and negative to leave the setting unchanged. |
| |
** The second parameter is a pointer to an integer |
| |
** into which is written 0 or 1 to indicate whether checkpoints-on-close |
| |
** have been disabled - 0 if they are not disabled, 1 if they are. |
| |
** </dd> |
| |
** |
| |
** [[SQLITE_DBCONFIG_ENABLE_QPSG]] <dt>SQLITE_DBCONFIG_ENABLE_QPSG</dt> |
| |
** <dd>^(The SQLITE_DBCONFIG_ENABLE_QPSG option activates or deactivates |
| |
** the [query planner stability guarantee] (QPSG). When the QPSG is active, |
| |
** a single SQL query statement will always use the same algorithm regardless |
| |
** of values of [bound parameters].)^ The QPSG disables some query optimizations |
| |
** that look at the values of bound parameters, which can make some queries |
| |
** slower. But the QPSG has the advantage of more predictable behavior. With |
| |
** the QPSG active, SQLite will always use the same query plan in the field as |
| |
** was used during testing in the lab. |
| |
** The first argument to this setting is an integer which is 0 to disable |
| |
** the QPSG, positive to enable QPSG, or negative to leave the setting |
| |
** unchanged. The second parameter is a pointer to an integer into which |
| |
** is written 0 or 1 to indicate whether the QPSG is disabled or enabled |
| |
** following this call. |
| |
** </dd> |
| |
** |
| |
** [[SQLITE_DBCONFIG_TRIGGER_EQP]] <dt>SQLITE_DBCONFIG_TRIGGER_EQP</dt> |
| |
** <dd> By default, the output of EXPLAIN QUERY PLAN commands does not |
| |
** include output for any operations performed by trigger programs. This |
| |
** option is used to set or clear (the default) a flag that governs this |
| |
** behavior. The first parameter passed to this operation is an integer - |
| |
** positive to enable output for trigger programs, or zero to disable it, |
| |
** or negative to leave the setting unchanged. |
| |
** The second parameter is a pointer to an integer into which is written |
| |
** 0 or 1 to indicate whether output-for-triggers has been disabled - 0 if |
| |
** it is not disabled, 1 if it is. |
| |
** </dd> |
| |
** |
| |
** [[SQLITE_DBCONFIG_RESET_DATABASE]] <dt>SQLITE_DBCONFIG_RESET_DATABASE</dt> |
| |
** <dd> Set the SQLITE_DBCONFIG_RESET_DATABASE flag and then run |
| |
** [VACUUM] in order to reset a database back to an empty database |
| |
** 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); |
| |
** </ol> |
| |
** Because resetting a database is destructive and irreversible, the |
| |
** process requires the use of this obscure API and multiple steps to help |
| |
** ensure that it does not happen by accident. |
| |
** |
| |
** [[SQLITE_DBCONFIG_DEFENSIVE]] <dt>SQLITE_DBCONFIG_DEFENSIVE</dt> |
| |
** <dd>The SQLITE_DBCONFIG_DEFENSIVE option activates or deactivates the |
| |
** "defensive" flag for a database connection. When the defensive |
| |
** flag is enabled, language features that allow ordinary SQL to |
| |
** deliberately corrupt the database file are disabled. The disabled |
| |
** features include but are not limited to the following: |
| |
** <ul> |
| |
** <li> The [PRAGMA writable_schema=ON] statement. |
| |
** <li> The [PRAGMA journal_mode=OFF] statement. |
| |
** <li> Writes to the [sqlite_dbpage] virtual table. |
| |
** <li> Direct writes to [shadow tables]. |
| |
** </ul> |
| |
** </dd> |
| |
** |
| |
** [[SQLITE_DBCONFIG_WRITABLE_SCHEMA]] <dt>SQLITE_DBCONFIG_WRITABLE_SCHEMA</dt> |
| |
** <dd>The SQLITE_DBCONFIG_WRITABLE_SCHEMA option activates or deactivates the |
| |
** "writable_schema" flag. This has the same effect and is logically equivalent |
| |
** to setting [PRAGMA writable_schema=ON] or [PRAGMA writable_schema=OFF]. |
| |
** The first argument to this setting is an integer which is 0 to disable |
| |
** the writable_schema, positive to enable writable_schema, or negative to |
| |
** leave the setting unchanged. The second parameter is a pointer to an |
| |
** integer into which is written 0 or 1 to indicate whether the writable_schema |
| |
** is enabled or disabled following this call. |
| |
** </dd> |
| |
** |
| |
** [[SQLITE_DBCONFIG_LEGACY_ALTER_TABLE]] |
| |
** <dt>SQLITE_DBCONFIG_LEGACY_ALTER_TABLE</dt> |
| |
** <dd>The SQLITE_DBCONFIG_LEGACY_ALTER_TABLE option activates or deactivates |
| |
** the legacy behavior of the [ALTER TABLE RENAME] command such it |
| |
** behaves as it did prior to [version 3.24.0] (2018-06-04). See the |
| |
** "Compatibility Notice" on the [ALTER TABLE RENAME documentation] for |
| |
** additional information. This feature can also be turned on and off |
| |
** using the [PRAGMA legacy_alter_table] statement. |
| |
** </dd> |
| |
** |
| |
** [[SQLITE_DBCONFIG_DQS_DML]] |
| |
** <dt>SQLITE_DBCONFIG_DQS_DML</td> |
| |
** <dd>The SQLITE_DBCONFIG_DQS_DML option activates or deactivates |
| |
** the legacy [double-quoted string literal] misfeature for DML statement |
| |
** only, that is DELETE, INSERT, SELECT, and UPDATE statements. The |
| |
** default value of this setting is determined by the [-DSQLITE_DQS] |
| |
** compile-time option. |
| |
** </dd> |
| |
** |
| |
** [[SQLITE_DBCONFIG_DQS_DDL]] |
| |
** <dt>SQLITE_DBCONFIG_DQS_DDL</td> |
| |
** <dd>The SQLITE_DBCONFIG_DQS option activates or deactivates |
| |
** the legacy [double-quoted string literal] misfeature for DDL statements, |
| |
** such as CREATE TABLE and CREATE INDEX. The |
| |
** default value of this setting is determined by the [-DSQLITE_DQS] |
| |
** compile-time option. |
| |
** </dd> |
| ** </dl> |
** </dl> |
| */ |
*/ |
| |
#define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */ |
| #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */ |
#define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */ |
| #define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */ |
#define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */ |
| #define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */ |
#define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */ |
| #define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004 /* int int* */ |
#define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004 /* int int* */ |
| #define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005 /* int int* */ |
#define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005 /* int int* */ |
| |
#define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE 1006 /* int int* */ |
| |
#define SQLITE_DBCONFIG_ENABLE_QPSG 1007 /* int int* */ |
| |
#define SQLITE_DBCONFIG_TRIGGER_EQP 1008 /* int int* */ |
| |
#define SQLITE_DBCONFIG_RESET_DATABASE 1009 /* int int* */ |
| |
#define SQLITE_DBCONFIG_DEFENSIVE 1010 /* int int* */ |
| |
#define SQLITE_DBCONFIG_WRITABLE_SCHEMA 1011 /* int int* */ |
| |
#define SQLITE_DBCONFIG_LEGACY_ALTER_TABLE 1012 /* int int* */ |
| |
#define SQLITE_DBCONFIG_DQS_DML 1013 /* int int* */ |
| |
#define SQLITE_DBCONFIG_DQS_DDL 1014 /* int int* */ |
| |
#define SQLITE_DBCONFIG_MAX 1014 /* Largest DBCONFIG */ |
| |
|
| |
|
| /* |
/* |
| ** CAPI3REF: Enable Or Disable Extended Result Codes |
** CAPI3REF: Enable Or Disable Extended Result Codes |
| ** METHOD: sqlite3 |
** METHOD: sqlite3 |
|
Line 2000 SQLITE_API int sqlite3_extended_result_codes(sqlite3*,
|
Line 2289 SQLITE_API int sqlite3_extended_result_codes(sqlite3*,
|
| ** the table has a column of type [INTEGER PRIMARY KEY] then that column |
** the table has a column of type [INTEGER PRIMARY KEY] then that column |
| ** is another alias for the rowid. |
** is another alias for the rowid. |
| ** |
** |
| ** ^The sqlite3_last_insert_rowid(D) interface returns the [rowid] of the | ** ^The sqlite3_last_insert_rowid(D) interface usually returns the [rowid] of |
| ** most recent successful [INSERT] into a rowid table or [virtual table] | ** the most recent successful [INSERT] into a rowid table or [virtual table] |
| ** on database connection D. | ** on database connection D. ^Inserts into [WITHOUT ROWID] tables are not |
| ** ^Inserts into [WITHOUT ROWID] tables are not recorded. | ** recorded. ^If no successful [INSERT]s into rowid tables have ever occurred |
| ** ^If no successful [INSERT]s into rowid tables | ** on the database connection D, then sqlite3_last_insert_rowid(D) returns |
| ** have ever occurred on the database connection D, | ** zero. |
| ** then sqlite3_last_insert_rowid(D) returns zero. | |
| ** |
** |
| ** ^(If an [INSERT] occurs within a trigger or within a [virtual table] | ** As well as being set automatically as rows are inserted into database |
| ** method, then this routine will return the [rowid] of the inserted | ** tables, the value returned by this function may be set explicitly by |
| ** row as long as the trigger or virtual table method is running. | ** [sqlite3_set_last_insert_rowid()] |
| ** But once the trigger or virtual table method ends, the value returned | |
| ** by this routine reverts to what it was before the trigger or virtual | |
| ** table method began.)^ | |
| ** |
** |
| |
** Some virtual table implementations may INSERT rows into rowid tables as |
| |
** part of committing a transaction (e.g. to flush data accumulated in memory |
| |
** to disk). In this case subsequent calls to this function return the rowid |
| |
** associated with these internal INSERT operations, which leads to |
| |
** unintuitive results. Virtual table implementations that do write to rowid |
| |
** tables in this way can avoid this problem by restoring the original |
| |
** rowid value using [sqlite3_set_last_insert_rowid()] before returning |
| |
** control to the user. |
| |
** |
| |
** ^(If an [INSERT] occurs within a trigger then this routine will |
| |
** return the [rowid] of the inserted row as long as the trigger is |
| |
** running. Once the trigger program ends, the value returned |
| |
** by this routine reverts to what it was before the trigger was fired.)^ |
| |
** |
| ** ^An [INSERT] that fails due to a constraint violation is not a |
** ^An [INSERT] that fails due to a constraint violation is not a |
| ** successful [INSERT] and does not change the value returned by this |
** successful [INSERT] and does not change the value returned by this |
| ** routine. ^Thus INSERT OR FAIL, INSERT OR IGNORE, INSERT OR ROLLBACK, |
** routine. ^Thus INSERT OR FAIL, INSERT OR IGNORE, INSERT OR ROLLBACK, |
|
Line 2041 SQLITE_API int sqlite3_extended_result_codes(sqlite3*,
|
Line 2340 SQLITE_API int sqlite3_extended_result_codes(sqlite3*,
|
| SQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*); |
SQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*); |
| |
|
| /* |
/* |
| |
** CAPI3REF: Set the Last Insert Rowid value. |
| |
** METHOD: sqlite3 |
| |
** |
| |
** The sqlite3_set_last_insert_rowid(D, R) method allows the application to |
| |
** set the value returned by calling sqlite3_last_insert_rowid(D) to R |
| |
** without inserting a row into the database. |
| |
*/ |
| |
SQLITE_API void sqlite3_set_last_insert_rowid(sqlite3*,sqlite3_int64); |
| |
|
| |
/* |
| ** CAPI3REF: Count The Number Of Rows Modified |
** CAPI3REF: Count The Number Of Rows Modified |
| ** METHOD: sqlite3 |
** METHOD: sqlite3 |
| ** |
** |
|
Line 2084 SQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sql
|
Line 2393 SQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sql
|
| ** 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*); |
| |
|
|
Line 2107 SQLITE_API int sqlite3_changes(sqlite3*);
|
Line 2421 SQLITE_API int sqlite3_changes(sqlite3*);
|
| ** count, but those made as part of REPLACE constraint resolution are |
** count, but those made as part of REPLACE constraint resolution are |
| ** 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 |
|
| ** [count_changes pragma], and the [total_changes() SQL function]. |
|
| ** |
** |
| |
** 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 |
** 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*); |
| |
|
|
Line 2151 SQLITE_API int sqlite3_total_changes(sqlite3*);
|
Line 2478 SQLITE_API int sqlite3_total_changes(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. |
| ** |
|
| ** If the database connection closes while [sqlite3_interrupt()] |
|
| ** is running then bad things will likely happen. |
|
| */ |
*/ |
| SQLITE_API void sqlite3_interrupt(sqlite3*); |
SQLITE_API void sqlite3_interrupt(sqlite3*); |
| |
|
|
Line 2365 SQLITE_API void sqlite3_free_table(char **result);
|
Line 2689 SQLITE_API void sqlite3_free_table(char **result);
|
| ** |
** |
| ** These routines are work-alikes of the "printf()" family of functions |
** These routines are work-alikes of the "printf()" family of functions |
| ** from the standard C library. |
** from the standard C library. |
| ** These routines understand most of the common K&R formatting options, | ** These routines understand most of the common formatting options from |
| ** plus some additional non-standard formats, detailed below. | ** the standard library printf() |
| ** Note that some of the more obscure formatting options from recent | ** plus some additional non-standard formats ([%q], [%Q], [%w], and [%z]). |
| ** C-library standards are omitted from this implementation. | ** See the [built-in printf()] documentation for details. |
| ** |
** |
| ** ^The sqlite3_mprintf() and sqlite3_vmprintf() routines write their |
** ^The sqlite3_mprintf() and sqlite3_vmprintf() routines write their |
| ** results into memory obtained from [sqlite3_malloc()]. | ** results into memory obtained from [sqlite3_malloc64()]. |
| ** The strings returned by these two routines should be |
** The strings returned by these two routines should be |
| ** released by [sqlite3_free()]. ^Both routines return a |
** released by [sqlite3_free()]. ^Both routines return a |
| ** NULL pointer if [sqlite3_malloc()] is unable to allocate enough | ** NULL pointer if [sqlite3_malloc64()] is unable to allocate enough |
| ** memory to hold the resulting string. |
** memory to hold the resulting string. |
| ** |
** |
| ** ^(The sqlite3_snprintf() routine is similar to "snprintf()" from |
** ^(The sqlite3_snprintf() routine is similar to "snprintf()" from |
|
Line 2398 SQLITE_API void sqlite3_free_table(char **result);
|
Line 2722 SQLITE_API void sqlite3_free_table(char **result);
|
| ** |
** |
| ** ^The sqlite3_vsnprintf() routine is a varargs version of sqlite3_snprintf(). |
** ^The sqlite3_vsnprintf() routine is a varargs version of sqlite3_snprintf(). |
| ** |
** |
| ** These routines all implement some additional formatting | ** See also: [built-in printf()], [printf() SQL function] |
| ** options that are useful for constructing SQL statements. | |
| ** All of the usual printf() formatting options apply. In addition, there | |
| ** is are "%q", "%Q", "%w" and "%z" options. | |
| ** | |
| ** ^(The %q option works like %s in that it substitutes a nul-terminated | |
| ** string from the argument list. But %q also doubles every '\'' character. | |
| ** %q is designed for use inside a string literal.)^ By doubling each '\'' | |
| ** character it escapes that character and allows it to be inserted into | |
| ** the string. | |
| ** | |
| ** For example, assume the string variable zText contains text as follows: | |
| ** | |
| ** <blockquote><pre> | |
| ** char *zText = "It's a happy day!"; | |
| ** </pre></blockquote> | |
| ** | |
| ** One can use this text in an SQL statement as follows: | |
| ** | |
| ** <blockquote><pre> | |
| ** char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES('%q')", zText); | |
| ** sqlite3_exec(db, zSQL, 0, 0, 0); | |
| ** sqlite3_free(zSQL); | |
| ** </pre></blockquote> | |
| ** | |
| ** Because the %q format string is used, the '\'' character in zText | |
| ** is escaped and the SQL generated is as follows: | |
| ** | |
| ** <blockquote><pre> | |
| ** INSERT INTO table1 VALUES('It''s a happy day!') | |
| ** </pre></blockquote> | |
| ** | |
| ** This is correct. Had we used %s instead of %q, the generated SQL | |
| ** would have looked like this: | |
| ** | |
| ** <blockquote><pre> | |
| ** INSERT INTO table1 VALUES('It's a happy day!'); | |
| ** </pre></blockquote> | |
| ** | |
| ** This second example is an SQL syntax error. As a general rule you should | |
| ** always use %q instead of %s when inserting text into a string literal. | |
| ** | |
| ** ^(The %Q option works like %q except it also adds single quotes around | |
| ** the outside of the total string. Additionally, if the parameter in the | |
| ** argument list is a NULL pointer, %Q substitutes the text "NULL" (without | |
| ** single quotes).)^ So, for example, one could say: | |
| ** | |
| ** <blockquote><pre> | |
| ** char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES(%Q)", zText); | |
| ** sqlite3_exec(db, zSQL, 0, 0, 0); | |
| ** sqlite3_free(zSQL); | |
| ** </pre></blockquote> | |
| ** | |
| ** The code above will render a correct SQL statement in the zSQL | |
| ** variable even if the zText variable is a NULL pointer. | |
| ** | |
| ** ^(The "%w" formatting option is like "%q" except that it expects to | |
| ** be contained within double-quotes instead of single quotes, and it | |
| ** escapes the double-quote character instead of the single-quote | |
| ** character.)^ The "%w" formatting option is intended for safely inserting | |
| ** table and column names into a constructed SQL statement. | |
| ** | |
| ** ^(The "%z" formatting option works like "%s" but with the | |
| ** addition that after the string has been read and copied into | |
| ** the result, [sqlite3_free()] is called on the input string.)^ | |
| */ |
*/ |
| SQLITE_API char *sqlite3_mprintf(const char*,...); |
SQLITE_API char *sqlite3_mprintf(const char*,...); |
| SQLITE_API char *sqlite3_vmprintf(const char*, va_list); |
SQLITE_API char *sqlite3_vmprintf(const char*, va_list); |
|
Line 2616 SQLITE_API void sqlite3_randomness(int N, void *P);
|
Line 2876 SQLITE_API void sqlite3_randomness(int N, void *P);
|
| /* |
/* |
| ** CAPI3REF: Compile-Time Authorization Callbacks |
** CAPI3REF: Compile-Time Authorization Callbacks |
| ** METHOD: sqlite3 |
** METHOD: sqlite3 |
| |
** KEYWORDS: {authorizer callback} |
| ** |
** |
| ** ^This routine registers an authorizer callback with a particular |
** ^This routine registers an authorizer callback with a particular |
| ** [database connection], supplied in the first argument. |
** [database connection], supplied in the first argument. |
| ** ^The authorizer callback is invoked as SQL statements are being compiled |
** ^The authorizer callback is invoked as SQL statements are being compiled |
| ** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()], |
** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()], |
| ** [sqlite3_prepare16()] and [sqlite3_prepare16_v2()]. ^At various | ** [sqlite3_prepare_v3()], [sqlite3_prepare16()], [sqlite3_prepare16_v2()], |
| | ** and [sqlite3_prepare16_v3()]. ^At various |
| ** points during the compilation process, as logic is being created |
** points during the compilation process, as logic is being created |
| ** to perform various actions, the authorizer callback is invoked to |
** to perform various actions, the authorizer callback is invoked to |
| ** see if those actions are allowed. ^The authorizer callback should |
** see if those actions are allowed. ^The authorizer callback should |
|
Line 2643 SQLITE_API void sqlite3_randomness(int N, void *P);
|
Line 2905 SQLITE_API void sqlite3_randomness(int N, void *P);
|
| ** parameter to the sqlite3_set_authorizer() interface. ^The second parameter |
** parameter to the sqlite3_set_authorizer() interface. ^The second parameter |
| ** to the callback is an integer [SQLITE_COPY | action code] that specifies |
** to the callback is an integer [SQLITE_COPY | action code] that specifies |
| ** the particular action to be authorized. ^The third through sixth parameters |
** the particular action to be authorized. ^The third through sixth parameters |
| ** to the callback are zero-terminated strings that contain additional | ** to the callback are either NULL pointers or zero-terminated strings |
| ** details about the action to be authorized. | ** that contain additional details about the action to be authorized. |
| | ** Applications must always be prepared to encounter a NULL pointer in any |
| | ** of the third through the sixth parameters of the authorization callback. |
| ** |
** |
| ** ^If the action code is [SQLITE_READ] |
** ^If the action code is [SQLITE_READ] |
| ** and the callback returns [SQLITE_IGNORE] then the |
** and the callback returns [SQLITE_IGNORE] then the |
|
Line 2653 SQLITE_API void sqlite3_randomness(int N, void *P);
|
Line 2917 SQLITE_API void sqlite3_randomness(int N, void *P);
|
| ** been read if [SQLITE_OK] had been returned. The [SQLITE_IGNORE] |
** been read if [SQLITE_OK] had been returned. The [SQLITE_IGNORE] |
| ** return can be used to deny an untrusted user access to individual |
** return can be used to deny an untrusted user access to individual |
| ** columns of a table. |
** columns of a table. |
| |
** ^When a table is referenced by a [SELECT] but no column values are |
| |
** extracted from that table (for example in a query like |
| |
** "SELECT count(*) FROM tab") then the [SQLITE_READ] authorizer callback |
| |
** is invoked once for that table with a column name that is an empty string. |
| ** ^If the action code is [SQLITE_DELETE] and the callback returns |
** ^If the action code is [SQLITE_DELETE] and the callback returns |
| ** [SQLITE_IGNORE] then the [DELETE] operation proceeds but the |
** [SQLITE_IGNORE] then the [DELETE] operation proceeds but the |
| ** [truncate optimization] is disabled and all rows are deleted individually. |
** [truncate optimization] is disabled and all rows are deleted individually. |
|
Line 2798 SQLITE_API int sqlite3_set_authorizer(
|
Line 3066 SQLITE_API int sqlite3_set_authorizer(
|
| ** time is in units of nanoseconds, however the current implementation |
** time is in units of nanoseconds, however the current implementation |
| ** is only capable of millisecond resolution so the six least significant |
** is only capable of millisecond resolution so the six least significant |
| ** digits in the time are meaningless. Future versions of SQLite |
** digits in the time are meaningless. Future versions of SQLite |
| ** might provide greater resolution on the profiler callback. The | ** might provide greater resolution on the profiler callback. Invoking |
| ** sqlite3_profile() function is considered experimental and is | ** either [sqlite3_trace()] or [sqlite3_trace_v2()] will cancel the |
| ** subject to change in future versions of SQLite. | ** profile callback. |
| */ |
*/ |
| SQLITE_API SQLITE_DEPRECATED void *sqlite3_trace(sqlite3*, |
SQLITE_API SQLITE_DEPRECATED void *sqlite3_trace(sqlite3*, |
| void(*xTrace)(void*,const char*), void*); |
void(*xTrace)(void*,const char*), void*); |
|
Line 2812 SQLITE_API SQLITE_DEPRECATED void *sqlite3_profile(sql
|
Line 3080 SQLITE_API SQLITE_DEPRECATED void *sqlite3_profile(sql
|
| ** KEYWORDS: SQLITE_TRACE |
** KEYWORDS: SQLITE_TRACE |
| ** |
** |
| ** These constants identify classes of events that can be monitored |
** These constants identify classes of events that can be monitored |
| ** using the [sqlite3_trace_v2()] tracing logic. The third argument | ** using the [sqlite3_trace_v2()] tracing logic. The M argument |
| ** to [sqlite3_trace_v2()] is an OR-ed combination of one or more of | ** to [sqlite3_trace_v2(D,M,X,P)] is an OR-ed combination of one or more of |
| ** the following constants. ^The first argument to the trace callback |
** the following constants. ^The first argument to the trace callback |
| ** is one of the following constants. |
** is one of the following constants. |
| ** |
** |
|
Line 3022 SQLITE_API void sqlite3_progress_handler(sqlite3*, int
|
Line 3290 SQLITE_API void sqlite3_progress_handler(sqlite3*, int
|
| ** ^If [URI filename] interpretation is enabled, and the filename argument |
** ^If [URI filename] interpretation is enabled, and the filename argument |
| ** begins with "file:", then the filename is interpreted as a URI. ^URI |
** begins with "file:", then the filename is interpreted as a URI. ^URI |
| ** filename interpretation is enabled if the [SQLITE_OPEN_URI] flag is |
** filename interpretation is enabled if the [SQLITE_OPEN_URI] flag is |
| ** set in the fourth argument to sqlite3_open_v2(), or if it has | ** set in the third argument to sqlite3_open_v2(), or if it has |
| ** been enabled globally using the [SQLITE_CONFIG_URI] option with the |
** been enabled globally using the [SQLITE_CONFIG_URI] option with the |
| ** [sqlite3_config()] method or by the [SQLITE_USE_URI] compile-time option. |
** [sqlite3_config()] method or by the [SQLITE_USE_URI] compile-time option. |
| ** As of SQLite version 3.7.7, URI filename interpretation is turned off | ** URI filename interpretation is turned off |
| ** by default, but future releases of SQLite might enable URI filename |
** by default, but future releases of SQLite might enable URI filename |
| ** interpretation by default. See "[URI filenames]" for additional |
** interpretation by default. See "[URI filenames]" for additional |
| ** information. |
** information. |
|
Line 3214 SQLITE_API int sqlite3_open_v2(
|
Line 3482 SQLITE_API int sqlite3_open_v2(
|
| ** is not a database file pathname pointer that SQLite passed into the xOpen |
** is not a database file pathname pointer that SQLite passed into the xOpen |
| ** VFS method, then the behavior of this routine is undefined and probably |
** VFS method, then the behavior of this routine is undefined and probably |
| ** undesirable. |
** undesirable. |
| |
** |
| |
** See the [URI filename] documentation for additional information. |
| */ |
*/ |
| SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam); |
SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam); |
| SQLITE_API int sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault); |
SQLITE_API int sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault); |
|
Line 3228 SQLITE_API sqlite3_int64 sqlite3_uri_int64(const char*
|
Line 3498 SQLITE_API sqlite3_int64 sqlite3_uri_int64(const char*
|
| ** [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. |
|
Line 3364 SQLITE_API int sqlite3_limit(sqlite3*, int id, int new
|
Line 3645 SQLITE_API int sqlite3_limit(sqlite3*, int id, int new
|
| ** |
** |
| ** [[SQLITE_LIMIT_VDBE_OP]] ^(<dt>SQLITE_LIMIT_VDBE_OP</dt> |
** [[SQLITE_LIMIT_VDBE_OP]] ^(<dt>SQLITE_LIMIT_VDBE_OP</dt> |
| ** <dd>The maximum number of instructions in a virtual machine program |
** <dd>The maximum number of instructions in a virtual machine program |
| ** used to implement an SQL statement. This limit is not currently | ** used to implement an SQL statement. If [sqlite3_prepare_v2()] or |
| ** enforced, though that might be added in some future release of | ** the equivalent tries to allocate space for more than this many opcodes |
| ** SQLite.</dd>)^ | ** in a single prepared statement, an SQLITE_NOMEM error is returned.</dd>)^ |
| ** |
** |
| ** [[SQLITE_LIMIT_FUNCTION_ARG]] ^(<dt>SQLITE_LIMIT_FUNCTION_ARG</dt> |
** [[SQLITE_LIMIT_FUNCTION_ARG]] ^(<dt>SQLITE_LIMIT_FUNCTION_ARG</dt> |
| ** <dd>The maximum number of arguments on a function.</dd>)^ |
** <dd>The maximum number of arguments on a function.</dd>)^ |
|
Line 3405 SQLITE_API int sqlite3_limit(sqlite3*, int id, int new
|
Line 3686 SQLITE_API int sqlite3_limit(sqlite3*, int id, int new
|
| #define SQLITE_LIMIT_WORKER_THREADS 11 |
#define SQLITE_LIMIT_WORKER_THREADS 11 |
| |
|
| /* |
/* |
| |
** CAPI3REF: Prepare Flags |
| |
** |
| |
** These constants define various flags that can be passed into |
| |
** "prepFlags" parameter of the [sqlite3_prepare_v3()] and |
| |
** [sqlite3_prepare16_v3()] interfaces. |
| |
** |
| |
** New flags may be added in future releases of SQLite. |
| |
** |
| |
** <dl> |
| |
** [[SQLITE_PREPARE_PERSISTENT]] ^(<dt>SQLITE_PREPARE_PERSISTENT</dt> |
| |
** <dd>The SQLITE_PREPARE_PERSISTENT flag is a hint to the query planner |
| |
** that the prepared statement will be retained for a long time and |
| |
** probably reused many times.)^ ^Without this flag, [sqlite3_prepare_v3()] |
| |
** and [sqlite3_prepare16_v3()] assume that the prepared statement will |
| |
** be used just once or at most a few times and then destroyed using |
| |
** [sqlite3_finalize()] relatively soon. The current implementation acts |
| |
** on this hint by avoiding the use of [lookaside memory] so as not to |
| |
** deplete the limited store of lookaside memory. Future versions of |
| |
** SQLite may act on this hint differently. |
| |
** |
| |
** [[SQLITE_PREPARE_NORMALIZE]] <dt>SQLITE_PREPARE_NORMALIZE</dt> |
| |
** <dd>The SQLITE_PREPARE_NORMALIZE flag is a no-op. This flag used |
| |
** to be required for any prepared statement that wanted to use the |
| |
** [sqlite3_normalized_sql()] interface. However, the |
| |
** [sqlite3_normalized_sql()] interface is now available to all |
| |
** prepared statements, regardless of whether or not they use this |
| |
** flag. |
| |
** |
| |
** [[SQLITE_PREPARE_NO_VTAB]] <dt>SQLITE_PREPARE_NO_VTAB</dt> |
| |
** <dd>The SQLITE_PREPARE_NO_VTAB flag causes the SQL compiler |
| |
** to return an error (error code SQLITE_ERROR) if the statement uses |
| |
** any virtual tables. |
| |
** </dl> |
| |
*/ |
| |
#define SQLITE_PREPARE_PERSISTENT 0x01 |
| |
#define SQLITE_PREPARE_NORMALIZE 0x02 |
| |
#define SQLITE_PREPARE_NO_VTAB 0x04 |
| |
|
| |
/* |
| ** CAPI3REF: Compiling An SQL Statement |
** CAPI3REF: Compiling An SQL Statement |
| ** KEYWORDS: {SQL statement compiler} |
** KEYWORDS: {SQL statement compiler} |
| ** METHOD: sqlite3 |
** METHOD: sqlite3 |
| ** CONSTRUCTOR: sqlite3_stmt |
** CONSTRUCTOR: sqlite3_stmt |
| ** |
** |
| ** To execute an SQL query, it must first be compiled into a byte-code | ** To execute an SQL statement, it must first be compiled into a byte-code |
| ** program using one of these routines. | ** program using one of these routines. Or, in other words, these routines |
| | ** are constructors for the [prepared statement] object. |
| ** |
** |
| |
** The preferred routine to use is [sqlite3_prepare_v2()]. The |
| |
** [sqlite3_prepare()] interface is legacy and should be avoided. |
| |
** [sqlite3_prepare_v3()] has an extra "prepFlags" option that is used |
| |
** for special purposes. |
| |
** |
| |
** The use of the UTF-8 interfaces is preferred, as SQLite currently |
| |
** does all parsing using UTF-8. The UTF-16 interfaces are provided |
| |
** as a convenience. The UTF-16 interfaces work by converting the |
| |
** input text into UTF-8, then invoking the corresponding UTF-8 interface. |
| |
** |
| ** The first argument, "db", is a [database connection] obtained from a |
** The first argument, "db", is a [database connection] obtained from a |
| ** prior successful call to [sqlite3_open()], [sqlite3_open_v2()] or |
** prior successful call to [sqlite3_open()], [sqlite3_open_v2()] or |
| ** [sqlite3_open16()]. The database connection must not have been closed. |
** [sqlite3_open16()]. The database connection must not have been closed. |
| ** |
** |
| ** The second argument, "zSql", is the statement to be compiled, encoded |
** The second argument, "zSql", is the statement to be compiled, encoded |
| ** as either UTF-8 or UTF-16. The sqlite3_prepare() and sqlite3_prepare_v2() | ** as either UTF-8 or UTF-16. The sqlite3_prepare(), sqlite3_prepare_v2(), |
| ** interfaces use UTF-8, and sqlite3_prepare16() and sqlite3_prepare16_v2() | ** and sqlite3_prepare_v3() |
| ** use UTF-16. | ** interfaces use UTF-8, and sqlite3_prepare16(), sqlite3_prepare16_v2(), |
| | ** and sqlite3_prepare16_v3() use UTF-16. |
| ** |
** |
| ** ^If the nByte argument is negative, then zSql is read up to the |
** ^If the nByte argument is negative, then zSql is read up to the |
| ** first zero terminator. ^If nByte is positive, then it is the |
** first zero terminator. ^If nByte is positive, then it is the |
|
Line 3447 SQLITE_API int sqlite3_limit(sqlite3*, int id, int new
|
Line 3779 SQLITE_API int sqlite3_limit(sqlite3*, int id, int new
|
| ** ^On success, the sqlite3_prepare() family of routines return [SQLITE_OK]; |
** ^On success, the sqlite3_prepare() family of routines return [SQLITE_OK]; |
| ** otherwise an [error code] is returned. |
** otherwise an [error code] is returned. |
| ** |
** |
| ** The sqlite3_prepare_v2() and sqlite3_prepare16_v2() interfaces are | ** The sqlite3_prepare_v2(), sqlite3_prepare_v3(), sqlite3_prepare16_v2(), |
| ** recommended for all new programs. The two older interfaces are retained | ** and sqlite3_prepare16_v3() interfaces are recommended for all new programs. |
| ** for backwards compatibility, but their use is discouraged. | ** The older interfaces (sqlite3_prepare() and sqlite3_prepare16()) |
| ** ^In the "v2" interfaces, the prepared statement | ** are retained for backwards compatibility, but their use is discouraged. |
| | ** ^In the "vX" interfaces, the prepared statement |
| ** that is returned (the [sqlite3_stmt] object) contains a copy of the |
** that is returned (the [sqlite3_stmt] object) contains a copy of the |
| ** original SQL text. This causes the [sqlite3_step()] interface to |
** original SQL text. This causes the [sqlite3_step()] interface to |
| ** behave differently in three ways: |
** behave differently in three ways: |
|
Line 3484 SQLITE_API int sqlite3_limit(sqlite3*, int id, int new
|
Line 3817 SQLITE_API int sqlite3_limit(sqlite3*, int id, int new
|
| ** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled. |
** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled. |
| ** </li> |
** </li> |
| ** </ol> |
** </ol> |
| |
** |
| |
** <p>^sqlite3_prepare_v3() differs from sqlite3_prepare_v2() only in having |
| |
** the extra prepFlags parameter, which is a bit array consisting of zero or |
| |
** more of the [SQLITE_PREPARE_PERSISTENT|SQLITE_PREPARE_*] flags. ^The |
| |
** sqlite3_prepare_v2() interface works exactly the same as |
| |
** sqlite3_prepare_v3() with a zero prepFlags parameter. |
| */ |
*/ |
| SQLITE_API int sqlite3_prepare( |
SQLITE_API int sqlite3_prepare( |
| sqlite3 *db, /* Database handle */ |
sqlite3 *db, /* Database handle */ |
|
Line 3499 SQLITE_API int sqlite3_prepare_v2(
|
Line 3838 SQLITE_API int sqlite3_prepare_v2(
|
| sqlite3_stmt **ppStmt, /* OUT: Statement handle */ |
sqlite3_stmt **ppStmt, /* OUT: Statement handle */ |
| const char **pzTail /* OUT: Pointer to unused portion of zSql */ |
const char **pzTail /* OUT: Pointer to unused portion of zSql */ |
| ); |
); |
| |
SQLITE_API int sqlite3_prepare_v3( |
| |
sqlite3 *db, /* Database handle */ |
| |
const char *zSql, /* SQL statement, UTF-8 encoded */ |
| |
int nByte, /* Maximum length of zSql in bytes. */ |
| |
unsigned int prepFlags, /* Zero or more SQLITE_PREPARE_ flags */ |
| |
sqlite3_stmt **ppStmt, /* OUT: Statement handle */ |
| |
const char **pzTail /* OUT: Pointer to unused portion of zSql */ |
| |
); |
| SQLITE_API int sqlite3_prepare16( |
SQLITE_API int sqlite3_prepare16( |
| sqlite3 *db, /* Database handle */ |
sqlite3 *db, /* Database handle */ |
| const void *zSql, /* SQL statement, UTF-16 encoded */ |
const void *zSql, /* SQL statement, UTF-16 encoded */ |
|
Line 3513 SQLITE_API int sqlite3_prepare16_v2(
|
Line 3860 SQLITE_API int sqlite3_prepare16_v2(
|
| sqlite3_stmt **ppStmt, /* OUT: Statement handle */ |
sqlite3_stmt **ppStmt, /* OUT: Statement handle */ |
| const void **pzTail /* OUT: Pointer to unused portion of zSql */ |
const void **pzTail /* OUT: Pointer to unused portion of zSql */ |
| ); |
); |
| |
SQLITE_API int sqlite3_prepare16_v3( |
| |
sqlite3 *db, /* Database handle */ |
| |
const void *zSql, /* SQL statement, UTF-16 encoded */ |
| |
int nByte, /* Maximum length of zSql in bytes. */ |
| |
unsigned int prepFlags, /* Zero or more SQLITE_PREPARE_ flags */ |
| |
sqlite3_stmt **ppStmt, /* OUT: Statement handle */ |
| |
const void **pzTail /* OUT: Pointer to unused portion of zSql */ |
| |
); |
| |
|
| /* |
/* |
| ** CAPI3REF: Retrieving Statement SQL |
** CAPI3REF: Retrieving Statement SQL |
|
Line 3520 SQLITE_API int sqlite3_prepare16_v2(
|
Line 3875 SQLITE_API int sqlite3_prepare16_v2(
|
| ** |
** |
| ** ^The sqlite3_sql(P) interface returns a pointer to a copy of the UTF-8 |
** ^The sqlite3_sql(P) interface returns a pointer to a copy of the UTF-8 |
| ** SQL text used to create [prepared statement] P if P was |
** SQL text used to create [prepared statement] P if P was |
| ** created by either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()]. | ** created by [sqlite3_prepare_v2()], [sqlite3_prepare_v3()], |
| | ** [sqlite3_prepare16_v2()], or [sqlite3_prepare16_v3()]. |
| ** ^The sqlite3_expanded_sql(P) interface returns a pointer to a UTF-8 |
** ^The sqlite3_expanded_sql(P) interface returns a pointer to a UTF-8 |
| ** string containing the SQL text of prepared statement P with |
** string containing the SQL text of prepared statement P with |
| ** [bound parameters] expanded. |
** [bound parameters] expanded. |
| |
** ^The sqlite3_normalized_sql(P) interface returns a pointer to a UTF-8 |
| |
** string containing the normalized SQL text of prepared statement P. The |
| |
** semantics used to normalize a SQL statement are unspecified and subject |
| |
** to change. At a minimum, literal values will be replaced with suitable |
| |
** placeholders. |
| ** |
** |
| ** ^(For example, if a prepared statement is created using the SQL |
** ^(For example, if a prepared statement is created using the SQL |
| ** text "SELECT $abc,:xyz" and if parameter $abc is bound to integer 2345 |
** text "SELECT $abc,:xyz" and if parameter $abc is bound to integer 2345 |
|
Line 3539 SQLITE_API int sqlite3_prepare16_v2(
|
Line 3900 SQLITE_API int sqlite3_prepare16_v2(
|
| ** bound parameter expansions. ^The [SQLITE_OMIT_TRACE] compile-time |
** bound parameter expansions. ^The [SQLITE_OMIT_TRACE] compile-time |
| ** option causes sqlite3_expanded_sql() to always return NULL. |
** option causes sqlite3_expanded_sql() to always return NULL. |
| ** |
** |
| ** ^The string returned by sqlite3_sql(P) is managed by SQLite and is | ** ^The strings returned by sqlite3_sql(P) and sqlite3_normalized_sql(P) |
| ** automatically freed when the prepared statement is finalized. | ** are managed by SQLite and are automatically freed when the prepared |
| | ** statement is finalized. |
| ** ^The string returned by sqlite3_expanded_sql(P), on the other hand, |
** ^The string returned by sqlite3_expanded_sql(P), on the other hand, |
| ** is obtained from [sqlite3_malloc()] and must be free by the application |
** is obtained from [sqlite3_malloc()] and must be free by the application |
| ** by passing it to [sqlite3_free()]. |
** by passing it to [sqlite3_free()]. |
| */ |
*/ |
| SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt); |
SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt); |
| SQLITE_API char *sqlite3_expanded_sql(sqlite3_stmt *pStmt); |
SQLITE_API char *sqlite3_expanded_sql(sqlite3_stmt *pStmt); |
| |
SQLITE_API const char *sqlite3_normalized_sql(sqlite3_stmt *pStmt); |
| |
|
| /* |
/* |
| ** CAPI3REF: Determine If An SQL Statement Writes The Database |
** CAPI3REF: Determine If An SQL Statement Writes The Database |
|
Line 3577 SQLITE_API char *sqlite3_expanded_sql(sqlite3_stmt *pS
|
Line 3940 SQLITE_API char *sqlite3_expanded_sql(sqlite3_stmt *pS
|
| ** sqlite3_stmt_readonly() to return true since, while those statements |
** sqlite3_stmt_readonly() to return true since, while those statements |
| ** change the configuration of a database connection, they do not make |
** change the configuration of a database connection, they do not make |
| ** changes to the content of the database files on disk. |
** changes to the content of the database files on disk. |
| |
** ^The sqlite3_stmt_readonly() interface returns true for [BEGIN] since |
| |
** [BEGIN] merely sets internal flags, but the [BEGIN|BEGIN IMMEDIATE] and |
| |
** [BEGIN|BEGIN EXCLUSIVE] commands do touch the database and so |
| |
** sqlite3_stmt_readonly() returns false for those commands. |
| */ |
*/ |
| SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt); |
SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt); |
| |
|
| /* |
/* |
| |
** CAPI3REF: Query The EXPLAIN Setting For A Prepared Statement |
| |
** METHOD: sqlite3_stmt |
| |
** |
| |
** ^The sqlite3_stmt_isexplain(S) interface returns 1 if the |
| |
** prepared statement S is an EXPLAIN statement, or 2 if the |
| |
** statement S is an EXPLAIN QUERY PLAN. |
| |
** ^The sqlite3_stmt_isexplain(S) interface returns 0 if S is |
| |
** an ordinary statement or a NULL pointer. |
| |
*/ |
| |
SQLITE_API int sqlite3_stmt_isexplain(sqlite3_stmt *pStmt); |
| |
|
| |
/* |
| ** CAPI3REF: Determine If A Prepared Statement Has Been Reset |
** CAPI3REF: Determine If A Prepared Statement Has Been Reset |
| ** METHOD: sqlite3_stmt |
** METHOD: sqlite3_stmt |
| ** |
** |
|
Line 3635 SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*);
|
Line 4014 SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*);
|
| ** implementation of [application-defined SQL functions] are protected. |
** implementation of [application-defined SQL functions] are protected. |
| ** ^The sqlite3_value object returned by |
** ^The sqlite3_value object returned by |
| ** [sqlite3_column_value()] is unprotected. |
** [sqlite3_column_value()] is unprotected. |
| ** Unprotected sqlite3_value objects may only be used with | ** Unprotected sqlite3_value objects may only be used as arguments |
| ** [sqlite3_result_value()] and [sqlite3_bind_value()]. | ** to [sqlite3_result_value()], [sqlite3_bind_value()], and |
| | ** [sqlite3_value_dup()]. |
| ** The [sqlite3_value_blob | sqlite3_value_type()] family of |
** The [sqlite3_value_blob | sqlite3_value_type()] family of |
| ** interfaces require protected sqlite3_value objects. |
** interfaces require protected sqlite3_value objects. |
| */ |
*/ |
| typedef struct Mem sqlite3_value; | typedef struct sqlite3_value sqlite3_value; |
| |
|
| /* |
/* |
| ** CAPI3REF: SQL Function Context Object |
** CAPI3REF: SQL Function Context Object |
|
Line 3718 typedef struct sqlite3_context sqlite3_context;
|
Line 4098 typedef struct sqlite3_context sqlite3_context;
|
| ** ^The fifth argument to the BLOB and string binding interfaces |
** ^The fifth argument to the BLOB and string binding interfaces |
| ** is a destructor used to dispose of the BLOB or |
** is a destructor used to dispose of the BLOB or |
| ** string after SQLite has finished with it. ^The destructor is called |
** string after SQLite has finished with it. ^The destructor is called |
| ** to dispose of the BLOB or string even if the call to bind API fails. | ** to dispose of the BLOB or string even 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. |
| ** ^If the fifth argument is |
** ^If the fifth argument is |
| ** the special value [SQLITE_STATIC], then SQLite assumes that the |
** the special value [SQLITE_STATIC], then SQLite assumes that the |
| ** information is in static, unmanaged space and does not need to be freed. |
** information is in static, unmanaged space and does not need to be freed. |
|
Line 3742 typedef struct sqlite3_context sqlite3_context;
|
Line 4124 typedef struct sqlite3_context sqlite3_context;
|
| ** [sqlite3_blob_open | incremental BLOB I/O] routines. |
** [sqlite3_blob_open | incremental BLOB I/O] routines. |
| ** ^A negative value for the zeroblob results in a zero-length BLOB. |
** ^A negative value for the zeroblob results in a zero-length BLOB. |
| ** |
** |
| |
** ^The sqlite3_bind_pointer(S,I,P,T,D) routine causes the I-th parameter in |
| |
** [prepared statement] S to have an SQL value of NULL, but to also be |
| |
** associated with the pointer P of type T. ^D is either a NULL pointer or |
| |
** a pointer to a destructor function for P. ^SQLite will invoke the |
| |
** destructor D with a single argument of P when it is finished using |
| |
** P. The T parameter should be a static string, preferably a string |
| |
** literal. The sqlite3_bind_pointer() routine is part of the |
| |
** [pointer passing interface] added for SQLite 3.20.0. |
| |
** |
| ** ^If any of the sqlite3_bind_*() routines are called with a NULL pointer |
** ^If any of the sqlite3_bind_*() routines are called with a NULL pointer |
| ** for the [prepared statement] or with a prepared statement for which |
** for the [prepared statement] or with a prepared statement for which |
| ** [sqlite3_step()] has been called more recently than [sqlite3_reset()], |
** [sqlite3_step()] has been called more recently than [sqlite3_reset()], |
|
Line 3775 SQLITE_API int sqlite3_bind_text16(sqlite3_stmt*, int,
|
Line 4166 SQLITE_API int sqlite3_bind_text16(sqlite3_stmt*, int,
|
| SQLITE_API int sqlite3_bind_text64(sqlite3_stmt*, int, const char*, sqlite3_uint64, |
SQLITE_API int sqlite3_bind_text64(sqlite3_stmt*, int, const char*, sqlite3_uint64, |
| void(*)(void*), unsigned char encoding); |
void(*)(void*), unsigned char encoding); |
| SQLITE_API int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*); |
SQLITE_API int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*); |
| |
SQLITE_API int sqlite3_bind_pointer(sqlite3_stmt*, int, void*, const char*,void(*)(void*)); |
| SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n); |
SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n); |
| SQLITE_API int sqlite3_bind_zeroblob64(sqlite3_stmt*, int, sqlite3_uint64); |
SQLITE_API int sqlite3_bind_zeroblob64(sqlite3_stmt*, int, sqlite3_uint64); |
| |
|
|
Line 3818 SQLITE_API int sqlite3_bind_parameter_count(sqlite3_st
|
Line 4210 SQLITE_API int sqlite3_bind_parameter_count(sqlite3_st
|
| ** ^If the value N is out of range or if the N-th parameter is |
** ^If the value N is out of range or if the N-th parameter is |
| ** nameless, then NULL is returned. ^The returned string is |
** nameless, then NULL is returned. ^The returned string is |
| ** always in UTF-8 encoding even if the named parameter was |
** always in UTF-8 encoding even if the named parameter was |
| ** originally specified as UTF-16 in [sqlite3_prepare16()] or | ** originally specified as UTF-16 in [sqlite3_prepare16()], |
| ** [sqlite3_prepare16_v2()]. | ** [sqlite3_prepare16_v2()], or [sqlite3_prepare16_v3()]. |
| ** |
** |
| ** See also: [sqlite3_bind_blob|sqlite3_bind()], |
** See also: [sqlite3_bind_blob|sqlite3_bind()], |
| ** [sqlite3_bind_parameter_count()], and |
** [sqlite3_bind_parameter_count()], and |
|
Line 3836 SQLITE_API const char *sqlite3_bind_parameter_name(sql
|
Line 4228 SQLITE_API const char *sqlite3_bind_parameter_name(sql
|
| ** parameter to [sqlite3_bind_blob|sqlite3_bind()]. ^A zero |
** parameter to [sqlite3_bind_blob|sqlite3_bind()]. ^A zero |
| ** is returned if no matching parameter is found. ^The parameter |
** is returned if no matching parameter is found. ^The parameter |
| ** name must be given in UTF-8 even if the original statement |
** name must be given in UTF-8 even if the original statement |
| ** was prepared from UTF-16 text using [sqlite3_prepare16_v2()]. | ** was prepared from UTF-16 text using [sqlite3_prepare16_v2()] or |
| | ** [sqlite3_prepare16_v3()]. |
| ** |
** |
| ** See also: [sqlite3_bind_blob|sqlite3_bind()], |
** See also: [sqlite3_bind_blob|sqlite3_bind()], |
| ** [sqlite3_bind_parameter_count()], and |
** [sqlite3_bind_parameter_count()], and |
|
Line 3859 SQLITE_API int sqlite3_clear_bindings(sqlite3_stmt*);
|
Line 4252 SQLITE_API int sqlite3_clear_bindings(sqlite3_stmt*);
|
| ** METHOD: sqlite3_stmt |
** METHOD: sqlite3_stmt |
| ** |
** |
| ** ^Return the number of columns in the result set returned by the |
** ^Return the number of columns in the result set returned by the |
| ** [prepared statement]. ^This routine returns 0 if pStmt is an SQL | ** [prepared statement]. ^If this routine returns 0, that means the |
| ** statement that does not return data (for example an [UPDATE]). | ** [prepared statement] returns no data (for example an [UPDATE]). |
| | ** ^However, just because this routine returns a positive number does not |
| | ** mean that one or more rows of data will be returned. ^A SELECT statement |
| | ** will always have a positive sqlite3_column_count() but depending on the |
| | ** WHERE clause constraints and the table content, it might return no rows. |
| ** |
** |
| ** See also: [sqlite3_data_count()] |
** See also: [sqlite3_data_count()] |
| */ |
*/ |
|
Line 3986 SQLITE_API const void *sqlite3_column_decltype16(sqlit
|
Line 4383 SQLITE_API const void *sqlite3_column_decltype16(sqlit
|
| ** CAPI3REF: Evaluate An SQL Statement |
** CAPI3REF: Evaluate An SQL Statement |
| ** METHOD: sqlite3_stmt |
** METHOD: sqlite3_stmt |
| ** |
** |
| ** After a [prepared statement] has been prepared using either | ** After a [prepared statement] has been prepared using any of |
| ** [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] or one of the legacy | ** [sqlite3_prepare_v2()], [sqlite3_prepare_v3()], [sqlite3_prepare16_v2()], |
| | ** or [sqlite3_prepare16_v3()] or one of the legacy |
| ** interfaces [sqlite3_prepare()] or [sqlite3_prepare16()], this function |
** interfaces [sqlite3_prepare()] or [sqlite3_prepare16()], this function |
| ** must be called one or more times to evaluate the statement. |
** must be called one or more times to evaluate the statement. |
| ** |
** |
| ** The details of the behavior of the sqlite3_step() interface depend |
** The details of the behavior of the sqlite3_step() interface depend |
| ** on whether the statement was prepared using the newer "v2" interface | ** on whether the statement was prepared using the newer "vX" interfaces |
| ** [sqlite3_prepare_v2()] and [sqlite3_prepare16_v2()] or the older legacy | ** [sqlite3_prepare_v3()], [sqlite3_prepare_v2()], [sqlite3_prepare16_v3()], |
| ** interface [sqlite3_prepare()] and [sqlite3_prepare16()]. The use of the | ** [sqlite3_prepare16_v2()] or the older legacy |
| ** new "v2" interface is recommended for new applications but the legacy | ** interfaces [sqlite3_prepare()] and [sqlite3_prepare16()]. The use of the |
| | ** new "vX" interface is recommended for new applications but the legacy |
| ** interface will continue to be supported. |
** interface will continue to be supported. |
| ** |
** |
| ** ^In the legacy interface, the return value will be either [SQLITE_BUSY], |
** ^In the legacy interface, the return value will be either [SQLITE_BUSY], |
|
Line 4041 SQLITE_API const void *sqlite3_column_decltype16(sqlit
|
Line 4440 SQLITE_API const void *sqlite3_column_decltype16(sqlit
|
| ** other than [SQLITE_ROW] before any subsequent invocation of |
** other than [SQLITE_ROW] before any subsequent invocation of |
| ** sqlite3_step(). Failure to reset the prepared statement using |
** sqlite3_step(). Failure to reset the prepared statement using |
| ** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from |
** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from |
| ** sqlite3_step(). But after version 3.6.23.1, sqlite3_step() began | ** sqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1], |
| | ** sqlite3_step() began |
| ** calling [sqlite3_reset()] automatically in this circumstance rather |
** calling [sqlite3_reset()] automatically in this circumstance rather |
| ** than returning [SQLITE_MISUSE]. This is not considered a compatibility |
** than returning [SQLITE_MISUSE]. This is not considered a compatibility |
| ** break because any application that ever receives an SQLITE_MISUSE error |
** break because any application that ever receives an SQLITE_MISUSE error |
|
Line 4055 SQLITE_API const void *sqlite3_column_decltype16(sqlit
|
Line 4455 SQLITE_API const void *sqlite3_column_decltype16(sqlit
|
| ** specific [error codes] that better describes the error. |
** specific [error codes] that better describes the error. |
| ** We admit that this is a goofy design. The problem has been fixed |
** We admit that this is a goofy design. The problem has been fixed |
| ** with the "v2" interface. If you prepare all of your SQL statements |
** with the "v2" interface. If you prepare all of your SQL statements |
| ** using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] instead | ** using [sqlite3_prepare_v3()] or [sqlite3_prepare_v2()] |
| | ** or [sqlite3_prepare16_v2()] or [sqlite3_prepare16_v3()] instead |
| ** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces, |
** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces, |
| ** then the more specific [error codes] are returned directly |
** then the more specific [error codes] are returned directly |
| ** by sqlite3_step(). The use of the "v2" interface is recommended. | ** by sqlite3_step(). The use of the "vX" interfaces is recommended. |
| */ |
*/ |
| SQLITE_API int sqlite3_step(sqlite3_stmt*); |
SQLITE_API int sqlite3_step(sqlite3_stmt*); |
| |
|
|
Line 4120 SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt)
|
Line 4521 SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt)
|
| ** KEYWORDS: {column access functions} |
** KEYWORDS: {column access functions} |
| ** METHOD: sqlite3_stmt |
** METHOD: sqlite3_stmt |
| ** |
** |
| |
** <b>Summary:</b> |
| |
** <blockquote><table border=0 cellpadding=0 cellspacing=0> |
| |
** <tr><td><b>sqlite3_column_blob</b><td>→<td>BLOB result |
| |
** <tr><td><b>sqlite3_column_double</b><td>→<td>REAL result |
| |
** <tr><td><b>sqlite3_column_int</b><td>→<td>32-bit INTEGER result |
| |
** <tr><td><b>sqlite3_column_int64</b><td>→<td>64-bit INTEGER result |
| |
** <tr><td><b>sqlite3_column_text</b><td>→<td>UTF-8 TEXT result |
| |
** <tr><td><b>sqlite3_column_text16</b><td>→<td>UTF-16 TEXT result |
| |
** <tr><td><b>sqlite3_column_value</b><td>→<td>The result as an |
| |
** [sqlite3_value|unprotected sqlite3_value] object. |
| |
** <tr><td> <td> <td> |
| |
** <tr><td><b>sqlite3_column_bytes</b><td>→<td>Size of a BLOB |
| |
** or a UTF-8 TEXT result in bytes |
| |
** <tr><td><b>sqlite3_column_bytes16 </b> |
| |
** <td>→ <td>Size of UTF-16 |
| |
** TEXT in bytes |
| |
** <tr><td><b>sqlite3_column_type</b><td>→<td>Default |
| |
** datatype of the result |
| |
** </table></blockquote> |
| |
** |
| |
** <b>Details:</b> |
| |
** |
| ** ^These routines return information about a single column of the current |
** ^These routines return information about a single column of the current |
| ** result row of a query. ^In every case the first argument is a pointer |
** result row of a query. ^In every case the first argument is a pointer |
| ** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*] |
** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*] |
|
Line 4141 SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt)
|
Line 4564 SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt)
|
| ** are called from a different thread while any of these routines |
** are called from a different thread while any of these routines |
| ** are pending, then the results are undefined. |
** are pending, then the results are undefined. |
| ** |
** |
| |
** The first six interfaces (_blob, _double, _int, _int64, _text, and _text16) |
| |
** each return the value of a result column in a specific data format. If |
| |
** the result column is not initially in the requested format (for example, |
| |
** if the query returns an integer but the sqlite3_column_text() interface |
| |
** is used to extract the value) then an automatic type conversion is performed. |
| |
** |
| ** ^The sqlite3_column_type() routine returns the |
** ^The sqlite3_column_type() routine returns the |
| ** [SQLITE_INTEGER | datatype code] for the initial data type |
** [SQLITE_INTEGER | datatype code] for the initial data type |
| ** of the result column. ^The returned value is one of [SQLITE_INTEGER], |
** of the result column. ^The returned value is one of [SQLITE_INTEGER], |
| ** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL]. The value | ** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL]. |
| ** returned by sqlite3_column_type() is only meaningful if no type | ** The return value of sqlite3_column_type() can be used to decide which |
| ** conversions have occurred as described below. After a type conversion, | ** of the first six interface should be used to extract the column value. |
| ** the value returned by sqlite3_column_type() is undefined. Future | ** The value returned by sqlite3_column_type() is only meaningful if no |
| | ** automatic type conversions have occurred for the value in question. |
| | ** After a type conversion, the result of calling sqlite3_column_type() |
| | ** is undefined, though harmless. Future |
| ** versions of SQLite may change the behavior of sqlite3_column_type() |
** versions of SQLite may change the behavior of sqlite3_column_type() |
| ** following a type conversion. |
** following a type conversion. |
| ** |
** |
| |
** If the result is a BLOB or a TEXT string, then the sqlite3_column_bytes() |
| |
** or sqlite3_column_bytes16() interfaces can be used to determine the size |
| |
** of that BLOB or string. |
| |
** |
| ** ^If the result is a BLOB or UTF-8 string then the sqlite3_column_bytes() |
** ^If the result is a BLOB or UTF-8 string then the sqlite3_column_bytes() |
| ** routine returns the number of bytes in that BLOB or string. |
** routine returns the number of bytes in that BLOB or string. |
| ** ^If the result is a UTF-16 string, then sqlite3_column_bytes() converts |
** ^If the result is a UTF-16 string, then sqlite3_column_bytes() converts |
|
Line 4187 SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt)
|
Line 4623 SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt)
|
| ** [sqlite3_column_value()] is used in any other way, including calls |
** [sqlite3_column_value()] is used in any other way, including calls |
| ** to routines like [sqlite3_value_int()], [sqlite3_value_text()], |
** to routines like [sqlite3_value_int()], [sqlite3_value_text()], |
| ** or [sqlite3_value_bytes()], the behavior is not threadsafe. |
** or [sqlite3_value_bytes()], the behavior is not threadsafe. |
| |
** Hence, the sqlite3_column_value() interface |
| |
** is normally only useful within the implementation of |
| |
** [application-defined SQL functions] or [virtual tables], not within |
| |
** top-level application code. |
| ** |
** |
| ** These routines attempt to convert the value where appropriate. ^For | ** The these routines may attempt to convert the datatype of the result. |
| ** example, if the internal representation is FLOAT and a text result | ** ^For example, if the internal representation is FLOAT and a text result |
| ** is requested, [sqlite3_snprintf()] is used internally to perform the |
** is requested, [sqlite3_snprintf()] is used internally to perform the |
| ** conversion automatically. ^(The following table details the conversions |
** conversion automatically. ^(The following table details the conversions |
| ** that are applied: |
** that are applied: |
|
Line 4261 SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt)
|
Line 4701 SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt)
|
| ** ^The pointers returned are valid until a type conversion occurs as |
** ^The pointers returned are valid until a type conversion occurs as |
| ** described above, or until [sqlite3_step()] or [sqlite3_reset()] or |
** described above, or until [sqlite3_step()] or [sqlite3_reset()] or |
| ** [sqlite3_finalize()] is called. ^The memory space used to hold strings |
** [sqlite3_finalize()] is called. ^The memory space used to hold strings |
| ** and BLOBs is freed automatically. Do <em>not</em> pass the pointers returned | ** and BLOBs is freed automatically. Do not pass the pointers returned |
| ** 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 int sqlite3_column_bytes(sqlite3_stmt*, int iCol); |
|
| SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol); |
|
| SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol); |
SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol); |
| SQLITE_API int sqlite3_column_int(sqlite3_stmt*, int iCol); |
SQLITE_API int sqlite3_column_int(sqlite3_stmt*, int iCol); |
| SQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol); |
SQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol); |
| SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol); |
SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol); |
| SQLITE_API const void *sqlite3_column_text16(sqlite3_stmt*, int iCol); |
SQLITE_API const void *sqlite3_column_text16(sqlite3_stmt*, int iCol); |
| SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol); |
|
| SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol); |
SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol); |
| |
SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol); |
| |
SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol); |
| |
SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol); |
| |
|
| /* |
/* |
| ** CAPI3REF: Destroy A Prepared Statement Object |
** CAPI3REF: Destroy A Prepared Statement Object |
|
Line 4346 SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
|
Line 4800 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 |
|
Line 4396 SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
|
Line 4852 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 |
|
Line 4405 SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
|
Line 4862 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 |
| ** arguments or differing preferred text encodings. ^SQLite will use |
** arguments or differing preferred text encodings. ^SQLite will use |
|
Line 4466 SQLITE_API int sqlite3_create_function_v2(
|
Line 4932 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 |
|
Line 4514 SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(
|
Line 4992 SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(
|
| ** CAPI3REF: Obtaining SQL Values |
** CAPI3REF: Obtaining SQL Values |
| ** METHOD: sqlite3_value |
** METHOD: sqlite3_value |
| ** |
** |
| ** The C-language implementation of SQL functions and aggregates uses | ** <b>Summary:</b> |
| ** this set of interface routines to access the parameter values on | ** <blockquote><table border=0 cellpadding=0 cellspacing=0> |
| ** the function or aggregate. | ** <tr><td><b>sqlite3_value_blob</b><td>→<td>BLOB value |
| | ** <tr><td><b>sqlite3_value_double</b><td>→<td>REAL value |
| | ** <tr><td><b>sqlite3_value_int</b><td>→<td>32-bit INTEGER value |
| | ** <tr><td><b>sqlite3_value_int64</b><td>→<td>64-bit INTEGER value |
| | ** <tr><td><b>sqlite3_value_pointer</b><td>→<td>Pointer value |
| | ** <tr><td><b>sqlite3_value_text</b><td>→<td>UTF-8 TEXT value |
| | ** <tr><td><b>sqlite3_value_text16</b><td>→<td>UTF-16 TEXT value in |
| | ** the native byteorder |
| | ** <tr><td><b>sqlite3_value_text16be</b><td>→<td>UTF-16be TEXT value |
| | ** <tr><td><b>sqlite3_value_text16le</b><td>→<td>UTF-16le TEXT value |
| | ** <tr><td> <td> <td> |
| | ** <tr><td><b>sqlite3_value_bytes</b><td>→<td>Size of a BLOB |
| | ** or a UTF-8 TEXT in bytes |
| | ** <tr><td><b>sqlite3_value_bytes16 </b> |
| | ** <td>→ <td>Size of UTF-16 |
| | ** TEXT in bytes |
| | ** <tr><td><b>sqlite3_value_type</b><td>→<td>Default |
| | ** datatype of the value |
| | ** <tr><td><b>sqlite3_value_numeric_type </b> |
| | ** <td>→ <td>Best numeric datatype of the value |
| | ** <tr><td><b>sqlite3_value_nochange </b> |
| | ** <td>→ <td>True if the column is unchanged in an UPDATE |
| | ** against a virtual table. |
| | ** <tr><td><b>sqlite3_value_frombind </b> |
| | ** <td>→ <td>True if value originated from a [bound parameter] |
| | ** </table></blockquote> |
| ** |
** |
| ** The xFunc (for scalar functions) or xStep (for aggregates) parameters | ** <b>Details:</b> |
| ** to [sqlite3_create_function()] and [sqlite3_create_function16()] | |
| ** define callbacks that implement the SQL functions and aggregates. | |
| ** The 3rd parameter to these callbacks is an array of pointers to | |
| ** [protected sqlite3_value] objects. There is one [sqlite3_value] object for | |
| ** each parameter to the SQL function. These routines are used to | |
| ** extract values from the [sqlite3_value] objects. | |
| ** |
** |
| |
** These routines extract type, size, and content information from |
| |
** [protected sqlite3_value] objects. Protected sqlite3_value objects |
| |
** are used to pass parameter information into implementation of |
| |
** [application-defined SQL functions] and [virtual tables]. |
| |
** |
| ** These routines work only with [protected sqlite3_value] objects. |
** These routines work only with [protected sqlite3_value] objects. |
| ** Any attempt to use these routines on an [unprotected sqlite3_value] |
** Any attempt to use these routines on an [unprotected sqlite3_value] |
| ** object results in undefined behavior. | ** is not threadsafe. |
| ** |
** |
| ** ^These routines work just like the corresponding [column access functions] |
** ^These routines work just like the corresponding [column access functions] |
| ** except that these routines take a single [protected sqlite3_value] object |
** except that these routines take a single [protected sqlite3_value] object |
|
Line 4539 SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(
|
Line 5041 SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(
|
| ** sqlite3_value_text16be() and sqlite3_value_text16le() interfaces |
** sqlite3_value_text16be() and sqlite3_value_text16le() interfaces |
| ** extract UTF-16 strings as big-endian and little-endian respectively. |
** extract UTF-16 strings as big-endian and little-endian respectively. |
| ** |
** |
| |
** ^If [sqlite3_value] object V was initialized |
| |
** using [sqlite3_bind_pointer(S,I,P,X,D)] or [sqlite3_result_pointer(C,P,X,D)] |
| |
** and if X and Y are strings that compare equal according to strcmp(X,Y), |
| |
** then sqlite3_value_pointer(V,Y) will return the pointer P. ^Otherwise, |
| |
** sqlite3_value_pointer(V,Y) returns a NULL. The sqlite3_bind_pointer() |
| |
** routine is part of the [pointer passing interface] added for SQLite 3.20.0. |
| |
** |
| |
** ^(The sqlite3_value_type(V) interface returns the |
| |
** [SQLITE_INTEGER | datatype code] for the initial datatype of the |
| |
** [sqlite3_value] object V. The returned value is one of [SQLITE_INTEGER], |
| |
** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL].)^ |
| |
** Other interfaces might change the datatype for an sqlite3_value object. |
| |
** For example, if the datatype is initially SQLITE_INTEGER and |
| |
** sqlite3_value_text(V) is called to extract a text value for that |
| |
** integer, then subsequent calls to sqlite3_value_type(V) might return |
| |
** SQLITE_TEXT. Whether or not a persistent internal datatype conversion |
| |
** occurs is undefined and may change from one release of SQLite to the next. |
| |
** |
| ** ^(The sqlite3_value_numeric_type() interface attempts to apply |
** ^(The sqlite3_value_numeric_type() interface attempts to apply |
| ** numeric affinity to the value. This means that an attempt is |
** numeric affinity to the value. This means that an attempt is |
| ** made to convert the value to an integer or floating point. If |
** made to convert the value to an integer or floating point. If |
|
Line 4547 SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(
|
Line 5067 SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(
|
| ** 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.)^ |
| ** |
** |
| |
** ^Within the [xUpdate] method of a [virtual table], the |
| |
** sqlite3_value_nochange(X) interface returns true if and only if |
| |
** the column corresponding to X is unchanged by the UPDATE operation |
| |
** that the xUpdate method call was invoked to implement and if |
| |
** and the prior [xColumn] method call that was invoked to extracted |
| |
** the value for that column returned without setting a result (probably |
| |
** because it queried [sqlite3_vtab_nochange()] and found that the column |
| |
** was unchanging). ^Within an [xUpdate] method, any value for which |
| |
** sqlite3_value_nochange(X) is true will in all other respects appear |
| |
** to be a NULL value. If sqlite3_value_nochange(X) is invoked anywhere other |
| |
** than within an [xUpdate] method call for an UPDATE statement, then |
| |
** the return value is arbitrary and meaningless. |
| |
** |
| |
** ^The sqlite3_value_frombind(X) interface returns non-zero if the |
| |
** value X originated from one of the [sqlite3_bind_int|sqlite3_bind()] |
| |
** interfaces. ^If X comes from an SQL literal value, or a table column, |
| |
** and expression, then sqlite3_value_frombind(X) returns zero. |
| |
** |
| ** Please pay particular attention to the fact that the pointer returned |
** Please pay particular attention to the fact that the pointer returned |
| ** from [sqlite3_value_blob()], [sqlite3_value_text()], or |
** from [sqlite3_value_blob()], [sqlite3_value_text()], or |
| ** [sqlite3_value_text16()] can be invalidated by a subsequent call to |
** [sqlite3_value_text16()] can be invalidated by a subsequent call to |
|
Line 4555 SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(
|
Line 5093 SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(
|
| ** |
** |
| ** 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 int sqlite3_value_bytes(sqlite3_value*); |
|
| SQLITE_API int sqlite3_value_bytes16(sqlite3_value*); |
|
| SQLITE_API double sqlite3_value_double(sqlite3_value*); |
SQLITE_API double sqlite3_value_double(sqlite3_value*); |
| SQLITE_API int sqlite3_value_int(sqlite3_value*); |
SQLITE_API int sqlite3_value_int(sqlite3_value*); |
| SQLITE_API sqlite3_int64 sqlite3_value_int64(sqlite3_value*); |
SQLITE_API sqlite3_int64 sqlite3_value_int64(sqlite3_value*); |
| |
SQLITE_API void *sqlite3_value_pointer(sqlite3_value*, const char*); |
| SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value*); |
SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value*); |
| SQLITE_API const void *sqlite3_value_text16(sqlite3_value*); |
SQLITE_API const void *sqlite3_value_text16(sqlite3_value*); |
| SQLITE_API const void *sqlite3_value_text16le(sqlite3_value*); |
SQLITE_API const void *sqlite3_value_text16le(sqlite3_value*); |
| SQLITE_API const void *sqlite3_value_text16be(sqlite3_value*); |
SQLITE_API const void *sqlite3_value_text16be(sqlite3_value*); |
| |
SQLITE_API int sqlite3_value_bytes(sqlite3_value*); |
| |
SQLITE_API int sqlite3_value_bytes16(sqlite3_value*); |
| SQLITE_API int sqlite3_value_type(sqlite3_value*); |
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_frombind(sqlite3_value*); |
| |
|
| /* |
/* |
| ** CAPI3REF: Finding The Subtype Of SQL Values |
** CAPI3REF: Finding The Subtype Of SQL Values |
|
Line 4578 SQLITE_API int sqlite3_value_numeric_type(sqlite3_valu
|
Line 5141 SQLITE_API int sqlite3_value_numeric_type(sqlite3_valu
|
| ** information can be used to pass a limited amount of context from |
** information can be used to pass a limited amount of context from |
| ** one SQL function to another. Use the [sqlite3_result_subtype()] |
** one SQL function to another. Use the [sqlite3_result_subtype()] |
| ** routine to set the subtype for the return value of an SQL function. |
** routine to set the subtype for the return value of an SQL function. |
| ** |
|
| ** SQLite makes no use of subtype itself. It merely passes the subtype |
|
| ** from the result of one [application-defined SQL function] into the |
|
| ** input of another. |
|
| */ |
*/ |
| SQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value*); |
SQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value*); |
| |
|
|
Line 4689 SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_
|
Line 5248 SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_
|
| ** the compiled regular expression can be reused on multiple |
** the compiled regular expression can be reused on multiple |
| ** invocations of the same function. |
** invocations of the same function. |
| ** |
** |
| ** ^The sqlite3_get_auxdata() interface returns a pointer to the metadata | ** ^The sqlite3_get_auxdata(C,N) interface returns a pointer to the metadata |
| ** associated by the sqlite3_set_auxdata() function with the Nth argument | ** associated by the sqlite3_set_auxdata(C,N,P,X) function with the Nth argument |
| ** value to the application-defined function. ^If there is no metadata | ** value to the application-defined function. ^N is zero for the left-most |
| ** associated with the function argument, this sqlite3_get_auxdata() interface | ** function argument. ^If there is no metadata |
| | ** associated with the function argument, the sqlite3_get_auxdata(C,N) interface |
| ** returns a NULL pointer. |
** returns a NULL pointer. |
| ** |
** |
| ** ^The sqlite3_set_auxdata(C,N,P,X) interface saves P as metadata for the N-th |
** ^The sqlite3_set_auxdata(C,N,P,X) interface saves P as metadata for the N-th |
|
Line 4723 SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_
|
Line 5283 SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_
|
| ** function parameters that are compile-time constants, including literal |
** function parameters that are compile-time constants, including literal |
| ** values and [parameters] and expressions composed from the same.)^ |
** values and [parameters] and expressions composed from the same.)^ |
| ** |
** |
| |
** The value of the N parameter to these interfaces should be non-negative. |
| |
** Future enhancements may make use of negative N values to define new |
| |
** kinds of function caching behavior. |
| |
** |
| ** These routines must be called from the same thread in which |
** These routines must be called from the same thread in which |
| ** the SQL function is running. |
** the SQL function is running. |
| */ |
*/ |
|
Line 4846 typedef void (*sqlite3_destructor_type)(void*);
|
Line 5410 typedef void (*sqlite3_destructor_type)(void*);
|
| ** when it has finished using that result. |
** when it has finished using that result. |
| ** ^If the 4th parameter to the sqlite3_result_text* interfaces |
** ^If the 4th parameter to the sqlite3_result_text* interfaces |
| ** or sqlite3_result_blob is the special constant SQLITE_TRANSIENT |
** or sqlite3_result_blob is the special constant SQLITE_TRANSIENT |
| ** then SQLite makes a copy of the result into space obtained from | ** then SQLite makes a copy of the result into space obtained |
| ** from [sqlite3_malloc()] before it returns. |
** from [sqlite3_malloc()] before it returns. |
| ** |
** |
| ** ^The sqlite3_result_value() interface sets the result of |
** ^The sqlite3_result_value() interface sets the result of |
|
Line 4859 typedef void (*sqlite3_destructor_type)(void*);
|
Line 5423 typedef void (*sqlite3_destructor_type)(void*);
|
| ** [unprotected sqlite3_value] object is required, so either |
** [unprotected sqlite3_value] object is required, so either |
| ** kind of [sqlite3_value] object can be used with this interface. |
** kind of [sqlite3_value] object can be used with this interface. |
| ** |
** |
| |
** ^The sqlite3_result_pointer(C,P,T,D) interface sets the result to an |
| |
** SQL NULL value, just like [sqlite3_result_null(C)], except that it |
| |
** also associates the host-language pointer P or type T with that |
| |
** NULL value such that the pointer can be retrieved within an |
| |
** [application-defined SQL function] using [sqlite3_value_pointer()]. |
| |
** ^If the D parameter is not NULL, then it is a pointer to a destructor |
| |
** for the P parameter. ^SQLite invokes D with P as its only argument |
| |
** when SQLite is finished with P. The T parameter should be a static |
| |
** string and preferably a string literal. The sqlite3_result_pointer() |
| |
** routine is part of the [pointer passing interface] added for SQLite 3.20.0. |
| |
** |
| ** If these routines are called from within the different thread |
** If these routines are called from within the different thread |
| ** than the one containing the application-defined function that received |
** than the one containing the application-defined function that received |
| ** the [sqlite3_context] pointer, the results are undefined. |
** the [sqlite3_context] pointer, the results are undefined. |
|
Line 4882 SQLITE_API void sqlite3_result_text16(sqlite3_context*
|
Line 5457 SQLITE_API void sqlite3_result_text16(sqlite3_context*
|
| SQLITE_API void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*)); |
SQLITE_API void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*)); |
| SQLITE_API void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*)); |
SQLITE_API void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*)); |
| SQLITE_API void sqlite3_result_value(sqlite3_context*, sqlite3_value*); |
SQLITE_API void sqlite3_result_value(sqlite3_context*, sqlite3_value*); |
| |
SQLITE_API void sqlite3_result_pointer(sqlite3_context*, void*,const char*,void(*)(void*)); |
| SQLITE_API void sqlite3_result_zeroblob(sqlite3_context*, int n); |
SQLITE_API void sqlite3_result_zeroblob(sqlite3_context*, int n); |
| SQLITE_API int sqlite3_result_zeroblob64(sqlite3_context*, sqlite3_uint64 n); |
SQLITE_API int sqlite3_result_zeroblob64(sqlite3_context*, sqlite3_uint64 n); |
| |
|
|
Line 5211 SQLITE_API SQLITE_EXTERN char *sqlite3_temp_directory;
|
Line 5787 SQLITE_API SQLITE_EXTERN char *sqlite3_temp_directory;
|
| SQLITE_API SQLITE_EXTERN char *sqlite3_data_directory; |
SQLITE_API SQLITE_EXTERN char *sqlite3_data_directory; |
| |
|
| /* |
/* |
| |
** CAPI3REF: Win32 Specific Interface |
| |
** |
| |
** These interfaces are available only on Windows. The |
| |
** [sqlite3_win32_set_directory] interface is used to set the value associated |
| |
** with the [sqlite3_temp_directory] or [sqlite3_data_directory] variable, to |
| |
** zValue, depending on the value of the type parameter. The zValue parameter |
| |
** should be NULL to cause the previous value to be freed via [sqlite3_free]; |
| |
** a non-NULL value will be copied into memory obtained from [sqlite3_malloc] |
| |
** prior to being used. The [sqlite3_win32_set_directory] interface returns |
| |
** [SQLITE_OK] to indicate success, [SQLITE_ERROR] if the type is unsupported, |
| |
** or [SQLITE_NOMEM] if memory could not be allocated. The value of the |
| |
** [sqlite3_data_directory] variable is intended to act as a replacement for |
| |
** the current directory on the sub-platforms of Win32 where that concept is |
| |
** not present, e.g. WinRT and UWP. The [sqlite3_win32_set_directory8] and |
| |
** [sqlite3_win32_set_directory16] interfaces behave exactly the same as the |
| |
** sqlite3_win32_set_directory interface except the string parameter must be |
| |
** UTF-8 or UTF-16, respectively. |
| |
*/ |
| |
SQLITE_API int sqlite3_win32_set_directory( |
| |
unsigned long type, /* Identifier for directory being set or reset */ |
| |
void *zValue /* New value for directory being set or reset */ |
| |
); |
| |
SQLITE_API int sqlite3_win32_set_directory8(unsigned long type, const char *zValue); |
| |
SQLITE_API int sqlite3_win32_set_directory16(unsigned long type, const void *zValue); |
| |
|
| |
/* |
| |
** CAPI3REF: Win32 Directory Types |
| |
** |
| |
** These macros are only available on Windows. They define the allowed values |
| |
** for the type argument to the [sqlite3_win32_set_directory] interface. |
| |
*/ |
| |
#define SQLITE_WIN32_DATA_DIRECTORY_TYPE 1 |
| |
#define SQLITE_WIN32_TEMP_DIRECTORY_TYPE 2 |
| |
|
| |
/* |
| ** CAPI3REF: Test For Auto-Commit Mode |
** CAPI3REF: Test For Auto-Commit Mode |
| ** KEYWORDS: {autocommit mode} |
** KEYWORDS: {autocommit mode} |
| ** METHOD: sqlite3 |
** METHOD: sqlite3 |
|
Line 5255 SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*);
|
Line 5866 SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*);
|
| ** associated with database N of connection D. ^The main database file |
** associated with database N of connection D. ^The main database file |
| ** has the name "main". If there is no attached database N on the database |
** has the name "main". If there is no attached database N on the database |
| ** connection D, or if database N is a temporary or in-memory database, then |
** connection D, or if database N is a temporary or in-memory database, then |
| ** a NULL pointer is returned. | ** this function will return either a NULL pointer or an empty string. |
| ** |
** |
| ** ^The filename returned by this function is the output of the |
** ^The filename returned by this function is the output of the |
| ** xFullPathname method of the [VFS]. ^In other words, the filename |
** xFullPathname method of the [VFS]. ^In other words, the filename |
|
Line 5368 SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(
|
Line 5979 SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(
|
| ** ^The update hook is not invoked when [WITHOUT ROWID] tables are modified. |
** ^The update hook is not invoked when [WITHOUT ROWID] tables are modified. |
| ** |
** |
| ** ^In the current implementation, the update hook |
** ^In the current implementation, the update hook |
| ** is not invoked when duplication rows are deleted because of an | ** is not invoked when conflicting rows are deleted because of an |
| ** [ON CONFLICT | ON CONFLICT REPLACE] clause. ^Nor is the update hook |
** [ON CONFLICT | ON CONFLICT REPLACE] clause. ^Nor is the update hook |
| ** invoked when rows are deleted using the [truncate optimization]. |
** invoked when rows are deleted using the [truncate optimization]. |
| ** The exceptions defined in this paragraph might change in a future |
** The exceptions defined in this paragraph might change in a future |
|
Line 5404 SQLITE_API void *sqlite3_update_hook(
|
Line 6015 SQLITE_API void *sqlite3_update_hook(
|
| ** and disabled if the argument is false.)^ |
** and disabled if the argument is false.)^ |
| ** |
** |
| ** ^Cache sharing is enabled and disabled for an entire process. |
** ^Cache sharing is enabled and disabled for an entire process. |
| ** This is a change as of SQLite version 3.5.0. In prior versions of SQLite, | ** This is a change as of SQLite [version 3.5.0] ([dateof:3.5.0]). |
| | ** In prior versions of SQLite, |
| ** sharing was enabled or disabled for each thread separately. |
** sharing was enabled or disabled for each thread separately. |
| ** |
** |
| ** ^(The cache sharing mode set by this interface effects all subsequent |
** ^(The cache sharing mode set by this interface effects all subsequent |
|
Line 5498 SQLITE_API int sqlite3_db_release_memory(sqlite3*);
|
Line 6110 SQLITE_API int sqlite3_db_release_memory(sqlite3*);
|
| ** from the heap. |
** from the heap. |
| ** </ul>)^ |
** </ul>)^ |
| ** |
** |
| ** Beginning with SQLite version 3.7.3, the soft heap limit is enforced | ** Beginning with SQLite [version 3.7.3] ([dateof:3.7.3]), |
| | ** the soft heap limit is enforced |
| ** regardless of whether or not the [SQLITE_ENABLE_MEMORY_MANAGEMENT] |
** regardless of whether or not the [SQLITE_ENABLE_MEMORY_MANAGEMENT] |
| ** compile-time option is invoked. With [SQLITE_ENABLE_MEMORY_MANAGEMENT], |
** compile-time option is invoked. With [SQLITE_ENABLE_MEMORY_MANAGEMENT], |
| ** the soft heap limit is enforced on every memory allocation. Without |
** the soft heap limit is enforced on every memory allocation. Without |
|
Line 5539 SQLITE_API SQLITE_DEPRECATED void sqlite3_soft_heap_li
|
Line 6152 SQLITE_API SQLITE_DEPRECATED void sqlite3_soft_heap_li
|
| ** ^If the column-name parameter to sqlite3_table_column_metadata() is a |
** ^If the column-name parameter to sqlite3_table_column_metadata() is a |
| ** NULL pointer, then this routine simply checks for the existence of the |
** NULL pointer, then this routine simply checks for the existence of the |
| ** table and returns SQLITE_OK if the table exists and SQLITE_ERROR if it |
** table and returns SQLITE_OK if the table exists and SQLITE_ERROR if it |
| ** does not. | ** does not. If the table name parameter T in a call to |
| | ** sqlite3_table_column_metadata(X,D,T,C,...) is NULL then the result is |
| | ** undefined behavior. |
| ** |
** |
| ** ^The column is identified by the second, third and fourth parameters to |
** ^The column is identified by the second, third and fourth parameters to |
| ** this function. ^(The second parameter is either the name of the database |
** this function. ^(The second parameter is either the name of the database |
|
Line 5806 struct sqlite3_module {
|
Line 6421 struct sqlite3_module {
|
| int (*xSavepoint)(sqlite3_vtab *pVTab, int); |
int (*xSavepoint)(sqlite3_vtab *pVTab, int); |
| int (*xRelease)(sqlite3_vtab *pVTab, int); |
int (*xRelease)(sqlite3_vtab *pVTab, int); |
| int (*xRollbackTo)(sqlite3_vtab *pVTab, int); |
int (*xRollbackTo)(sqlite3_vtab *pVTab, int); |
| |
/* The methods above are in versions 1 and 2 of the sqlite_module object. |
| |
** Those below are for version 3 and greater. */ |
| |
int (*xShadowName)(const char*); |
| }; |
}; |
| |
|
| /* |
/* |
|
Line 5892 struct sqlite3_module {
|
Line 6510 struct sqlite3_module {
|
| ** the xUpdate method are automatically rolled back by SQLite. |
** the xUpdate method are automatically rolled back by SQLite. |
| ** |
** |
| ** IMPORTANT: The estimatedRows field was added to the sqlite3_index_info |
** IMPORTANT: The estimatedRows field was added to the sqlite3_index_info |
| ** structure for SQLite version 3.8.2. If a virtual table extension is | ** structure for SQLite [version 3.8.2] ([dateof:3.8.2]). |
| | ** If a virtual table extension is |
| ** used with an SQLite version earlier than 3.8.2, the results of attempting |
** used with an SQLite version earlier than 3.8.2, the results of attempting |
| ** to read or write the estimatedRows field are undefined (but are likely |
** to read or write the estimatedRows field are undefined (but are likely |
| ** to included crashing the application). The estimatedRows field should |
** to included crashing the application). The estimatedRows field should |
| ** therefore only be used if [sqlite3_libversion_number()] returns a |
** therefore only be used if [sqlite3_libversion_number()] returns a |
| ** value greater than or equal to 3008002. Similarly, the idxFlags field |
** value greater than or equal to 3008002. Similarly, the idxFlags field |
| ** was added for version 3.9.0. It may therefore only be used if | ** was added for [version 3.9.0] ([dateof:3.9.0]). |
| | ** It may therefore only be used if |
| ** sqlite3_libversion_number() returns a value greater than or equal to |
** sqlite3_libversion_number() returns a value greater than or equal to |
| ** 3009000. |
** 3009000. |
| */ |
*/ |
|
Line 5936 struct sqlite3_index_info {
|
Line 6556 struct sqlite3_index_info {
|
| |
|
| /* |
/* |
| ** CAPI3REF: Virtual Table Scan Flags |
** CAPI3REF: Virtual Table Scan Flags |
| |
** |
| |
** Virtual table implementations are allowed to set the |
| |
** [sqlite3_index_info].idxFlags field to some combination of |
| |
** these bits. |
| */ |
*/ |
| #define SQLITE_INDEX_SCAN_UNIQUE 1 /* Scan visits at most 1 row */ |
#define SQLITE_INDEX_SCAN_UNIQUE 1 /* Scan visits at most 1 row */ |
| |
|
|
Line 5947 struct sqlite3_index_info {
|
Line 6571 struct sqlite3_index_info {
|
| ** an operator that is part of a constraint term in the wHERE clause of |
** an operator that is part of a constraint term in the wHERE clause of |
| ** a query that uses a [virtual table]. |
** a query that uses a [virtual table]. |
| */ |
*/ |
| #define SQLITE_INDEX_CONSTRAINT_EQ 2 | #define SQLITE_INDEX_CONSTRAINT_EQ 2 |
| #define SQLITE_INDEX_CONSTRAINT_GT 4 | #define SQLITE_INDEX_CONSTRAINT_GT 4 |
| #define SQLITE_INDEX_CONSTRAINT_LE 8 | #define SQLITE_INDEX_CONSTRAINT_LE 8 |
| #define SQLITE_INDEX_CONSTRAINT_LT 16 | #define SQLITE_INDEX_CONSTRAINT_LT 16 |
| #define SQLITE_INDEX_CONSTRAINT_GE 32 | #define SQLITE_INDEX_CONSTRAINT_GE 32 |
| #define SQLITE_INDEX_CONSTRAINT_MATCH 64 | #define SQLITE_INDEX_CONSTRAINT_MATCH 64 |
| #define SQLITE_INDEX_CONSTRAINT_LIKE 65 | #define SQLITE_INDEX_CONSTRAINT_LIKE 65 |
| #define SQLITE_INDEX_CONSTRAINT_GLOB 66 | #define SQLITE_INDEX_CONSTRAINT_GLOB 66 |
| #define SQLITE_INDEX_CONSTRAINT_REGEXP 67 | #define SQLITE_INDEX_CONSTRAINT_REGEXP 67 |
| | #define SQLITE_INDEX_CONSTRAINT_NE 68 |
| | #define SQLITE_INDEX_CONSTRAINT_ISNOT 69 |
| | #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 |
** CAPI3REF: Register A Virtual Table Implementation |
|
Line 6146 typedef struct sqlite3_blob sqlite3_blob;
|
Line 6776 typedef struct sqlite3_blob sqlite3_blob;
|
| ** [database connection] error code and message accessible via |
** [database connection] error code and message accessible via |
| ** [sqlite3_errcode()] and [sqlite3_errmsg()] and related functions. |
** [sqlite3_errcode()] and [sqlite3_errmsg()] and related functions. |
| ** |
** |
| |
** A BLOB referenced by sqlite3_blob_open() may be read using the |
| |
** [sqlite3_blob_read()] interface and modified by using |
| |
** [sqlite3_blob_write()]. The [BLOB handle] can be moved to a |
| |
** different row of the same table using the [sqlite3_blob_reopen()] |
| |
** interface. However, the column, table, or database of a [BLOB handle] |
| |
** cannot be changed after the [BLOB handle] is opened. |
| ** |
** |
| ** ^(If the row that a BLOB handle points to is modified by an |
** ^(If the row that a BLOB handle points to is modified by an |
| ** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects |
** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects |
|
Line 6169 typedef struct sqlite3_blob sqlite3_blob;
|
Line 6805 typedef struct sqlite3_blob sqlite3_blob;
|
| ** |
** |
| ** To avoid a resource leak, every open [BLOB handle] should eventually |
** To avoid a resource leak, every open [BLOB handle] should eventually |
| ** be released by a call to [sqlite3_blob_close()]. |
** be released by a call to [sqlite3_blob_close()]. |
| |
** |
| |
** See also: [sqlite3_blob_close()], |
| |
** [sqlite3_blob_reopen()], [sqlite3_blob_read()], |
| |
** [sqlite3_blob_bytes()], [sqlite3_blob_write()]. |
| */ |
*/ |
| SQLITE_API int sqlite3_blob_open( |
SQLITE_API int sqlite3_blob_open( |
| sqlite3*, |
sqlite3*, |
|
Line 6184 SQLITE_API int sqlite3_blob_open(
|
Line 6824 SQLITE_API int sqlite3_blob_open(
|
| ** CAPI3REF: Move a BLOB Handle to a New Row |
** CAPI3REF: Move a BLOB Handle to a New Row |
| ** METHOD: sqlite3_blob |
** METHOD: sqlite3_blob |
| ** |
** |
| ** ^This function is used to move an existing blob handle so that it points | ** ^This function is used to move an existing [BLOB handle] so that it points |
| ** to a different row of the same database table. ^The new row is identified |
** to a different row of the same database table. ^The new row is identified |
| ** by the rowid value passed as the second argument. Only the row can be |
** by the rowid value passed as the second argument. Only the row can be |
| ** changed. ^The database, table and column on which the blob handle is open |
** changed. ^The database, table and column on which the blob handle is open |
| ** remain the same. Moving an existing blob handle to a new row can be | ** remain the same. Moving an existing [BLOB handle] to a new row is |
| ** faster than closing the existing handle and opening a new one. |
** faster than closing the existing handle and opening a new one. |
| ** |
** |
| ** ^(The new row must meet the same criteria as for [sqlite3_blob_open()] - |
** ^(The new row must meet the same criteria as for [sqlite3_blob_open()] - |
|
Line 6596 SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*);
|
Line 7236 SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*);
|
| #define SQLITE_MUTEX_STATIC_MEM 3 /* sqlite3_malloc() */ |
#define SQLITE_MUTEX_STATIC_MEM 3 /* sqlite3_malloc() */ |
| #define SQLITE_MUTEX_STATIC_MEM2 4 /* NOT USED */ |
#define SQLITE_MUTEX_STATIC_MEM2 4 /* NOT USED */ |
| #define SQLITE_MUTEX_STATIC_OPEN 4 /* sqlite3BtreeOpen() */ |
#define SQLITE_MUTEX_STATIC_OPEN 4 /* sqlite3BtreeOpen() */ |
| #define SQLITE_MUTEX_STATIC_PRNG 5 /* sqlite3_random() */ | #define SQLITE_MUTEX_STATIC_PRNG 5 /* sqlite3_randomness() */ |
| #define SQLITE_MUTEX_STATIC_LRU 6 /* lru page list */ |
#define SQLITE_MUTEX_STATIC_LRU 6 /* lru page list */ |
| #define SQLITE_MUTEX_STATIC_LRU2 7 /* NOT USED */ |
#define SQLITE_MUTEX_STATIC_LRU2 7 /* NOT USED */ |
| #define SQLITE_MUTEX_STATIC_PMEM 7 /* sqlite3PageMalloc() */ |
#define SQLITE_MUTEX_STATIC_PMEM 7 /* sqlite3PageMalloc() */ |
|
Line 6622 SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*);
|
Line 7262 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 |
|
Line 6636 SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*);
|
Line 7277 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. |
| ** |
** |
| ** ^The SQLITE_FCNTL_FILE_POINTER value for the op parameter causes | ** 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 |
** 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 |
|
Line 6650 SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*);
|
Line 7298 SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*);
|
| ** an incorrect zDbName and an SQLITE_ERROR return from the underlying |
** an incorrect zDbName and an SQLITE_ERROR return from the underlying |
| ** xFileControl method. |
** xFileControl method. |
| ** |
** |
| ** See also: [SQLITE_FCNTL_LOCKSTATE] | ** See also: [file control opcodes] |
| */ |
*/ |
| SQLITE_API int sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*); |
SQLITE_API int sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*); |
| |
|
|
Line 6696 SQLITE_API int sqlite3_test_control(int op, ...);
|
Line 7344 SQLITE_API int sqlite3_test_control(int op, ...);
|
| #define SQLITE_TESTCTRL_ALWAYS 13 |
#define SQLITE_TESTCTRL_ALWAYS 13 |
| #define SQLITE_TESTCTRL_RESERVE 14 |
#define SQLITE_TESTCTRL_RESERVE 14 |
| #define SQLITE_TESTCTRL_OPTIMIZATIONS 15 |
#define SQLITE_TESTCTRL_OPTIMIZATIONS 15 |
| #define SQLITE_TESTCTRL_ISKEYWORD 16 | #define SQLITE_TESTCTRL_ISKEYWORD 16 /* NOT USED */ |
| #define SQLITE_TESTCTRL_SCRATCHMALLOC 17 | #define SQLITE_TESTCTRL_SCRATCHMALLOC 17 /* NOT USED */ |
| | #define SQLITE_TESTCTRL_INTERNAL_FUNCTIONS 17 |
| #define SQLITE_TESTCTRL_LOCALTIME_FAULT 18 |
#define SQLITE_TESTCTRL_LOCALTIME_FAULT 18 |
| #define SQLITE_TESTCTRL_EXPLAIN_STMT 19 /* NOT USED */ |
#define SQLITE_TESTCTRL_EXPLAIN_STMT 19 /* NOT USED */ |
| |
#define SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD 19 |
| #define SQLITE_TESTCTRL_NEVER_CORRUPT 20 |
#define SQLITE_TESTCTRL_NEVER_CORRUPT 20 |
| #define SQLITE_TESTCTRL_VDBE_COVERAGE 21 |
#define SQLITE_TESTCTRL_VDBE_COVERAGE 21 |
| #define SQLITE_TESTCTRL_BYTEORDER 22 |
#define SQLITE_TESTCTRL_BYTEORDER 22 |
| #define SQLITE_TESTCTRL_ISINIT 23 |
#define SQLITE_TESTCTRL_ISINIT 23 |
| #define SQLITE_TESTCTRL_SORTER_MMAP 24 |
#define SQLITE_TESTCTRL_SORTER_MMAP 24 |
| #define SQLITE_TESTCTRL_IMPOSTER 25 |
#define SQLITE_TESTCTRL_IMPOSTER 25 |
| #define SQLITE_TESTCTRL_LAST 25 | #define SQLITE_TESTCTRL_PARSER_COVERAGE 26 |
| | #define SQLITE_TESTCTRL_RESULT_INTREAL 27 |
| | #define SQLITE_TESTCTRL_LAST 27 /* Largest TESTCTRL */ |
| |
|
| /* |
/* |
| |
** CAPI3REF: SQL Keyword Checking |
| |
** |
| |
** These routines provide access to the set of SQL language keywords |
| |
** recognized by SQLite. Applications can uses these routines to determine |
| |
** whether or not a specific identifier needs to be escaped (for example, |
| |
** by enclosing in double-quotes) so as not to confuse the parser. |
| |
** |
| |
** The sqlite3_keyword_count() interface returns the number of distinct |
| |
** keywords understood by SQLite. |
| |
** |
| |
** The sqlite3_keyword_name(N,Z,L) interface finds the N-th keyword and |
| |
** makes *Z point to that keyword expressed as UTF8 and writes the number |
| |
** of bytes in the keyword into *L. The string that *Z points to is not |
| |
** zero-terminated. The sqlite3_keyword_name(N,Z,L) routine returns |
| |
** SQLITE_OK if N is within bounds and SQLITE_ERROR if not. If either Z |
| |
** or L are NULL or invalid pointers then calls to |
| |
** sqlite3_keyword_name(N,Z,L) result in undefined behavior. |
| |
** |
| |
** The sqlite3_keyword_check(Z,L) interface checks to see whether or not |
| |
** the L-byte UTF8 identifier that Z points to is a keyword, returning non-zero |
| |
** if it is and zero if not. |
| |
** |
| |
** The parser used by SQLite is forgiving. It is often possible to use |
| |
** a keyword as an identifier as long as such use does not result in a |
| |
** parsing ambiguity. For example, the statement |
| |
** "CREATE TABLE BEGIN(REPLACE,PRAGMA,END);" is accepted by SQLite, and |
| |
** creates a new table named "BEGIN" with three columns named |
| |
** "REPLACE", "PRAGMA", and "END". Nevertheless, best practice is to avoid |
| |
** using keywords as identifiers. Common techniques used to avoid keyword |
| |
** name collisions include: |
| |
** <ul> |
| |
** <li> Put all identifier names inside double-quotes. This is the official |
| |
** SQL way to escape identifier names. |
| |
** <li> Put identifier names inside [...]. This is not standard SQL, |
| |
** but it is what SQL Server does and so lots of programmers use this |
| |
** technique. |
| |
** <li> Begin every identifier with the letter "Z" as no SQL keywords start |
| |
** with "Z". |
| |
** <li> Include a digit somewhere in every identifier name. |
| |
** </ul> |
| |
** |
| |
** Note that the number of keywords understood by SQLite can depend on |
| |
** compile-time options. For example, "VACUUM" is not a keyword if |
| |
** SQLite is compiled with the [-DSQLITE_OMIT_VACUUM] option. Also, |
| |
** new keywords may be added to future releases of SQLite. |
| |
*/ |
| |
SQLITE_API int sqlite3_keyword_count(void); |
| |
SQLITE_API int sqlite3_keyword_name(int,const char**,int*); |
| |
SQLITE_API int sqlite3_keyword_check(const char*,int); |
| |
|
| |
/* |
| |
** CAPI3REF: Dynamic String Object |
| |
** KEYWORDS: {dynamic string} |
| |
** |
| |
** An instance of the sqlite3_str object contains a dynamically-sized |
| |
** string under construction. |
| |
** |
| |
** The lifecycle of an sqlite3_str object is as follows: |
| |
** <ol> |
| |
** <li> ^The sqlite3_str object is created using [sqlite3_str_new()]. |
| |
** <li> ^Text is appended to the sqlite3_str object using various |
| |
** methods, such as [sqlite3_str_appendf()]. |
| |
** <li> ^The sqlite3_str object is destroyed and the string it created |
| |
** is returned using the [sqlite3_str_finish()] interface. |
| |
** </ol> |
| |
*/ |
| |
typedef struct sqlite3_str sqlite3_str; |
| |
|
| |
/* |
| |
** CAPI3REF: Create A New Dynamic String Object |
| |
** CONSTRUCTOR: sqlite3_str |
| |
** |
| |
** ^The [sqlite3_str_new(D)] interface allocates and initializes |
| |
** a new [sqlite3_str] object. To avoid memory leaks, the object returned by |
| |
** [sqlite3_str_new()] must be freed by a subsequent call to |
| |
** [sqlite3_str_finish(X)]. |
| |
** |
| |
** ^The [sqlite3_str_new(D)] interface always returns a pointer to a |
| |
** valid [sqlite3_str] object, though in the event of an out-of-memory |
| |
** error the returned object might be a special singleton that will |
| |
** silently reject new text, always return SQLITE_NOMEM from |
| |
** [sqlite3_str_errcode()], always return 0 for |
| |
** [sqlite3_str_length()], and always return NULL from |
| |
** [sqlite3_str_finish(X)]. It is always safe to use the value |
| |
** returned by [sqlite3_str_new(D)] as the sqlite3_str parameter |
| |
** to any of the other [sqlite3_str] methods. |
| |
** |
| |
** The D parameter to [sqlite3_str_new(D)] may be NULL. If the |
| |
** D parameter in [sqlite3_str_new(D)] is not NULL, then the maximum |
| |
** length of the string contained in the [sqlite3_str] object will be |
| |
** the value set for [sqlite3_limit](D,[SQLITE_LIMIT_LENGTH]) instead |
| |
** of [SQLITE_MAX_LENGTH]. |
| |
*/ |
| |
SQLITE_API sqlite3_str *sqlite3_str_new(sqlite3*); |
| |
|
| |
/* |
| |
** CAPI3REF: Finalize A Dynamic String |
| |
** DESTRUCTOR: sqlite3_str |
| |
** |
| |
** ^The [sqlite3_str_finish(X)] interface destroys the sqlite3_str object X |
| |
** and returns a pointer to a memory buffer obtained from [sqlite3_malloc64()] |
| |
** that contains the constructed string. The calling application should |
| |
** pass the returned value to [sqlite3_free()] to avoid a memory leak. |
| |
** ^The [sqlite3_str_finish(X)] interface may return a NULL pointer if any |
| |
** errors were encountered during construction of the string. ^The |
| |
** [sqlite3_str_finish(X)] interface will also return a NULL pointer if the |
| |
** string in [sqlite3_str] object X is zero bytes long. |
| |
*/ |
| |
SQLITE_API char *sqlite3_str_finish(sqlite3_str*); |
| |
|
| |
/* |
| |
** CAPI3REF: Add Content To A Dynamic String |
| |
** METHOD: sqlite3_str |
| |
** |
| |
** These interfaces add content to an sqlite3_str object previously obtained |
| |
** from [sqlite3_str_new()]. |
| |
** |
| |
** ^The [sqlite3_str_appendf(X,F,...)] and |
| |
** [sqlite3_str_vappendf(X,F,V)] interfaces uses the [built-in printf] |
| |
** functionality of SQLite to append formatted text onto the end of |
| |
** [sqlite3_str] object X. |
| |
** |
| |
** ^The [sqlite3_str_append(X,S,N)] method appends exactly N bytes from string S |
| |
** onto the end of the [sqlite3_str] object X. N must be non-negative. |
| |
** S must contain at least N non-zero bytes of content. To append a |
| |
** zero-terminated string in its entirety, use the [sqlite3_str_appendall()] |
| |
** method instead. |
| |
** |
| |
** ^The [sqlite3_str_appendall(X,S)] method appends the complete content of |
| |
** zero-terminated string S onto the end of [sqlite3_str] object X. |
| |
** |
| |
** ^The [sqlite3_str_appendchar(X,N,C)] method appends N copies of the |
| |
** single-byte character C onto the end of [sqlite3_str] object X. |
| |
** ^This method can be used, for example, to add whitespace indentation. |
| |
** |
| |
** ^The [sqlite3_str_reset(X)] method resets the string under construction |
| |
** inside [sqlite3_str] object X back to zero bytes in length. |
| |
** |
| |
** These methods do not return a result code. ^If an error occurs, that fact |
| |
** is recorded in the [sqlite3_str] object and can be recovered by a |
| |
** subsequent call to [sqlite3_str_errcode(X)]. |
| |
*/ |
| |
SQLITE_API void sqlite3_str_appendf(sqlite3_str*, const char *zFormat, ...); |
| |
SQLITE_API void sqlite3_str_vappendf(sqlite3_str*, const char *zFormat, va_list); |
| |
SQLITE_API void sqlite3_str_append(sqlite3_str*, const char *zIn, int N); |
| |
SQLITE_API void sqlite3_str_appendall(sqlite3_str*, const char *zIn); |
| |
SQLITE_API void sqlite3_str_appendchar(sqlite3_str*, int N, char C); |
| |
SQLITE_API void sqlite3_str_reset(sqlite3_str*); |
| |
|
| |
/* |
| |
** CAPI3REF: Status Of A Dynamic String |
| |
** METHOD: sqlite3_str |
| |
** |
| |
** These interfaces return the current status of an [sqlite3_str] object. |
| |
** |
| |
** ^If any prior errors have occurred while constructing the dynamic string |
| |
** in sqlite3_str X, then the [sqlite3_str_errcode(X)] method will return |
| |
** an appropriate error code. ^The [sqlite3_str_errcode(X)] method returns |
| |
** [SQLITE_NOMEM] following any out-of-memory error, or |
| |
** [SQLITE_TOOBIG] if the size of the dynamic string exceeds |
| |
** [SQLITE_MAX_LENGTH], or [SQLITE_OK] if there have been no errors. |
| |
** |
| |
** ^The [sqlite3_str_length(X)] method returns the current length, in bytes, |
| |
** of the dynamic string under construction in [sqlite3_str] object X. |
| |
** ^The length returned by [sqlite3_str_length(X)] does not include the |
| |
** zero-termination byte. |
| |
** |
| |
** ^The [sqlite3_str_value(X)] method returns a pointer to the current |
| |
** content of the dynamic string under construction in X. The value |
| |
** returned by [sqlite3_str_value(X)] is managed by the sqlite3_str object X |
| |
** and might be freed or altered by any subsequent method on the same |
| |
** [sqlite3_str] object. Applications must not used the pointer returned |
| |
** [sqlite3_str_value(X)] after any subsequent method call on the same |
| |
** object. ^Applications may change the content of the string returned |
| |
** by [sqlite3_str_value(X)] as long as they do not write into any bytes |
| |
** outside the range of 0 to [sqlite3_str_length(X)] and do not read or |
| |
** write any byte after any subsequent sqlite3_str method call. |
| |
*/ |
| |
SQLITE_API int sqlite3_str_errcode(sqlite3_str*); |
| |
SQLITE_API int sqlite3_str_length(sqlite3_str*); |
| |
SQLITE_API char *sqlite3_str_value(sqlite3_str*); |
| |
|
| |
/* |
| ** CAPI3REF: SQLite Runtime Status |
** CAPI3REF: SQLite Runtime Status |
| ** |
** |
| ** ^These interfaces are used to retrieve runtime status information |
** ^These interfaces are used to retrieve runtime status information |
|
Line 6755 SQLITE_API int sqlite3_status64(
|
Line 7590 SQLITE_API int sqlite3_status64(
|
| ** <dd>This parameter is the current amount of memory checked out |
** <dd>This parameter is the current amount of memory checked out |
| ** using [sqlite3_malloc()], either directly or indirectly. The |
** using [sqlite3_malloc()], either directly or indirectly. The |
| ** figure includes calls made to [sqlite3_malloc()] by the application |
** figure includes calls made to [sqlite3_malloc()] by the application |
| ** and internal memory usage by the SQLite library. Scratch memory | ** and internal memory usage by the SQLite library. Auxiliary page-cache |
| ** controlled by [SQLITE_CONFIG_SCRATCH] and auxiliary page-cache | |
| ** memory controlled by [SQLITE_CONFIG_PAGECACHE] is not included in |
** memory controlled by [SQLITE_CONFIG_PAGECACHE] is not included in |
| ** this parameter. The amount returned is the sum of the allocation |
** this parameter. The amount returned is the sum of the allocation |
| ** sizes as reported by the xSize method in [sqlite3_mem_methods].</dd>)^ |
** sizes as reported by the xSize method in [sqlite3_mem_methods].</dd>)^ |
|
Line 6794 SQLITE_API int sqlite3_status64(
|
Line 7628 SQLITE_API int sqlite3_status64(
|
| ** *pHighwater parameter to [sqlite3_status()] is of interest. |
** *pHighwater parameter to [sqlite3_status()] is of interest. |
| ** The value written into the *pCurrent parameter is undefined.</dd>)^ |
** The value written into the *pCurrent parameter is undefined.</dd>)^ |
| ** |
** |
| ** [[SQLITE_STATUS_SCRATCH_USED]] ^(<dt>SQLITE_STATUS_SCRATCH_USED</dt> | ** [[SQLITE_STATUS_SCRATCH_USED]] <dt>SQLITE_STATUS_SCRATCH_USED</dt> |
| ** <dd>This parameter returns the number of allocations used out of the | ** <dd>No longer used.</dd> |
| ** [scratch memory allocator] configured using | |
| ** [SQLITE_CONFIG_SCRATCH]. The value returned is in allocations, not | |
| ** in bytes. Since a single thread may only have one scratch allocation | |
| ** outstanding at time, this parameter also reports the number of threads | |
| ** using scratch memory at the same time.</dd>)^ | |
| ** |
** |
| ** [[SQLITE_STATUS_SCRATCH_OVERFLOW]] ^(<dt>SQLITE_STATUS_SCRATCH_OVERFLOW</dt> |
** [[SQLITE_STATUS_SCRATCH_OVERFLOW]] ^(<dt>SQLITE_STATUS_SCRATCH_OVERFLOW</dt> |
| ** <dd>This parameter returns the number of bytes of scratch memory | ** <dd>No longer used.</dd> |
| ** allocation which could not be satisfied by the [SQLITE_CONFIG_SCRATCH] | |
| ** buffer and where forced to overflow to [sqlite3_malloc()]. The values | |
| ** returned include overflows because the requested allocation was too | |
| ** larger (that is, because the requested allocation was larger than the | |
| ** "sz" parameter to [SQLITE_CONFIG_SCRATCH]) and because no scratch buffer | |
| ** slots were available. | |
| ** </dd>)^ | |
| ** |
** |
| ** [[SQLITE_STATUS_SCRATCH_SIZE]] ^(<dt>SQLITE_STATUS_SCRATCH_SIZE</dt> | ** [[SQLITE_STATUS_SCRATCH_SIZE]] <dt>SQLITE_STATUS_SCRATCH_SIZE</dt> |
| ** <dd>This parameter records the largest memory allocation request | ** <dd>No longer used.</dd> |
| ** handed to [scratch memory allocator]. Only the value returned in the | |
| ** *pHighwater parameter to [sqlite3_status()] is of interest. | |
| ** The value written into the *pCurrent parameter is undefined.</dd>)^ | |
| ** |
** |
| ** [[SQLITE_STATUS_PARSER_STACK]] ^(<dt>SQLITE_STATUS_PARSER_STACK</dt> |
** [[SQLITE_STATUS_PARSER_STACK]] ^(<dt>SQLITE_STATUS_PARSER_STACK</dt> |
| ** <dd>The *pHighwater parameter records the deepest parser stack. |
** <dd>The *pHighwater parameter records the deepest parser stack. |
|
Line 6829 SQLITE_API int sqlite3_status64(
|
Line 7648 SQLITE_API int sqlite3_status64(
|
| #define SQLITE_STATUS_MEMORY_USED 0 |
#define SQLITE_STATUS_MEMORY_USED 0 |
| #define SQLITE_STATUS_PAGECACHE_USED 1 |
#define SQLITE_STATUS_PAGECACHE_USED 1 |
| #define SQLITE_STATUS_PAGECACHE_OVERFLOW 2 |
#define SQLITE_STATUS_PAGECACHE_OVERFLOW 2 |
| #define SQLITE_STATUS_SCRATCH_USED 3 | #define SQLITE_STATUS_SCRATCH_USED 3 /* NOT USED */ |
| #define SQLITE_STATUS_SCRATCH_OVERFLOW 4 | #define SQLITE_STATUS_SCRATCH_OVERFLOW 4 /* NOT USED */ |
| #define SQLITE_STATUS_MALLOC_SIZE 5 |
#define SQLITE_STATUS_MALLOC_SIZE 5 |
| #define SQLITE_STATUS_PARSER_STACK 6 |
#define SQLITE_STATUS_PARSER_STACK 6 |
| #define SQLITE_STATUS_PAGECACHE_SIZE 7 |
#define SQLITE_STATUS_PAGECACHE_SIZE 7 |
| #define SQLITE_STATUS_SCRATCH_SIZE 8 | #define SQLITE_STATUS_SCRATCH_SIZE 8 /* NOT USED */ |
| #define SQLITE_STATUS_MALLOC_COUNT 9 |
#define SQLITE_STATUS_MALLOC_COUNT 9 |
| |
|
| /* |
/* |
|
Line 6957 SQLITE_API int sqlite3_db_status(sqlite3*, int op, int
|
Line 7776 SQLITE_API int sqlite3_db_status(sqlite3*, int op, int
|
| ** highwater mark associated with SQLITE_DBSTATUS_CACHE_WRITE is always 0. |
** highwater mark associated with SQLITE_DBSTATUS_CACHE_WRITE is always 0. |
| ** </dd> |
** </dd> |
| ** |
** |
| |
** [[SQLITE_DBSTATUS_CACHE_SPILL]] ^(<dt>SQLITE_DBSTATUS_CACHE_SPILL</dt> |
| |
** <dd>This parameter returns the number of dirty cache entries that have |
| |
** been written to disk in the middle of a transaction due to the page |
| |
** cache overflowing. Transactions are more efficient if they are written |
| |
** to disk all at once. When pages spill mid-transaction, that introduces |
| |
** additional overhead. This parameter can be used help identify |
| |
** inefficiencies that can be resolve by increasing the cache size. |
| |
** </dd> |
| |
** |
| ** [[SQLITE_DBSTATUS_DEFERRED_FKS]] ^(<dt>SQLITE_DBSTATUS_DEFERRED_FKS</dt> |
** [[SQLITE_DBSTATUS_DEFERRED_FKS]] ^(<dt>SQLITE_DBSTATUS_DEFERRED_FKS</dt> |
| ** <dd>This parameter returns zero for the current value if and only if |
** <dd>This parameter returns zero for the current value if and only if |
| ** all foreign key constraints (deferred or immediate) have been |
** all foreign key constraints (deferred or immediate) have been |
|
Line 6976 SQLITE_API int sqlite3_db_status(sqlite3*, int op, int
|
Line 7804 SQLITE_API int sqlite3_db_status(sqlite3*, int op, int
|
| #define SQLITE_DBSTATUS_CACHE_WRITE 9 |
#define SQLITE_DBSTATUS_CACHE_WRITE 9 |
| #define SQLITE_DBSTATUS_DEFERRED_FKS 10 |
#define SQLITE_DBSTATUS_DEFERRED_FKS 10 |
| #define SQLITE_DBSTATUS_CACHE_USED_SHARED 11 |
#define SQLITE_DBSTATUS_CACHE_USED_SHARED 11 |
| #define SQLITE_DBSTATUS_MAX 11 /* Largest defined DBSTATUS */ | #define SQLITE_DBSTATUS_CACHE_SPILL 12 |
| | #define SQLITE_DBSTATUS_MAX 12 /* Largest defined DBSTATUS */ |
| |
|
| |
|
| /* |
/* |
|
Line 7039 SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int
|
Line 7868 SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int
|
| ** used as a proxy for the total work done by the prepared statement. |
** used as a proxy for the total work done by the prepared statement. |
| ** If the number of virtual machine operations exceeds 2147483647 |
** If the number of virtual machine operations exceeds 2147483647 |
| ** then the value returned by this statement status code is undefined. |
** then the value returned by this statement status code is undefined. |
| |
** |
| |
** [[SQLITE_STMTSTATUS_REPREPARE]] <dt>SQLITE_STMTSTATUS_REPREPARE</dt> |
| |
** <dd>^This is the number of times that the prepare statement has been |
| |
** automatically regenerated due to schema changes or change to |
| |
** [bound parameters] that might affect the query plan. |
| |
** |
| |
** [[SQLITE_STMTSTATUS_RUN]] <dt>SQLITE_STMTSTATUS_RUN</dt> |
| |
** <dd>^This is the number of times that the prepared statement has |
| |
** been run. A single "run" for the purposes of this counter is one |
| |
** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()]. |
| |
** The counter is incremented on the first [sqlite3_step()] call of each |
| |
** cycle. |
| |
** |
| |
** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt> |
| |
** <dd>^This is the approximate number of bytes of heap memory |
| |
** used to store the prepared statement. ^This value is not actually |
| |
** a counter, and so the resetFlg parameter to sqlite3_stmt_status() |
| |
** is ignored when the opcode is SQLITE_STMTSTATUS_MEMUSED. |
| ** </dd> |
** </dd> |
| ** </dl> |
** </dl> |
| */ |
*/ |
|
Line 7046 SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int
|
Line 7893 SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int
|
| #define SQLITE_STMTSTATUS_SORT 2 |
#define SQLITE_STMTSTATUS_SORT 2 |
| #define SQLITE_STMTSTATUS_AUTOINDEX 3 |
#define SQLITE_STMTSTATUS_AUTOINDEX 3 |
| #define SQLITE_STMTSTATUS_VM_STEP 4 |
#define SQLITE_STMTSTATUS_VM_STEP 4 |
| |
#define SQLITE_STMTSTATUS_REPREPARE 5 |
| |
#define SQLITE_STMTSTATUS_RUN 6 |
| |
#define SQLITE_STMTSTATUS_MEMUSED 99 |
| |
|
| /* |
/* |
| ** CAPI3REF: Custom Page Cache Object |
** CAPI3REF: Custom Page Cache Object |
|
Line 7910 SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, .
|
Line 8760 SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, .
|
| ** can use to customize and optimize their behavior. |
** can use to customize and optimize their behavior. |
| ** |
** |
| ** <dl> |
** <dl> |
| |
** [[SQLITE_VTAB_CONSTRAINT_SUPPORT]] |
| ** <dt>SQLITE_VTAB_CONSTRAINT_SUPPORT |
** <dt>SQLITE_VTAB_CONSTRAINT_SUPPORT |
| ** <dd>Calls of the form |
** <dd>Calls of the form |
| ** [sqlite3_vtab_config](db,SQLITE_VTAB_CONSTRAINT_SUPPORT,X) are supported, |
** [sqlite3_vtab_config](db,SQLITE_VTAB_CONSTRAINT_SUPPORT,X) are supported, |
|
Line 7956 SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, .
|
Line 8807 SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, .
|
| SQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *); |
SQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *); |
| |
|
| /* |
/* |
| |
** CAPI3REF: Determine If Virtual Table Column Access Is For UPDATE |
| |
** |
| |
** If the sqlite3_vtab_nochange(X) routine is called within the [xColumn] |
| |
** method of a [virtual table], then it returns true if and only if the |
| |
** column is being fetched as part of an UPDATE operation during which the |
| |
** column value will not change. Applications might use this to substitute |
| |
** a return value that is less expensive to compute and that the corresponding |
| |
** [xUpdate] method understands as a "no-change" value. |
| |
** |
| |
** If the [xColumn] method calls sqlite3_vtab_nochange() and finds that |
| |
** the column is not changed by the UPDATE statement, then the xColumn |
| |
** method can optionally return without setting a result, without calling |
| |
** any of the [sqlite3_result_int|sqlite3_result_xxxxx() interfaces]. |
| |
** In that case, [sqlite3_value_nochange(X)] will return true for the |
| |
** same column in the [xUpdate] method. |
| |
*/ |
| |
SQLITE_API int sqlite3_vtab_nochange(sqlite3_context*); |
| |
|
| |
/* |
| |
** CAPI3REF: Determine The Collation For a Virtual Table Constraint |
| |
** |
| |
** This function may only be called from within a call to the [xBestIndex] |
| |
** method of a [virtual table]. |
| |
** |
| |
** The first argument must be the sqlite3_index_info object that is the |
| |
** first parameter to the xBestIndex() method. The second argument must be |
| |
** an index into the aConstraint[] array belonging to the sqlite3_index_info |
| |
** structure passed to xBestIndex. This function returns a pointer to a buffer |
| |
** containing the name of the collation sequence for the corresponding |
| |
** constraint. |
| |
*/ |
| |
SQLITE_API SQLITE_EXPERIMENTAL const char *sqlite3_vtab_collation(sqlite3_index_info*,int); |
| |
|
| |
/* |
| ** CAPI3REF: Conflict resolution modes |
** CAPI3REF: Conflict resolution modes |
| ** KEYWORDS: {conflict resolution mode} |
** KEYWORDS: {conflict resolution mode} |
| ** |
** |
|
Line 8116 SQLITE_API int sqlite3_db_cacheflush(sqlite3*);
|
Line 9001 SQLITE_API int sqlite3_db_cacheflush(sqlite3*);
|
| ** |
** |
| ** ^The [sqlite3_preupdate_hook()] interface registers a callback function |
** ^The [sqlite3_preupdate_hook()] interface registers a callback function |
| ** that is invoked prior to each [INSERT], [UPDATE], and [DELETE] operation |
** that is invoked prior to each [INSERT], [UPDATE], and [DELETE] operation |
| ** on a [rowid table]. | ** on a database table. |
| ** ^At most one preupdate hook may be registered at a time on a single |
** ^At most one preupdate hook may be registered at a time on a single |
| ** [database connection]; each call to [sqlite3_preupdate_hook()] overrides |
** [database connection]; each call to [sqlite3_preupdate_hook()] overrides |
| ** the previous setting. |
** the previous setting. |
|
Line 8125 SQLITE_API int sqlite3_db_cacheflush(sqlite3*);
|
Line 9010 SQLITE_API int sqlite3_db_cacheflush(sqlite3*);
|
| ** ^The third parameter to [sqlite3_preupdate_hook()] is passed through as |
** ^The third parameter to [sqlite3_preupdate_hook()] is passed through as |
| ** the first parameter to callbacks. |
** the first parameter to callbacks. |
| ** |
** |
| ** ^The preupdate hook only fires for changes to [rowid tables]; the preupdate | ** ^The preupdate hook only fires for changes to real database tables; the |
| ** hook is not invoked for changes to [virtual tables] or [WITHOUT ROWID] | ** preupdate hook is not invoked for changes to [virtual tables] or to |
| ** tables. | ** system tables like sqlite_master or sqlite_stat1. |
| ** |
** |
| ** ^The second parameter to the preupdate callback is a pointer to |
** ^The second parameter to the preupdate callback is a pointer to |
| ** the [database connection] that registered the preupdate hook. |
** the [database connection] that registered the preupdate hook. |
|
Line 8141 SQLITE_API int sqlite3_db_cacheflush(sqlite3*);
|
Line 9026 SQLITE_API int sqlite3_db_cacheflush(sqlite3*);
|
| ** databases.)^ |
** databases.)^ |
| ** ^The fifth parameter to the preupdate callback is the name of the |
** ^The fifth parameter to the preupdate callback is the name of the |
| ** table that is being modified. |
** table that is being modified. |
| ** ^The sixth parameter to the preupdate callback is the initial [rowid] of the |
|
| ** row being changes for SQLITE_UPDATE and SQLITE_DELETE changes and is |
|
| ** undefined for SQLITE_INSERT changes. |
|
| ** ^The seventh parameter to the preupdate callback is the final [rowid] of |
|
| ** the row being changed for SQLITE_UPDATE and SQLITE_INSERT changes and is |
|
| ** undefined for SQLITE_DELETE changes. |
|
| ** |
** |
| |
** For an UPDATE or DELETE operation on a [rowid table], the sixth |
| |
** parameter passed to the preupdate callback is the initial [rowid] of the |
| |
** row being modified or deleted. For an INSERT operation on a rowid table, |
| |
** or any operation on a WITHOUT ROWID table, the value of the sixth |
| |
** parameter is undefined. For an INSERT or UPDATE on a rowid table the |
| |
** seventh parameter is the final rowid value of the row being inserted |
| |
** or updated. The value of the seventh parameter passed to the callback |
| |
** function is not defined for operations on WITHOUT ROWID tables, or for |
| |
** INSERT operations on rowid tables. |
| |
** |
| ** 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 |
|
Line 8186 SQLITE_API int sqlite3_db_cacheflush(sqlite3*);
|
Line 9075 SQLITE_API int sqlite3_db_cacheflush(sqlite3*);
|
| ** |
** |
| ** See also: [sqlite3_update_hook()] |
** See also: [sqlite3_update_hook()] |
| */ |
*/ |
| SQLITE_API SQLITE_EXPERIMENTAL void *sqlite3_preupdate_hook( | #if defined(SQLITE_ENABLE_PREUPDATE_HOOK) |
| | SQLITE_API void *sqlite3_preupdate_hook( |
| sqlite3 *db, |
sqlite3 *db, |
| void(*xPreUpdate)( |
void(*xPreUpdate)( |
| void *pCtx, /* Copy of third arg to preupdate_hook() */ |
void *pCtx, /* Copy of third arg to preupdate_hook() */ |
|
Line 8199 SQLITE_API SQLITE_EXPERIMENTAL void *sqlite3_preupdate
|
Line 9089 SQLITE_API SQLITE_EXPERIMENTAL void *sqlite3_preupdate
|
| ), |
), |
| void* |
void* |
| ); |
); |
| SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_preupdate_old(sqlite3 *, int, sqlite3_value **); | SQLITE_API int sqlite3_preupdate_old(sqlite3 *, int, sqlite3_value **); |
| SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_preupdate_count(sqlite3 *); | SQLITE_API int sqlite3_preupdate_count(sqlite3 *); |
| SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_preupdate_depth(sqlite3 *); | SQLITE_API int sqlite3_preupdate_depth(sqlite3 *); |
| SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_preupdate_new(sqlite3 *, int, sqlite3_value **); | SQLITE_API int sqlite3_preupdate_new(sqlite3 *, int, sqlite3_value **); |
| | #endif |
| |
|
| /* |
/* |
| ** CAPI3REF: Low-level system error code |
** CAPI3REF: Low-level system error code |
|
Line 8218 SQLITE_API int sqlite3_system_errno(sqlite3*);
|
Line 9109 SQLITE_API int sqlite3_system_errno(sqlite3*);
|
| |
|
| /* |
/* |
| ** CAPI3REF: Database Snapshot |
** CAPI3REF: Database Snapshot |
| ** KEYWORDS: {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. |
|
Line 8236 SQLITE_API int sqlite3_system_errno(sqlite3*);
|
Line 9126 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 sqlite3_snapshot; | typedef struct sqlite3_snapshot { |
| | unsigned char hidden[48]; |
| | } 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 |
| ** schema S in database connection D. ^On success, the |
** schema S in database connection D. ^On success, the |
| ** [sqlite3_snapshot_get(D,S,P)] interface writes a pointer to the newly |
** [sqlite3_snapshot_get(D,S,P)] interface writes a pointer to the newly |
| ** created [sqlite3_snapshot] object into *P and returns SQLITE_OK. |
** created [sqlite3_snapshot] object into *P and returns SQLITE_OK. |
| ** ^If schema S of [database connection] D is not a [WAL mode] database | ** If there is not already a read-transaction open on schema S when |
| ** that is in a read transaction, then [sqlite3_snapshot_get(D,S,P)] | ** this function is called, one is opened automatically. |
| ** leaves the *P value unchanged and returns an appropriate [error code]. | |
| ** |
** |
| |
** The following must be true for this function to succeed. If any of |
| |
** the following statements are false when sqlite3_snapshot_get() is |
| |
** called, SQLITE_ERROR is returned. The final value of *P is undefined |
| |
** in this case. |
| |
** |
| |
** <ul> |
| |
** <li> The database handle must not be in [autocommit mode]. |
| |
** |
| |
** <li> Schema S of [database connection] D must be a [WAL mode] database. |
| |
** |
| |
** <li> There must not be a write transaction open on schema S of database |
| |
** connection D. |
| |
** |
| |
** <li> One or more transactions must have been written to the current wal |
| |
** file since it was created on disk (by any connection). This means |
| |
** that a snapshot cannot be taken on a wal mode database with no wal |
| |
** file immediately after it is first opened. At least one transaction |
| |
** must be written to it first. |
| |
** </ul> |
| |
** |
| |
** This function may also return SQLITE_NOMEM. If it is called with the |
| |
** database handle in autocommit mode but fails for some other reason, |
| |
** whether or not a read transaction is opened on schema S is undefined. |
| |
** |
| ** The [sqlite3_snapshot] object returned from a successful call to |
** The [sqlite3_snapshot] object returned from a successful call to |
| ** [sqlite3_snapshot_get()] must be freed using [sqlite3_snapshot_free()] |
** [sqlite3_snapshot_get()] must be freed using [sqlite3_snapshot_free()] |
| ** 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, |
|
Line 8272 SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_ge
|
Line 9182 SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_ge
|
| |
|
| /* |
/* |
| ** 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, a call to [sqlite3_snapshot_open(D,S,P)] must be | ** ^In order to succeed, the database connection must not be in |
| ** the first operation following the [BEGIN] that takes the schema S | ** [autocommit mode] when [sqlite3_snapshot_open(D,S,P)] is called. If there |
| ** out of [autocommit mode]. | ** is already a read transaction open on schema S, then the database handle |
| ** ^In other words, schema S must not currently be in | ** must have no active statements (SELECT statements that have been passed |
| ** a transaction for [sqlite3_snapshot_open(D,S,P)] to work, but the | ** to sqlite3_step() but not sqlite3_reset() or sqlite3_finalize()). |
| ** database connection D must be out of [autocommit mode]. | ** SQLITE_ERROR is returned if either of these conditions is violated, or |
| ** ^A [snapshot] will fail to open if it has been overwritten by a | ** if schema S does not exist, or if the snapshot object is invalid. |
| ** [checkpoint]. | ** |
| | ** ^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. |
| | ** |
| ** ^(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 |
|
Line 8300 SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_ge
|
Line 9221 SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_ge
|
| ** 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, |
|
Line 8310 SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_op
|
Line 9231 SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_op
|
| |
|
| /* |
/* |
| ** 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. |
|
Line 8342 SQLITE_API SQLITE_EXPERIMENTAL void sqlite3_snapshot_f
|
Line 9263 SQLITE_API SQLITE_EXPERIMENTAL void sqlite3_snapshot_f
|
| ** 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, |
|
Line 8349 SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_cm
|
Line 9273 SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_cm
|
| ); |
); |
| |
|
| /* |
/* |
| |
** CAPI3REF: Recover snapshots from a wal file |
| |
** METHOD: sqlite3_snapshot |
| |
** |
| |
** 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 |
| |
** 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 |
| |
** 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); |
| |
|
| |
/* |
| |
** CAPI3REF: Serialize a database |
| |
** |
| |
** The sqlite3_serialize(D,S,P,F) interface returns a pointer to memory |
| |
** that is a serialization of the S database on [database connection] D. |
| |
** If P is not a NULL pointer, then the size of the database in bytes |
| |
** is written into *P. |
| |
** |
| |
** For an ordinary on-disk database file, the serialization is just a |
| |
** copy of the disk file. For an in-memory database or a "TEMP" database, |
| |
** the serialization is the same sequence of bytes which would be written |
| |
** to disk if that database where backed up to disk. |
| |
** |
| |
** The usual case is that sqlite3_serialize() copies the serialization of |
| |
** the database into memory obtained from [sqlite3_malloc64()] and returns |
| |
** a pointer to that memory. The caller is responsible for freeing the |
| |
** returned value to avoid a memory leak. However, if the F argument |
| |
** contains the SQLITE_SERIALIZE_NOCOPY bit, then no memory allocations |
| |
** are made, and the sqlite3_serialize() function will return a pointer |
| |
** to the contiguous memory representation of the database that SQLite |
| |
** is currently using for that database, or NULL if the no such contiguous |
| |
** memory representation of the database exists. A contiguous memory |
| |
** representation of the database will usually only exist if there has |
| |
** been a prior call to [sqlite3_deserialize(D,S,...)] with the same |
| |
** values of D and S. |
| |
** The size of the database is written into *P even if the |
| |
** SQLITE_SERIALIZE_NOCOPY bit is set but no contiguous copy |
| |
** of the database exists. |
| |
** |
| |
** A call to sqlite3_serialize(D,S,P,F) might return NULL even if the |
| |
** SQLITE_SERIALIZE_NOCOPY bit is omitted from argument F if a memory |
| |
** allocation error occurs. |
| |
** |
| |
** This interface is only available if SQLite is compiled with the |
| |
** [SQLITE_ENABLE_DESERIALIZE] option. |
| |
*/ |
| |
SQLITE_API unsigned char *sqlite3_serialize( |
| |
sqlite3 *db, /* The database connection */ |
| |
const char *zSchema, /* Which DB to serialize. ex: "main", "temp", ... */ |
| |
sqlite3_int64 *piSize, /* Write size of the DB here, if not NULL */ |
| |
unsigned int mFlags /* Zero or more SQLITE_SERIALIZE_* flags */ |
| |
); |
| |
|
| |
/* |
| |
** CAPI3REF: Flags for sqlite3_serialize |
| |
** |
| |
** Zero or more of the following constants can be OR-ed together for |
| |
** the F argument to [sqlite3_serialize(D,S,P,F)]. |
| |
** |
| |
** SQLITE_SERIALIZE_NOCOPY means that [sqlite3_serialize()] will return |
| |
** a pointer to contiguous in-memory database that it is currently using, |
| |
** without making a copy of the database. If SQLite is not currently using |
| |
** a contiguous in-memory database, then this option causes |
| |
** [sqlite3_serialize()] to return a NULL pointer. SQLite will only be |
| |
** using a contiguous in-memory database if it has been initialized by a |
| |
** prior call to [sqlite3_deserialize()]. |
| |
*/ |
| |
#define SQLITE_SERIALIZE_NOCOPY 0x001 /* Do no memory allocations */ |
| |
|
| |
/* |
| |
** CAPI3REF: Deserialize a database |
| |
** |
| |
** The sqlite3_deserialize(D,S,P,N,M,F) interface causes the |
| |
** [database connection] D to disconnect from database S and then |
| |
** reopen S as an in-memory database based on the serialization contained |
| |
** in P. The serialized database P is N bytes in size. M is the size of |
| |
** the buffer P, which might be larger than N. If M is larger than N, and |
| |
** the SQLITE_DESERIALIZE_READONLY bit is not set in F, then SQLite is |
| |
** permitted to add content to the in-memory database as long as the total |
| |
** size does not exceed M bytes. |
| |
** |
| |
** If the SQLITE_DESERIALIZE_FREEONCLOSE bit is set in F, then SQLite will |
| |
** invoke sqlite3_free() on the serialization buffer when the database |
| |
** connection closes. If the SQLITE_DESERIALIZE_RESIZEABLE bit is set, then |
| |
** SQLite will try to increase the buffer size using sqlite3_realloc64() |
| |
** if writes on the database cause it to grow larger than M bytes. |
| |
** |
| |
** The sqlite3_deserialize() interface will fail with SQLITE_BUSY if the |
| |
** database is currently in a read transaction or is involved in a backup |
| |
** operation. |
| |
** |
| |
** If sqlite3_deserialize(D,S,P,N,M,F) fails for any reason and if the |
| |
** SQLITE_DESERIALIZE_FREEONCLOSE bit is set in argument F, then |
| |
** [sqlite3_free()] is invoked on argument P prior to returning. |
| |
** |
| |
** This interface is only available if SQLite is compiled with the |
| |
** [SQLITE_ENABLE_DESERIALIZE] option. |
| |
*/ |
| |
SQLITE_API int sqlite3_deserialize( |
| |
sqlite3 *db, /* The database connection */ |
| |
const char *zSchema, /* Which DB to reopen with the deserialization */ |
| |
unsigned char *pData, /* The serialized database content */ |
| |
sqlite3_int64 szDb, /* Number bytes in the deserialization */ |
| |
sqlite3_int64 szBuf, /* Total size of buffer pData[] */ |
| |
unsigned mFlags /* Zero or more SQLITE_DESERIALIZE_* flags */ |
| |
); |
| |
|
| |
/* |
| |
** CAPI3REF: Flags for sqlite3_deserialize() |
| |
** |
| |
** The following are allowed values for 6th argument (the F argument) to |
| |
** the [sqlite3_deserialize(D,S,P,N,M,F)] interface. |
| |
** |
| |
** The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization |
| |
** 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 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 |
| |
** flag should only be used if SQLITE_DESERIALIZE_FREEONCLOSE is also used. |
| |
** Without this flag, the deserialized database cannot increase in size beyond |
| |
** the number of bytes specified by the M parameter. |
| |
** |
| |
** The SQLITE_DESERIALIZE_READONLY flag means that the deserialized database |
| |
** should be treated as read-only. |
| |
*/ |
| |
#define SQLITE_DESERIALIZE_FREEONCLOSE 1 /* Call sqlite3_free() on close */ |
| |
#define SQLITE_DESERIALIZE_RESIZEABLE 2 /* Resize using sqlite3_realloc64() */ |
| |
#define SQLITE_DESERIALIZE_READONLY 4 /* Database is read-only */ |
| |
|
| |
/* |
| ** Undo the hack that converts floating point types to integer for |
** Undo the hack that converts floating point types to integer for |
| ** builds on processors without floating point support. |
** builds on processors without floating point support. |
| */ |
*/ |
|
Line 8459 struct sqlite3_rtree_query_info {
|
Line 9530 struct sqlite3_rtree_query_info {
|
| sqlite3_int64 iRowid; /* Rowid for current entry */ |
sqlite3_int64 iRowid; /* Rowid for current entry */ |
| sqlite3_rtree_dbl rParentScore; /* Score of parent node */ |
sqlite3_rtree_dbl rParentScore; /* Score of parent node */ |
| int eParentWithin; /* Visibility of parent node */ |
int eParentWithin; /* Visibility of parent node */ |
| int eWithin; /* OUT: Visiblity */ | int eWithin; /* OUT: Visibility */ |
| sqlite3_rtree_dbl rScore; /* OUT: Write the score here */ |
sqlite3_rtree_dbl rScore; /* OUT: Write the score here */ |
| /* The following fields are only available in 3.8.11 and later */ |
/* The following fields are only available in 3.8.11 and later */ |
| sqlite3_value **apSqlParam; /* Original SQL values of parameters */ |
sqlite3_value **apSqlParam; /* Original SQL values of parameters */ |
|
Line 8495 extern "C" {
|
Line 9566 extern "C" {
|
| |
|
| /* |
/* |
| ** CAPI3REF: Session Object Handle |
** CAPI3REF: Session Object Handle |
| |
** |
| |
** An instance of this object is a [session] that can be used to |
| |
** record changes to a database. |
| */ |
*/ |
| typedef struct sqlite3_session sqlite3_session; |
typedef struct sqlite3_session sqlite3_session; |
| |
|
| /* |
/* |
| ** CAPI3REF: Changeset Iterator Handle |
** CAPI3REF: Changeset Iterator Handle |
| |
** |
| |
** An instance of this object acts as a cursor for iterating |
| |
** over the elements of a [changeset] or [patchset]. |
| */ |
*/ |
| typedef struct sqlite3_changeset_iter sqlite3_changeset_iter; |
typedef struct sqlite3_changeset_iter sqlite3_changeset_iter; |
| |
|
| /* |
/* |
| ** CAPI3REF: Create A New Session Object |
** CAPI3REF: Create A New Session Object |
| |
** CONSTRUCTOR: sqlite3_session |
| ** |
** |
| ** Create a new session object attached to database handle db. If successful, |
** Create a new session object attached to database handle db. If successful, |
| ** a pointer to the new object is written to *ppSession and SQLITE_OK is |
** a pointer to the new object is written to *ppSession and SQLITE_OK is |
|
Line 8533 typedef struct sqlite3_changeset_iter sqlite3_changese
|
Line 9611 typedef struct sqlite3_changeset_iter sqlite3_changese
|
| ** attached database. It is not an error if database zDb is not attached |
** attached database. It is not an error if database zDb is not attached |
| ** to the database when the session object is created. |
** to the database when the session object is created. |
| */ |
*/ |
| int sqlite3session_create( | SQLITE_API int sqlite3session_create( |
| sqlite3 *db, /* Database handle */ |
sqlite3 *db, /* Database handle */ |
| const char *zDb, /* Name of db (e.g. "main") */ |
const char *zDb, /* Name of db (e.g. "main") */ |
| sqlite3_session **ppSession /* OUT: New session object */ |
sqlite3_session **ppSession /* OUT: New session object */ |
|
Line 8541 int sqlite3session_create(
|
Line 9619 int sqlite3session_create(
|
| |
|
| /* |
/* |
| ** CAPI3REF: Delete A Session Object |
** CAPI3REF: Delete A Session Object |
| |
** DESTRUCTOR: sqlite3_session |
| ** |
** |
| ** Delete a session object previously allocated using |
** Delete a session object previously allocated using |
| ** [sqlite3session_create()]. Once a session object has been deleted, the |
** [sqlite3session_create()]. Once a session object has been deleted, the |
|
Line 8551 int sqlite3session_create(
|
Line 9630 int sqlite3session_create(
|
| ** are attached is closed. Refer to the documentation for |
** are attached is closed. Refer to the documentation for |
| ** [sqlite3session_create()] for details. |
** [sqlite3session_create()] for details. |
| */ |
*/ |
| void sqlite3session_delete(sqlite3_session *pSession); | SQLITE_API void sqlite3session_delete(sqlite3_session *pSession); |
| |
|
| |
|
| /* |
/* |
| ** CAPI3REF: Enable Or Disable A Session Object |
** CAPI3REF: Enable Or Disable A Session Object |
| |
** METHOD: sqlite3_session |
| ** |
** |
| ** Enable or disable the recording of changes by a session object. When |
** Enable or disable the recording of changes by a session object. When |
| ** enabled, a session object records changes made to the database. When |
** enabled, a session object records changes made to the database. When |
|
Line 8571 void sqlite3session_delete(sqlite3_session *pSession);
|
Line 9651 void sqlite3session_delete(sqlite3_session *pSession);
|
| ** The return value indicates the final state of the session object: 0 if |
** The return value indicates the final state of the session object: 0 if |
| ** the session is disabled, or 1 if it is enabled. |
** the session is disabled, or 1 if it is enabled. |
| */ |
*/ |
| int sqlite3session_enable(sqlite3_session *pSession, int bEnable); | SQLITE_API int sqlite3session_enable(sqlite3_session *pSession, int bEnable); |
| |
|
| /* |
/* |
| ** CAPI3REF: Set Or Clear the Indirect Change Flag |
** CAPI3REF: Set Or Clear the Indirect Change Flag |
| |
** METHOD: sqlite3_session |
| ** |
** |
| ** Each change recorded by a session object is marked as either direct or |
** Each change recorded by a session object is marked as either direct or |
| ** indirect. A change is marked as indirect if either: |
** indirect. A change is marked as indirect if either: |
|
Line 8600 int sqlite3session_enable(sqlite3_session *pSession, i
|
Line 9681 int sqlite3session_enable(sqlite3_session *pSession, i
|
| ** The return value indicates the final state of the indirect flag: 0 if |
** The return value indicates the final state of the indirect flag: 0 if |
| ** it is clear, or 1 if it is set. |
** it is clear, or 1 if it is set. |
| */ |
*/ |
| int sqlite3session_indirect(sqlite3_session *pSession, int bIndirect); | SQLITE_API int sqlite3session_indirect(sqlite3_session *pSession, int bIndirect); |
| |
|
| /* |
/* |
| ** CAPI3REF: Attach A Table To A Session Object |
** CAPI3REF: Attach A Table To A Session Object |
| |
** METHOD: sqlite3_session |
| ** |
** |
| ** If argument zTab is not NULL, then it is the name of a table to attach |
** If argument zTab is not NULL, then it is the name of a table to attach |
| ** to the session object passed as the first argument. All subsequent changes |
** to the session object passed as the first argument. All subsequent changes |
|
Line 8629 int sqlite3session_indirect(sqlite3_session *pSession,
|
Line 9711 int sqlite3session_indirect(sqlite3_session *pSession,
|
| ** |
** |
| ** SQLITE_OK is returned if the call completes without error. Or, if an error |
** SQLITE_OK is returned if the call completes without error. Or, if an error |
| ** occurs, an SQLite error code (e.g. SQLITE_NOMEM) is returned. |
** occurs, an SQLite error code (e.g. SQLITE_NOMEM) is returned. |
| |
** |
| |
** <h3>Special sqlite_stat1 Handling</h3> |
| |
** |
| |
** As of SQLite version 3.22.0, the "sqlite_stat1" table is an exception to |
| |
** some of the rules above. In SQLite, the schema of sqlite_stat1 is: |
| |
** <pre> |
| |
** CREATE TABLE sqlite_stat1(tbl,idx,stat) |
| |
** </pre> |
| |
** |
| |
** Even though sqlite_stat1 does not have a PRIMARY KEY, changes are |
| |
** recorded for it as if the PRIMARY KEY is (tbl,idx). Additionally, changes |
| |
** are recorded for rows for which (idx IS NULL) is true. However, for such |
| |
** rows a zero-length blob (SQL value X'') is stored in the changeset or |
| |
** patchset instead of a NULL value. This allows such changesets to be |
| |
** manipulated by legacy implementations of sqlite3changeset_invert(), |
| |
** concat() and similar. |
| |
** |
| |
** The sqlite3changeset_apply() function automatically converts the |
| |
** zero-length blob back to a NULL value when updating the sqlite_stat1 |
| |
** table. However, if the application calls sqlite3changeset_new(), |
| |
** sqlite3changeset_old() or sqlite3changeset_conflict on a changeset |
| |
** iterator directly (including on a changeset iterator passed to a |
| |
** conflict-handler callback) then the X'' value is returned. The application |
| |
** must translate X'' to NULL itself if required. |
| |
** |
| |
** Legacy (older than 3.22.0) versions of the sessions module cannot capture |
| |
** changes made to the sqlite_stat1 table. Legacy versions of the |
| |
** sqlite3changeset_apply() function silently ignore any modifications to the |
| |
** sqlite_stat1 table that are part of a changeset or patchset. |
| */ |
*/ |
| int sqlite3session_attach( | SQLITE_API int sqlite3session_attach( |
| sqlite3_session *pSession, /* Session object */ |
sqlite3_session *pSession, /* Session object */ |
| const char *zTab /* Table name */ |
const char *zTab /* Table name */ |
| ); |
); |
| |
|
| /* |
/* |
| ** CAPI3REF: Set a table filter on a Session Object. |
** CAPI3REF: Set a table filter on a Session Object. |
| |
** METHOD: sqlite3_session |
| ** |
** |
| ** The second argument (xFilter) is the "filter callback". For changes to rows |
** The second argument (xFilter) is the "filter callback". For changes to rows |
| ** in tables that are not attached to the Session oject, the filter is called | ** in tables that are not attached to the Session object, the filter is called |
| ** to determine whether changes to the table's rows should be tracked or not. |
** to determine whether changes to the table's rows should be tracked or not. |
| ** If xFilter returns 0, changes is not tracked. Note that once a table is |
** If xFilter returns 0, changes is not tracked. Note that once a table is |
| ** attached, xFilter will not be called again. |
** attached, xFilter will not be called again. |
| */ |
*/ |
| void sqlite3session_table_filter( | SQLITE_API void sqlite3session_table_filter( |
| sqlite3_session *pSession, /* Session object */ |
sqlite3_session *pSession, /* Session object */ |
| int(*xFilter)( |
int(*xFilter)( |
| void *pCtx, /* Copy of third arg to _filter_table() */ |
void *pCtx, /* Copy of third arg to _filter_table() */ |
|
Line 8655 void sqlite3session_table_filter(
|
Line 9767 void sqlite3session_table_filter(
|
| |
|
| /* |
/* |
| ** CAPI3REF: Generate A Changeset From A Session Object |
** CAPI3REF: Generate A Changeset From A Session Object |
| |
** METHOD: sqlite3_session |
| ** |
** |
| ** Obtain a changeset containing changes to the tables attached to the |
** Obtain a changeset containing changes to the tables attached to the |
| ** session object passed as the first argument. If successful, |
** session object passed as the first argument. If successful, |
|
Line 8757 void sqlite3session_table_filter(
|
Line 9870 void sqlite3session_table_filter(
|
| ** another field of the same row is updated while the session is enabled, the |
** another field of the same row is updated while the session is enabled, the |
| ** resulting changeset will contain an UPDATE change that updates both fields. |
** resulting changeset will contain an UPDATE change that updates both fields. |
| */ |
*/ |
| int sqlite3session_changeset( | SQLITE_API int sqlite3session_changeset( |
| sqlite3_session *pSession, /* Session object */ |
sqlite3_session *pSession, /* Session object */ |
| int *pnChangeset, /* OUT: Size of buffer at *ppChangeset */ |
int *pnChangeset, /* OUT: Size of buffer at *ppChangeset */ |
| void **ppChangeset /* OUT: Buffer containing changeset */ |
void **ppChangeset /* OUT: Buffer containing changeset */ |
| ); |
); |
| |
|
| /* |
/* |
| ** CAPI3REF: Load The Difference Between Tables Into A Session | ** CAPI3REF: Load The Difference Between Tables Into A Session |
| | ** METHOD: sqlite3_session |
| ** |
** |
| ** If it is not already attached to the session object passed as the first |
** If it is not already attached to the session object passed as the first |
| ** argument, this function attaches table zTbl in the same manner as the |
** argument, this function attaches table zTbl in the same manner as the |
|
Line 8801 int sqlite3session_changeset(
|
Line 9915 int sqlite3session_changeset(
|
| ** the from-table, a DELETE record is added to the session object. |
** the from-table, a DELETE record is added to the session object. |
| ** |
** |
| ** <li> For each row (primary key) that exists in both tables, but features |
** <li> For each row (primary key) that exists in both tables, but features |
| ** different in each, an UPDATE record is added to the session. | ** different non-PK values in each, an UPDATE record is added to the |
| | ** session. |
| ** </ul> |
** </ul> |
| ** |
** |
| ** To clarify, if this function is called and then a changeset constructed |
** To clarify, if this function is called and then a changeset constructed |
|
Line 8818 int sqlite3session_changeset(
|
Line 9933 int sqlite3session_changeset(
|
| ** message. It is the responsibility of the caller to free this buffer using |
** message. It is the responsibility of the caller to free this buffer using |
| ** sqlite3_free(). |
** sqlite3_free(). |
| */ |
*/ |
| int sqlite3session_diff( | SQLITE_API int sqlite3session_diff( |
| sqlite3_session *pSession, |
sqlite3_session *pSession, |
| const char *zFromDb, |
const char *zFromDb, |
| const char *zTbl, |
const char *zTbl, |
|
Line 8828 int sqlite3session_diff(
|
Line 9943 int sqlite3session_diff(
|
| |
|
| /* |
/* |
| ** CAPI3REF: Generate A Patchset From A Session Object |
** CAPI3REF: Generate A Patchset From A Session Object |
| |
** METHOD: sqlite3_session |
| ** |
** |
| ** The differences between a patchset and a changeset are that: |
** The differences between a patchset and a changeset are that: |
| ** |
** |
|
Line 8854 int sqlite3session_diff(
|
Line 9970 int sqlite3session_diff(
|
| ** a single table are grouped together, tables appear in the order in which |
** a single table are grouped together, tables appear in the order in which |
| ** they were attached to the session object). |
** they were attached to the session object). |
| */ |
*/ |
| int sqlite3session_patchset( | SQLITE_API int sqlite3session_patchset( |
| sqlite3_session *pSession, /* Session object */ |
sqlite3_session *pSession, /* Session object */ |
| int *pnPatchset, /* OUT: Size of buffer at *ppChangeset */ | int *pnPatchset, /* OUT: Size of buffer at *ppPatchset */ |
| void **ppPatchset /* OUT: Buffer containing changeset */ | void **ppPatchset /* OUT: Buffer containing patchset */ |
| ); |
); |
| |
|
| /* |
/* |
|
Line 8875 int sqlite3session_patchset(
|
Line 9991 int sqlite3session_patchset(
|
| ** guaranteed that a call to sqlite3session_changeset() will return a |
** guaranteed that a call to sqlite3session_changeset() will return a |
| ** changeset containing zero changes. |
** changeset containing zero changes. |
| */ |
*/ |
| int sqlite3session_isempty(sqlite3_session *pSession); | SQLITE_API int sqlite3session_isempty(sqlite3_session *pSession); |
| |
|
| /* |
/* |
| ** CAPI3REF: Create An Iterator To Traverse A Changeset |
** CAPI3REF: Create An Iterator To Traverse A Changeset |
| |
** CONSTRUCTOR: sqlite3_changeset_iter |
| ** |
** |
| ** Create an iterator used to iterate through the contents of a changeset. |
** Create an iterator used to iterate through the contents of a changeset. |
| ** If successful, *pp is set to point to the iterator handle and SQLITE_OK |
** If successful, *pp is set to point to the iterator handle and SQLITE_OK |
|
Line 8905 int sqlite3session_isempty(sqlite3_session *pSession);
|
Line 10022 int sqlite3session_isempty(sqlite3_session *pSession);
|
| ** [sqlite3changeset_invert()] functions, all changes within the changeset |
** [sqlite3changeset_invert()] functions, all changes within the changeset |
| ** that apply to a single table are grouped together. This means that when |
** that apply to a single table are grouped together. This means that when |
| ** an application iterates through a changeset using an iterator created by |
** an application iterates through a changeset using an iterator created by |
| ** this function, all changes that relate to a single table are visted | ** this function, all changes that relate to a single table are visited |
| ** consecutively. There is no chance that the iterator will visit a change |
** consecutively. There is no chance that the iterator will visit a change |
| ** the applies to table X, then one for table Y, and then later on visit |
** the applies to table X, then one for table Y, and then later on visit |
| ** another change for table X. |
** another change for table X. |
| |
** |
| |
** The behavior of sqlite3changeset_start_v2() and its streaming equivalent |
| |
** may be modified by passing a combination of |
| |
** [SQLITE_CHANGESETSTART_INVERT | supported flags] as the 4th parameter. |
| |
** |
| |
** Note that the sqlite3changeset_start_v2() API is still <b>experimental</b> |
| |
** and therefore subject to change. |
| */ |
*/ |
| int sqlite3changeset_start( | SQLITE_API int sqlite3changeset_start( |
| sqlite3_changeset_iter **pp, /* OUT: New changeset iterator handle */ |
sqlite3_changeset_iter **pp, /* OUT: New changeset iterator handle */ |
| int nChangeset, /* Size of changeset blob in bytes */ |
int nChangeset, /* Size of changeset blob in bytes */ |
| void *pChangeset /* Pointer to blob containing changeset */ |
void *pChangeset /* Pointer to blob containing changeset */ |
| ); |
); |
| |
SQLITE_API int sqlite3changeset_start_v2( |
| |
sqlite3_changeset_iter **pp, /* OUT: New changeset iterator handle */ |
| |
int nChangeset, /* Size of changeset blob in bytes */ |
| |
void *pChangeset, /* Pointer to blob containing changeset */ |
| |
int flags /* SESSION_CHANGESETSTART_* flags */ |
| |
); |
| |
|
| |
/* |
| |
** CAPI3REF: Flags for sqlite3changeset_start_v2 |
| |
** |
| |
** The following flags may passed via the 4th parameter to |
| |
** [sqlite3changeset_start_v2] and [sqlite3changeset_start_v2_strm]: |
| |
** |
| |
** <dt>SQLITE_CHANGESETAPPLY_INVERT <dd> |
| |
** Invert the changeset while iterating through it. This is equivalent to |
| |
** inverting a changeset using sqlite3changeset_invert() before applying it. |
| |
** It is an error to specify this flag with a patchset. |
| |
*/ |
| |
#define SQLITE_CHANGESETSTART_INVERT 0x0002 |
| |
|
| |
|
| /* |
/* |
| ** CAPI3REF: Advance A Changeset Iterator |
** CAPI3REF: Advance A Changeset Iterator |
| |
** METHOD: sqlite3_changeset_iter |
| ** |
** |
| ** This function may only be used with iterators created by function |
** This function may only be used with iterators created by function |
| ** [sqlite3changeset_start()]. If it is called on an iterator passed to |
** [sqlite3changeset_start()]. If it is called on an iterator passed to |
|
Line 8939 int sqlite3changeset_start(
|
Line 10083 int sqlite3changeset_start(
|
| ** codes include SQLITE_CORRUPT (if the changeset buffer is corrupt) or |
** codes include SQLITE_CORRUPT (if the changeset buffer is corrupt) or |
| ** SQLITE_NOMEM. |
** SQLITE_NOMEM. |
| */ |
*/ |
| int sqlite3changeset_next(sqlite3_changeset_iter *pIter); | SQLITE_API int sqlite3changeset_next(sqlite3_changeset_iter *pIter); |
| |
|
| /* |
/* |
| ** CAPI3REF: Obtain The Current Operation From A Changeset Iterator |
** CAPI3REF: Obtain The Current Operation From A Changeset Iterator |
| |
** METHOD: sqlite3_changeset_iter |
| ** |
** |
| ** The pIter argument passed to this function may either be an iterator |
** The pIter argument passed to this function may either be an iterator |
| ** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator |
** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator |
|
Line 8956 int sqlite3changeset_next(sqlite3_changeset_iter *pIte
|
Line 10101 int sqlite3changeset_next(sqlite3_changeset_iter *pIte
|
| ** sqlite3changeset_next() is called on the iterator or until the |
** sqlite3changeset_next() is called on the iterator or until the |
| ** conflict-handler function returns. If pnCol is not NULL, then *pnCol is |
** conflict-handler function returns. If pnCol is not NULL, then *pnCol is |
| ** set to the number of columns in the table affected by the change. If |
** set to the number of columns in the table affected by the change. If |
| ** pbIncorrect is not NULL, then *pbIndirect is set to true (1) if the change | ** pbIndirect is not NULL, then *pbIndirect is set to true (1) if the change |
| ** is an indirect change, or false (0) otherwise. See the documentation for |
** is an indirect change, or false (0) otherwise. See the documentation for |
| ** [sqlite3session_indirect()] for a description of direct and indirect |
** [sqlite3session_indirect()] for a description of direct and indirect |
| ** changes. Finally, if pOp is not NULL, then *pOp is set to one of |
** changes. Finally, if pOp is not NULL, then *pOp is set to one of |
|
Line 8967 int sqlite3changeset_next(sqlite3_changeset_iter *pIte
|
Line 10112 int sqlite3changeset_next(sqlite3_changeset_iter *pIte
|
| ** SQLite error code is returned. The values of the output variables may not |
** SQLite error code is returned. The values of the output variables may not |
| ** be trusted in this case. |
** be trusted in this case. |
| */ |
*/ |
| int sqlite3changeset_op( | SQLITE_API int sqlite3changeset_op( |
| sqlite3_changeset_iter *pIter, /* Iterator object */ |
sqlite3_changeset_iter *pIter, /* Iterator object */ |
| const char **pzTab, /* OUT: Pointer to table name */ |
const char **pzTab, /* OUT: Pointer to table name */ |
| int *pnCol, /* OUT: Number of columns in table */ |
int *pnCol, /* OUT: Number of columns in table */ |
|
Line 8977 int sqlite3changeset_op(
|
Line 10122 int sqlite3changeset_op(
|
| |
|
| /* |
/* |
| ** CAPI3REF: Obtain The Primary Key Definition Of A Table |
** CAPI3REF: Obtain The Primary Key Definition Of A Table |
| |
** METHOD: sqlite3_changeset_iter |
| ** |
** |
| ** For each modified table, a changeset includes the following: |
** For each modified table, a changeset includes the following: |
| ** |
** |
|
Line 8992 int sqlite3changeset_op(
|
Line 10138 int sqlite3changeset_op(
|
| ** 0x01 if the corresponding column is part of the tables primary key, or |
** 0x01 if the corresponding column is part of the tables primary key, or |
| ** 0x00 if it is not. |
** 0x00 if it is not. |
| ** |
** |
| ** If argumet pnCol is not NULL, then *pnCol is set to the number of columns | ** If argument pnCol is not NULL, then *pnCol is set to the number of columns |
| ** in the table. |
** in the table. |
| ** |
** |
| ** If this function is called when the iterator does not point to a valid |
** If this function is called when the iterator does not point to a valid |
|
Line 9000 int sqlite3changeset_op(
|
Line 10146 int sqlite3changeset_op(
|
| ** SQLITE_OK is returned and the output variables populated as described |
** SQLITE_OK is returned and the output variables populated as described |
| ** above. |
** above. |
| */ |
*/ |
| int sqlite3changeset_pk( | SQLITE_API int sqlite3changeset_pk( |
| sqlite3_changeset_iter *pIter, /* Iterator object */ |
sqlite3_changeset_iter *pIter, /* Iterator object */ |
| unsigned char **pabPK, /* OUT: Array of boolean - true for PK cols */ |
unsigned char **pabPK, /* OUT: Array of boolean - true for PK cols */ |
| int *pnCol /* OUT: Number of entries in output array */ |
int *pnCol /* OUT: Number of entries in output array */ |
|
Line 9008 int sqlite3changeset_pk(
|
Line 10154 int sqlite3changeset_pk(
|
| |
|
| /* |
/* |
| ** CAPI3REF: Obtain old.* Values From A Changeset Iterator |
** CAPI3REF: Obtain old.* Values From A Changeset Iterator |
| |
** METHOD: sqlite3_changeset_iter |
| ** |
** |
| ** The pIter argument passed to this function may either be an iterator |
** The pIter argument passed to this function may either be an iterator |
| ** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator |
** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator |
|
Line 9030 int sqlite3changeset_pk(
|
Line 10177 int sqlite3changeset_pk(
|
| ** If some other error occurs (e.g. an OOM condition), an SQLite error code |
** If some other error occurs (e.g. an OOM condition), an SQLite error code |
| ** is returned and *ppValue is set to NULL. |
** is returned and *ppValue is set to NULL. |
| */ |
*/ |
| int sqlite3changeset_old( | SQLITE_API int sqlite3changeset_old( |
| sqlite3_changeset_iter *pIter, /* Changeset iterator */ |
sqlite3_changeset_iter *pIter, /* Changeset iterator */ |
| int iVal, /* Column number */ |
int iVal, /* Column number */ |
| sqlite3_value **ppValue /* OUT: Old value (or NULL pointer) */ |
sqlite3_value **ppValue /* OUT: Old value (or NULL pointer) */ |
|
Line 9038 int sqlite3changeset_old(
|
Line 10185 int sqlite3changeset_old(
|
| |
|
| /* |
/* |
| ** CAPI3REF: Obtain new.* Values From A Changeset Iterator |
** CAPI3REF: Obtain new.* Values From A Changeset Iterator |
| |
** METHOD: sqlite3_changeset_iter |
| ** |
** |
| ** The pIter argument passed to this function may either be an iterator |
** The pIter argument passed to this function may either be an iterator |
| ** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator |
** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator |
|
Line 9063 int sqlite3changeset_old(
|
Line 10211 int sqlite3changeset_old(
|
| ** If some other error occurs (e.g. an OOM condition), an SQLite error code |
** If some other error occurs (e.g. an OOM condition), an SQLite error code |
| ** is returned and *ppValue is set to NULL. |
** is returned and *ppValue is set to NULL. |
| */ |
*/ |
| int sqlite3changeset_new( | SQLITE_API int sqlite3changeset_new( |
| sqlite3_changeset_iter *pIter, /* Changeset iterator */ |
sqlite3_changeset_iter *pIter, /* Changeset iterator */ |
| int iVal, /* Column number */ |
int iVal, /* Column number */ |
| sqlite3_value **ppValue /* OUT: New value (or NULL pointer) */ |
sqlite3_value **ppValue /* OUT: New value (or NULL pointer) */ |
|
Line 9071 int sqlite3changeset_new(
|
Line 10219 int sqlite3changeset_new(
|
| |
|
| /* |
/* |
| ** CAPI3REF: Obtain Conflicting Row Values From A Changeset Iterator |
** CAPI3REF: Obtain Conflicting Row Values From A Changeset Iterator |
| |
** METHOD: sqlite3_changeset_iter |
| ** |
** |
| ** This function should only be used with iterator objects passed to a |
** This function should only be used with iterator objects passed to a |
| ** conflict-handler callback by [sqlite3changeset_apply()] with either |
** conflict-handler callback by [sqlite3changeset_apply()] with either |
|
Line 9090 int sqlite3changeset_new(
|
Line 10239 int sqlite3changeset_new(
|
| ** If some other error occurs (e.g. an OOM condition), an SQLite error code |
** If some other error occurs (e.g. an OOM condition), an SQLite error code |
| ** is returned and *ppValue is set to NULL. |
** is returned and *ppValue is set to NULL. |
| */ |
*/ |
| int sqlite3changeset_conflict( | SQLITE_API int sqlite3changeset_conflict( |
| sqlite3_changeset_iter *pIter, /* Changeset iterator */ |
sqlite3_changeset_iter *pIter, /* Changeset iterator */ |
| int iVal, /* Column number */ |
int iVal, /* Column number */ |
| sqlite3_value **ppValue /* OUT: Value from conflicting row */ |
sqlite3_value **ppValue /* OUT: Value from conflicting row */ |
|
Line 9098 int sqlite3changeset_conflict(
|
Line 10247 int sqlite3changeset_conflict(
|
| |
|
| /* |
/* |
| ** CAPI3REF: Determine The Number Of Foreign Key Constraint Violations |
** CAPI3REF: Determine The Number Of Foreign Key Constraint Violations |
| |
** METHOD: sqlite3_changeset_iter |
| ** |
** |
| ** This function may only be called with an iterator passed to an |
** This function may only be called with an iterator passed to an |
| ** SQLITE_CHANGESET_FOREIGN_KEY conflict handler callback. In this case |
** SQLITE_CHANGESET_FOREIGN_KEY conflict handler callback. In this case |
|
Line 9106 int sqlite3changeset_conflict(
|
Line 10256 int sqlite3changeset_conflict(
|
| ** |
** |
| ** In all other cases this function returns SQLITE_MISUSE. |
** In all other cases this function returns SQLITE_MISUSE. |
| */ |
*/ |
| int sqlite3changeset_fk_conflicts( | SQLITE_API int sqlite3changeset_fk_conflicts( |
| sqlite3_changeset_iter *pIter, /* Changeset iterator */ |
sqlite3_changeset_iter *pIter, /* Changeset iterator */ |
| int *pnOut /* OUT: Number of FK violations */ |
int *pnOut /* OUT: Number of FK violations */ |
| ); |
); |
|
Line 9114 int sqlite3changeset_fk_conflicts(
|
Line 10264 int sqlite3changeset_fk_conflicts(
|
| |
|
| /* |
/* |
| ** CAPI3REF: Finalize A Changeset Iterator |
** CAPI3REF: Finalize A Changeset Iterator |
| |
** METHOD: sqlite3_changeset_iter |
| ** |
** |
| ** This function is used to finalize an iterator allocated with |
** This function is used to finalize an iterator allocated with |
| ** [sqlite3changeset_start()]. |
** [sqlite3changeset_start()]. |
|
Line 9130 int sqlite3changeset_fk_conflicts(
|
Line 10281 int sqlite3changeset_fk_conflicts(
|
| ** to that error is returned by this function. Otherwise, SQLITE_OK is |
** to that error is returned by this function. Otherwise, SQLITE_OK is |
| ** returned. This is to allow the following pattern (pseudo-code): |
** returned. This is to allow the following pattern (pseudo-code): |
| ** |
** |
| |
** <pre> |
| ** sqlite3changeset_start(); |
** sqlite3changeset_start(); |
| ** while( SQLITE_ROW==sqlite3changeset_next() ){ |
** while( SQLITE_ROW==sqlite3changeset_next() ){ |
| ** // Do something with change. |
** // Do something with change. |
|
Line 9138 int sqlite3changeset_fk_conflicts(
|
Line 10290 int sqlite3changeset_fk_conflicts(
|
| ** if( rc!=SQLITE_OK ){ |
** if( rc!=SQLITE_OK ){ |
| ** // An error has occurred |
** // An error has occurred |
| ** } |
** } |
| |
** </pre> |
| */ |
*/ |
| int sqlite3changeset_finalize(sqlite3_changeset_iter *pIter); | SQLITE_API int sqlite3changeset_finalize(sqlite3_changeset_iter *pIter); |
| |
|
| /* |
/* |
| ** CAPI3REF: Invert A Changeset |
** CAPI3REF: Invert A Changeset |
|
Line 9169 int sqlite3changeset_finalize(sqlite3_changeset_iter *
|
Line 10322 int sqlite3changeset_finalize(sqlite3_changeset_iter *
|
| ** WARNING/TODO: This function currently assumes that the input is a valid |
** WARNING/TODO: This function currently assumes that the input is a valid |
| ** changeset. If it is not, the results are undefined. |
** changeset. If it is not, the results are undefined. |
| */ |
*/ |
| int sqlite3changeset_invert( | SQLITE_API int sqlite3changeset_invert( |
| int nIn, const void *pIn, /* Input changeset */ |
int nIn, const void *pIn, /* Input changeset */ |
| int *pnOut, void **ppOut /* OUT: Inverse of input */ |
int *pnOut, void **ppOut /* OUT: Inverse of input */ |
| ); |
); |
|
Line 9185 int sqlite3changeset_invert(
|
Line 10338 int sqlite3changeset_invert(
|
| ** sqlite3_changegroup object. Calling it produces similar results as the |
** sqlite3_changegroup object. Calling it produces similar results as the |
| ** following code fragment: |
** following code fragment: |
| ** |
** |
| |
** <pre> |
| ** sqlite3_changegroup *pGrp; |
** sqlite3_changegroup *pGrp; |
| ** rc = sqlite3_changegroup_new(&pGrp); |
** rc = sqlite3_changegroup_new(&pGrp); |
| ** if( rc==SQLITE_OK ) rc = sqlite3changegroup_add(pGrp, nA, pA); |
** if( rc==SQLITE_OK ) rc = sqlite3changegroup_add(pGrp, nA, pA); |
|
Line 9195 int sqlite3changeset_invert(
|
Line 10349 int sqlite3changeset_invert(
|
| ** *ppOut = 0; |
** *ppOut = 0; |
| ** *pnOut = 0; |
** *pnOut = 0; |
| ** } |
** } |
| |
** </pre> |
| ** |
** |
| ** Refer to the sqlite3_changegroup documentation below for details. |
** Refer to the sqlite3_changegroup documentation below for details. |
| */ |
*/ |
| int sqlite3changeset_concat( | SQLITE_API int sqlite3changeset_concat( |
| int nA, /* Number of bytes in buffer pA */ |
int nA, /* Number of bytes in buffer pA */ |
| void *pA, /* Pointer to buffer containing changeset A */ |
void *pA, /* Pointer to buffer containing changeset A */ |
| int nB, /* Number of bytes in buffer pB */ |
int nB, /* Number of bytes in buffer pB */ |
|
Line 9209 int sqlite3changeset_concat(
|
Line 10364 int sqlite3changeset_concat(
|
| |
|
| |
|
| /* |
/* |
| ** Changegroup handle. | ** CAPI3REF: Changegroup Handle |
| | ** |
| | ** A changegroup is an object used to combine two or more |
| | ** [changesets] or [patchsets] |
| */ |
*/ |
| typedef struct sqlite3_changegroup sqlite3_changegroup; |
typedef struct sqlite3_changegroup sqlite3_changegroup; |
| |
|
| /* |
/* |
| ** CAPI3REF: Combine two or more changesets into a single changeset. | ** CAPI3REF: Create A New Changegroup Object |
| | ** CONSTRUCTOR: sqlite3_changegroup |
| ** |
** |
| ** An sqlite3_changegroup object is used to combine two or more changesets |
** An sqlite3_changegroup object is used to combine two or more changesets |
| ** (or patchsets) into a single changeset (or patchset). A single changegroup |
** (or patchsets) into a single changeset (or patchset). A single changegroup |
|
Line 9248 typedef struct sqlite3_changegroup sqlite3_changegroup
|
Line 10407 typedef struct sqlite3_changegroup sqlite3_changegroup
|
| ** sqlite3changegroup_output() functions, also available are the streaming |
** sqlite3changegroup_output() functions, also available are the streaming |
| ** versions sqlite3changegroup_add_strm() and sqlite3changegroup_output_strm(). |
** versions sqlite3changegroup_add_strm() and sqlite3changegroup_output_strm(). |
| */ |
*/ |
| int sqlite3changegroup_new(sqlite3_changegroup **pp); | SQLITE_API int sqlite3changegroup_new(sqlite3_changegroup **pp); |
| |
|
| /* |
/* |
| |
** CAPI3REF: Add A Changeset To A Changegroup |
| |
** METHOD: sqlite3_changegroup |
| |
** |
| ** Add all changes within the changeset (or patchset) in buffer pData (size |
** Add all changes within the changeset (or patchset) in buffer pData (size |
| ** nData bytes) to the changegroup. |
** nData bytes) to the changegroup. |
| ** |
** |
|
Line 9265 int sqlite3changegroup_new(sqlite3_changegroup **pp);
|
Line 10427 int sqlite3changegroup_new(sqlite3_changegroup **pp);
|
| ** apply to the same row as a change already present in the changegroup if |
** apply to the same row as a change already present in the changegroup if |
| ** the two rows have the same primary key. |
** the two rows have the same primary key. |
| ** |
** |
| ** Changes to rows that that do not already appear in the changegroup are | ** Changes to rows that do not already appear in the changegroup are |
| ** simply copied into it. Or, if both the new changeset and the changegroup |
** simply copied into it. Or, if both the new changeset and the changegroup |
| ** contain changes that apply to a single row, the final contents of the |
** contain changes that apply to a single row, the final contents of the |
| ** changegroup depends on the type of each change, as follows: |
** changegroup depends on the type of each change, as follows: |
|
Line 9323 int sqlite3changegroup_new(sqlite3_changegroup **pp);
|
Line 10485 int sqlite3changegroup_new(sqlite3_changegroup **pp);
|
| ** |
** |
| ** If no error occurs, SQLITE_OK is returned. |
** If no error occurs, SQLITE_OK is returned. |
| */ |
*/ |
| int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData); | SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData); |
| |
|
| /* |
/* |
| |
** CAPI3REF: Obtain A Composite Changeset From A Changegroup |
| |
** METHOD: sqlite3_changegroup |
| |
** |
| ** Obtain a buffer containing a changeset (or patchset) representing the |
** Obtain a buffer containing a changeset (or patchset) representing the |
| ** current contents of the changegroup. If the inputs to the changegroup |
** current contents of the changegroup. If the inputs to the changegroup |
| ** were themselves changesets, the output is a changeset. Or, if the |
** were themselves changesets, the output is a changeset. Or, if the |
|
Line 9347 int sqlite3changegroup_add(sqlite3_changegroup*, int n
|
Line 10512 int sqlite3changegroup_add(sqlite3_changegroup*, int n
|
| ** responsibility of the caller to eventually free the buffer using a |
** responsibility of the caller to eventually free the buffer using a |
| ** call to sqlite3_free(). |
** call to sqlite3_free(). |
| */ |
*/ |
| int sqlite3changegroup_output( | SQLITE_API int sqlite3changegroup_output( |
| sqlite3_changegroup*, |
sqlite3_changegroup*, |
| int *pnData, /* OUT: Size of output buffer in bytes */ |
int *pnData, /* OUT: Size of output buffer in bytes */ |
| void **ppData /* OUT: Pointer to output buffer */ |
void **ppData /* OUT: Pointer to output buffer */ |
| ); |
); |
| |
|
| /* |
/* |
| ** Delete a changegroup object. | ** CAPI3REF: Delete A Changegroup Object |
| | ** DESTRUCTOR: sqlite3_changegroup |
| */ |
*/ |
| void sqlite3changegroup_delete(sqlite3_changegroup*); | SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup*); |
| |
|
| /* |
/* |
| ** CAPI3REF: Apply A Changeset To A Database |
** CAPI3REF: Apply A Changeset To A Database |
| ** |
** |
| ** Apply a changeset to a database. This function attempts to update the | ** Apply a changeset or patchset to a database. These functions attempt to |
| ** "main" database attached to handle db with the changes found in the | ** update the "main" database attached to handle db with the changes found in |
| ** changeset passed via the second and third arguments. | ** the changeset passed via the second and third arguments. |
| ** |
** |
| ** The fourth argument (xFilter) passed to this function is the "filter | ** The fourth argument (xFilter) passed to these functions is the "filter |
| ** callback". If it is not NULL, then for each table affected by at least one |
** callback". If it is not NULL, then for each table affected by at least one |
| ** change in the changeset, the filter callback is invoked with |
** change in the changeset, the filter callback is invoked with |
| ** the table name as the second argument, and a copy of the context pointer |
** the table name as the second argument, and a copy of the context pointer |
| ** passed as the sixth argument to this function as the first. If the "filter | ** passed as the sixth argument as the first. If the "filter callback" |
| ** callback" returns zero, then no attempt is made to apply any changes to | ** returns zero, then no attempt is made to apply any changes to the table. |
| ** the table. Otherwise, if the return value is non-zero or the xFilter | ** Otherwise, if the return value is non-zero or the xFilter argument to |
| ** argument to this function is NULL, all changes related to the table are | ** is NULL, all changes related to the table are attempted. |
| ** attempted. | |
| ** |
** |
| ** For each table that is not excluded by the filter callback, this function |
** For each table that is not excluded by the filter callback, this function |
| ** tests that the target database contains a compatible table. A table is |
** tests that the target database contains a compatible table. A table is |
|
Line 9382 void sqlite3changegroup_delete(sqlite3_changegroup*);
|
Line 10547 void sqlite3changegroup_delete(sqlite3_changegroup*);
|
| ** <ul> |
** <ul> |
| ** <li> The table has the same name as the name recorded in the |
** <li> The table has the same name as the name recorded in the |
| ** changeset, and |
** changeset, and |
| ** <li> The table has the same number of columns as recorded in the | ** <li> The table has at least as many columns as recorded in the |
| ** changeset, and |
** changeset, and |
| ** <li> The table has primary key columns in the same position as |
** <li> The table has primary key columns in the same position as |
| ** recorded in the changeset. |
** recorded in the changeset. |
|
Line 9418 void sqlite3changegroup_delete(sqlite3_changegroup*);
|
Line 10583 void sqlite3changegroup_delete(sqlite3_changegroup*);
|
| ** |
** |
| ** <dl> |
** <dl> |
| ** <dt>DELETE Changes<dd> |
** <dt>DELETE Changes<dd> |
| ** For each DELETE change, this function checks if the target database | ** For each DELETE change, the function checks if the target database |
| ** contains a row with the same primary key value (or values) as the |
** contains a row with the same primary key value (or values) as the |
| ** original row values stored in the changeset. If it does, and the values |
** original row values stored in the changeset. If it does, and the values |
| ** stored in all non-primary key columns also match the values stored in |
** stored in all non-primary key columns also match the values stored in |
|
Line 9427 void sqlite3changegroup_delete(sqlite3_changegroup*);
|
Line 10592 void sqlite3changegroup_delete(sqlite3_changegroup*);
|
| ** If a row with matching primary key values is found, but one or more of |
** If a row with matching primary key values is found, but one or more of |
| ** the non-primary key fields contains a value different from the original |
** the non-primary key fields contains a value different from the original |
| ** row value stored in the changeset, the conflict-handler function is |
** row value stored in the changeset, the conflict-handler function is |
| ** invoked with [SQLITE_CHANGESET_DATA] as the second argument. | ** invoked with [SQLITE_CHANGESET_DATA] as the second argument. If the |
| | ** database table has more columns than are recorded in the changeset, |
| | ** only the values of those non-primary key fields are compared against |
| | ** the current database contents - any trailing database table columns |
| | ** are ignored. |
| ** |
** |
| ** If no row with matching primary key values is found in the database, |
** If no row with matching primary key values is found in the database, |
| ** the conflict-handler function is invoked with [SQLITE_CHANGESET_NOTFOUND] |
** the conflict-handler function is invoked with [SQLITE_CHANGESET_NOTFOUND] |
|
Line 9442 void sqlite3changegroup_delete(sqlite3_changegroup*);
|
Line 10611 void sqlite3changegroup_delete(sqlite3_changegroup*);
|
| ** |
** |
| ** <dt>INSERT Changes<dd> |
** <dt>INSERT Changes<dd> |
| ** For each INSERT change, an attempt is made to insert the new row into |
** For each INSERT change, an attempt is made to insert the new row into |
| ** the database. | ** the database. If the changeset row contains fewer fields than the |
| | ** database table, the trailing fields are populated with their default |
| | ** values. |
| ** |
** |
| ** If the attempt to insert the row fails because the database already |
** If the attempt to insert the row fails because the database already |
| ** contains a row with the same primary key values, the conflict handler |
** contains a row with the same primary key values, the conflict handler |
|
Line 9457 void sqlite3changegroup_delete(sqlite3_changegroup*);
|
Line 10628 void sqlite3changegroup_delete(sqlite3_changegroup*);
|
| ** [SQLITE_CHANGESET_REPLACE]. |
** [SQLITE_CHANGESET_REPLACE]. |
| ** |
** |
| ** <dt>UPDATE Changes<dd> |
** <dt>UPDATE Changes<dd> |
| ** For each UPDATE change, this function checks if the target database | ** For each UPDATE change, the function checks if the target database |
| ** contains a row with the same primary key value (or values) as the |
** contains a row with the same primary key value (or values) as the |
| ** original row values stored in the changeset. If it does, and the values |
** original row values stored in the changeset. If it does, and the values |
| ** stored in all non-primary key columns also match the values stored in | ** stored in all modified non-primary key columns also match the values |
| ** the changeset the row is updated within the target database. | ** stored in the changeset the row is updated within the target database. |
| ** |
** |
| ** If a row with matching primary key values is found, but one or more of |
** If a row with matching primary key values is found, but one or more of |
| ** the non-primary key fields contains a value different from an original | ** the modified non-primary key fields contains a value different from an |
| ** row value stored in the changeset, the conflict-handler function is | ** original row value stored in the changeset, the conflict-handler function |
| ** invoked with [SQLITE_CHANGESET_DATA] as the second argument. Since | ** is invoked with [SQLITE_CHANGESET_DATA] as the second argument. Since |
| ** UPDATE changes only contain values for non-primary key fields that are |
** UPDATE changes only contain values for non-primary key fields that are |
| ** to be modified, only those fields need to match the original values to |
** to be modified, only those fields need to match the original values to |
| ** avoid the SQLITE_CHANGESET_DATA conflict-handler callback. |
** avoid the SQLITE_CHANGESET_DATA conflict-handler callback. |
|
Line 9488 void sqlite3changegroup_delete(sqlite3_changegroup*);
|
Line 10659 void sqlite3changegroup_delete(sqlite3_changegroup*);
|
| ** This can be used to further customize the applications conflict |
** This can be used to further customize the applications conflict |
| ** resolution strategy. |
** resolution strategy. |
| ** |
** |
| ** All changes made by this function are enclosed in a savepoint transaction. | ** All changes made by these functions are enclosed in a savepoint transaction. |
| ** If any other error (aside from a constraint failure when attempting to |
** If any other error (aside from a constraint failure when attempting to |
| ** write to the target database) occurs, then the savepoint transaction is |
** write to the target database) occurs, then the savepoint transaction is |
| ** rolled back, restoring the target database to its original state, and an |
** rolled back, restoring the target database to its original state, and an |
| ** SQLite error code returned. |
** SQLite error code returned. |
| |
** |
| |
** If the output parameters (ppRebase) and (pnRebase) are non-NULL and |
| |
** the input is a changeset (not a patchset), then sqlite3changeset_apply_v2() |
| |
** may set (*ppRebase) to point to a "rebase" that may be used with the |
| |
** sqlite3_rebaser APIs buffer before returning. In this case (*pnRebase) |
| |
** is set to the size of the buffer in bytes. It is the responsibility of the |
| |
** caller to eventually free any such buffer using sqlite3_free(). The buffer |
| |
** is only allocated and populated if one or more conflicts were encountered |
| |
** while applying the patchset. See comments surrounding the sqlite3_rebaser |
| |
** APIs for further details. |
| |
** |
| |
** The behavior of sqlite3changeset_apply_v2() and its streaming equivalent |
| |
** may be modified by passing a combination of |
| |
** [SQLITE_CHANGESETAPPLY_NOSAVEPOINT | supported flags] as the 9th parameter. |
| |
** |
| |
** Note that the sqlite3changeset_apply_v2() API is still <b>experimental</b> |
| |
** and therefore subject to change. |
| */ |
*/ |
| int sqlite3changeset_apply( | SQLITE_API int sqlite3changeset_apply( |
| sqlite3 *db, /* Apply change to "main" db of this handle */ |
sqlite3 *db, /* Apply change to "main" db of this handle */ |
| int nChangeset, /* Size of changeset in bytes */ |
int nChangeset, /* Size of changeset in bytes */ |
| void *pChangeset, /* Changeset blob */ |
void *pChangeset, /* Changeset blob */ |
|
Line 9509 int sqlite3changeset_apply(
|
Line 10697 int sqlite3changeset_apply(
|
| ), |
), |
| void *pCtx /* First argument passed to xConflict */ |
void *pCtx /* First argument passed to xConflict */ |
| ); |
); |
| |
SQLITE_API int sqlite3changeset_apply_v2( |
| |
sqlite3 *db, /* Apply change to "main" db of this handle */ |
| |
int nChangeset, /* Size of changeset in bytes */ |
| |
void *pChangeset, /* Changeset blob */ |
| |
int(*xFilter)( |
| |
void *pCtx, /* Copy of sixth arg to _apply() */ |
| |
const char *zTab /* Table name */ |
| |
), |
| |
int(*xConflict)( |
| |
void *pCtx, /* Copy of sixth arg to _apply() */ |
| |
int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ |
| |
sqlite3_changeset_iter *p /* Handle describing change and conflict */ |
| |
), |
| |
void *pCtx, /* First argument passed to xConflict */ |
| |
void **ppRebase, int *pnRebase, /* OUT: Rebase data */ |
| |
int flags /* SESSION_CHANGESETAPPLY_* flags */ |
| |
); |
| |
|
| |
/* |
| |
** CAPI3REF: Flags for sqlite3changeset_apply_v2 |
| |
** |
| |
** The following flags may passed via the 9th parameter to |
| |
** [sqlite3changeset_apply_v2] and [sqlite3changeset_apply_v2_strm]: |
| |
** |
| |
** <dl> |
| |
** <dt>SQLITE_CHANGESETAPPLY_NOSAVEPOINT <dd> |
| |
** Usually, the sessions module encloses all operations performed by |
| |
** a single call to apply_v2() or apply_v2_strm() in a [SAVEPOINT]. The |
| |
** SAVEPOINT is committed if the changeset or patchset is successfully |
| |
** applied, or rolled back if an error occurs. Specifying this flag |
| |
** causes the sessions module to omit this savepoint. In this case, if the |
| |
** caller has an open transaction or savepoint when apply_v2() is called, |
| |
** it may revert the partially applied changeset by rolling it back. |
| |
** |
| |
** <dt>SQLITE_CHANGESETAPPLY_INVERT <dd> |
| |
** Invert the changeset before applying it. This is equivalent to inverting |
| |
** a changeset using sqlite3changeset_invert() before applying it. It is |
| |
** an error to specify this flag with a patchset. |
| |
*/ |
| |
#define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001 |
| |
#define SQLITE_CHANGESETAPPLY_INVERT 0x0002 |
| |
|
| /* |
/* |
| ** CAPI3REF: Constants Passed To The Conflict Handler |
** CAPI3REF: Constants Passed To The Conflict Handler |
| ** |
** |
|
Line 9606 int sqlite3changeset_apply(
|
Line 10835 int sqlite3changeset_apply(
|
| #define SQLITE_CHANGESET_REPLACE 1 |
#define SQLITE_CHANGESET_REPLACE 1 |
| #define SQLITE_CHANGESET_ABORT 2 |
#define SQLITE_CHANGESET_ABORT 2 |
| |
|
| |
/* |
| |
** CAPI3REF: Rebasing changesets |
| |
** EXPERIMENTAL |
| |
** |
| |
** Suppose there is a site hosting a database in state S0. And that |
| |
** modifications are made that move that database to state S1 and a |
| |
** changeset recorded (the "local" changeset). Then, a changeset based |
| |
** on S0 is received from another site (the "remote" changeset) and |
| |
** applied to the database. The database is then in state |
| |
** (S1+"remote"), where the exact state depends on any conflict |
| |
** resolution decisions (OMIT or REPLACE) made while applying "remote". |
| |
** Rebasing a changeset is to update it to take those conflict |
| |
** resolution decisions into account, so that the same conflicts |
| |
** do not have to be resolved elsewhere in the network. |
| |
** |
| |
** For example, if both the local and remote changesets contain an |
| |
** INSERT of the same key on "CREATE TABLE t1(a PRIMARY KEY, b)": |
| |
** |
| |
** local: INSERT INTO t1 VALUES(1, 'v1'); |
| |
** remote: INSERT INTO t1 VALUES(1, 'v2'); |
| |
** |
| |
** and the conflict resolution is REPLACE, then the INSERT change is |
| |
** removed from the local changeset (it was overridden). Or, if the |
| |
** conflict resolution was "OMIT", then the local changeset is modified |
| |
** to instead contain: |
| |
** |
| |
** UPDATE t1 SET b = 'v2' WHERE a=1; |
| |
** |
| |
** Changes within the local changeset are rebased as follows: |
| |
** |
| |
** <dl> |
| |
** <dt>Local INSERT<dd> |
| |
** This may only conflict with a remote INSERT. If the conflict |
| |
** resolution was OMIT, then add an UPDATE change to the rebased |
| |
** changeset. Or, if the conflict resolution was REPLACE, add |
| |
** nothing to the rebased changeset. |
| |
** |
| |
** <dt>Local DELETE<dd> |
| |
** This may conflict with a remote UPDATE or DELETE. In both cases the |
| |
** only possible resolution is OMIT. If the remote operation was a |
| |
** DELETE, then add no change to the rebased changeset. If the remote |
| |
** operation was an UPDATE, then the old.* fields of change are updated |
| |
** to reflect the new.* values in the UPDATE. |
| |
** |
| |
** <dt>Local UPDATE<dd> |
| |
** This may conflict with a remote UPDATE or DELETE. If it conflicts |
| |
** with a DELETE, and the conflict resolution was OMIT, then the update |
| |
** is changed into an INSERT. Any undefined values in the new.* record |
| |
** from the update change are filled in using the old.* values from |
| |
** the conflicting DELETE. Or, if the conflict resolution was REPLACE, |
| |
** the UPDATE change is simply omitted from the rebased changeset. |
| |
** |
| |
** If conflict is with a remote UPDATE and the resolution is OMIT, then |
| |
** the old.* values are rebased using the new.* values in the remote |
| |
** change. Or, if the resolution is REPLACE, then the change is copied |
| |
** into the rebased changeset with updates to columns also updated by |
| |
** the conflicting remote UPDATE removed. If this means no columns would |
| |
** be updated, the change is omitted. |
| |
** </dl> |
| |
** |
| |
** A local change may be rebased against multiple remote changes |
| |
** simultaneously. If a single key is modified by multiple remote |
| |
** changesets, they are combined as follows before the local changeset |
| |
** is rebased: |
| |
** |
| |
** <ul> |
| |
** <li> If there has been one or more REPLACE resolutions on a |
| |
** key, it is rebased according to a REPLACE. |
| |
** |
| |
** <li> If there have been no REPLACE resolutions on a key, then |
| |
** the local changeset is rebased according to the most recent |
| |
** of the OMIT resolutions. |
| |
** </ul> |
| |
** |
| |
** Note that conflict resolutions from multiple remote changesets are |
| |
** combined on a per-field basis, not per-row. This means that in the |
| |
** case of multiple remote UPDATE operations, some fields of a single |
| |
** local change may be rebased for REPLACE while others are rebased for |
| |
** OMIT. |
| |
** |
| |
** In order to rebase a local changeset, the remote changeset must first |
| |
** be applied to the local database using sqlite3changeset_apply_v2() and |
| |
** the buffer of rebase information captured. Then: |
| |
** |
| |
** <ol> |
| |
** <li> An sqlite3_rebaser object is created by calling |
| |
** sqlite3rebaser_create(). |
| |
** <li> The new object is configured with the rebase buffer obtained from |
| |
** sqlite3changeset_apply_v2() by calling sqlite3rebaser_configure(). |
| |
** If the local changeset is to be rebased against multiple remote |
| |
** changesets, then sqlite3rebaser_configure() should be called |
| |
** multiple times, in the same order that the multiple |
| |
** sqlite3changeset_apply_v2() calls were made. |
| |
** <li> Each local changeset is rebased by calling sqlite3rebaser_rebase(). |
| |
** <li> The sqlite3_rebaser object is deleted by calling |
| |
** sqlite3rebaser_delete(). |
| |
** </ol> |
| |
*/ |
| |
typedef struct sqlite3_rebaser sqlite3_rebaser; |
| |
|
| /* |
/* |
| |
** CAPI3REF: Create a changeset rebaser object. |
| |
** EXPERIMENTAL |
| |
** |
| |
** Allocate a new changeset rebaser object. If successful, set (*ppNew) to |
| |
** point to the new object and return SQLITE_OK. Otherwise, if an error |
| |
** occurs, return an SQLite error code (e.g. SQLITE_NOMEM) and set (*ppNew) |
| |
** to NULL. |
| |
*/ |
| |
SQLITE_API int sqlite3rebaser_create(sqlite3_rebaser **ppNew); |
| |
|
| |
/* |
| |
** CAPI3REF: Configure a changeset rebaser object. |
| |
** EXPERIMENTAL |
| |
** |
| |
** Configure the changeset rebaser object to rebase changesets according |
| |
** to the conflict resolutions described by buffer pRebase (size nRebase |
| |
** bytes), which must have been obtained from a previous call to |
| |
** sqlite3changeset_apply_v2(). |
| |
*/ |
| |
SQLITE_API int sqlite3rebaser_configure( |
| |
sqlite3_rebaser*, |
| |
int nRebase, const void *pRebase |
| |
); |
| |
|
| |
/* |
| |
** CAPI3REF: Rebase a changeset |
| |
** EXPERIMENTAL |
| |
** |
| |
** Argument pIn must point to a buffer containing a changeset nIn bytes |
| |
** in size. This function allocates and populates a buffer with a copy |
| |
** of the changeset rebased rebased according to the configuration of the |
| |
** rebaser object passed as the first argument. If successful, (*ppOut) |
| |
** is set to point to the new buffer containing the rebased changeset and |
| |
** (*pnOut) to its size in bytes and SQLITE_OK returned. It is the |
| |
** responsibility of the caller to eventually free the new buffer using |
| |
** sqlite3_free(). Otherwise, if an error occurs, (*ppOut) and (*pnOut) |
| |
** are set to zero and an SQLite error code returned. |
| |
*/ |
| |
SQLITE_API int sqlite3rebaser_rebase( |
| |
sqlite3_rebaser*, |
| |
int nIn, const void *pIn, |
| |
int *pnOut, void **ppOut |
| |
); |
| |
|
| |
/* |
| |
** CAPI3REF: Delete a changeset rebaser object. |
| |
** EXPERIMENTAL |
| |
** |
| |
** Delete the changeset rebaser object and all associated resources. There |
| |
** should be one call to this function for each successful invocation |
| |
** of sqlite3rebaser_create(). |
| |
*/ |
| |
SQLITE_API void sqlite3rebaser_delete(sqlite3_rebaser *p); |
| |
|
| |
/* |
| ** CAPI3REF: Streaming Versions of API functions. |
** CAPI3REF: Streaming Versions of API functions. |
| ** |
** |
| ** The six streaming API xxx_strm() functions serve similar purposes to the |
** The six streaming API xxx_strm() functions serve similar purposes to the |
|
Line 9614 int sqlite3changeset_apply(
|
Line 10998 int sqlite3changeset_apply(
|
| ** |
** |
| ** <table border=1 style="margin-left:8ex;margin-right:8ex"> |
** <table border=1 style="margin-left:8ex;margin-right:8ex"> |
| ** <tr><th>Streaming function<th>Non-streaming equivalent</th> |
** <tr><th>Streaming function<th>Non-streaming equivalent</th> |
| ** <tr><td>sqlite3changeset_apply_str<td>[sqlite3changeset_apply] | ** <tr><td>sqlite3changeset_apply_strm<td>[sqlite3changeset_apply] |
| ** <tr><td>sqlite3changeset_concat_str<td>[sqlite3changeset_concat] | ** <tr><td>sqlite3changeset_apply_strm_v2<td>[sqlite3changeset_apply_v2] |
| ** <tr><td>sqlite3changeset_invert_str<td>[sqlite3changeset_invert] | ** <tr><td>sqlite3changeset_concat_strm<td>[sqlite3changeset_concat] |
| ** <tr><td>sqlite3changeset_start_str<td>[sqlite3changeset_start] | ** <tr><td>sqlite3changeset_invert_strm<td>[sqlite3changeset_invert] |
| ** <tr><td>sqlite3session_changeset_str<td>[sqlite3session_changeset] | ** <tr><td>sqlite3changeset_start_strm<td>[sqlite3changeset_start] |
| ** <tr><td>sqlite3session_patchset_str<td>[sqlite3session_patchset] | ** <tr><td>sqlite3session_changeset_strm<td>[sqlite3session_changeset] |
| | ** <tr><td>sqlite3session_patchset_strm<td>[sqlite3session_patchset] |
| ** </table> |
** </table> |
| ** |
** |
| ** Non-streaming functions that accept changesets (or patchsets) as input |
** Non-streaming functions that accept changesets (or patchsets) as input |
|
Line 9695 int sqlite3changeset_apply(
|
Line 11080 int sqlite3changeset_apply(
|
| ** parameter set to a value less than or equal to zero. Other than this, |
** parameter set to a value less than or equal to zero. Other than this, |
| ** no guarantees are made as to the size of the chunks of data returned. |
** no guarantees are made as to the size of the chunks of data returned. |
| */ |
*/ |
| int sqlite3changeset_apply_strm( | SQLITE_API int sqlite3changeset_apply_strm( |
| sqlite3 *db, /* Apply change to "main" db of this handle */ |
sqlite3 *db, /* Apply change to "main" db of this handle */ |
| int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */ |
int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */ |
| void *pIn, /* First arg for xInput */ |
void *pIn, /* First arg for xInput */ |
|
Line 9710 int sqlite3changeset_apply_strm(
|
Line 11095 int sqlite3changeset_apply_strm(
|
| ), |
), |
| void *pCtx /* First argument passed to xConflict */ |
void *pCtx /* First argument passed to xConflict */ |
| ); |
); |
| int sqlite3changeset_concat_strm( | SQLITE_API int sqlite3changeset_apply_v2_strm( |
| | sqlite3 *db, /* Apply change to "main" db of this handle */ |
| | int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */ |
| | void *pIn, /* First arg for xInput */ |
| | int(*xFilter)( |
| | void *pCtx, /* Copy of sixth arg to _apply() */ |
| | const char *zTab /* Table name */ |
| | ), |
| | int(*xConflict)( |
| | void *pCtx, /* Copy of sixth arg to _apply() */ |
| | int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ |
| | sqlite3_changeset_iter *p /* Handle describing change and conflict */ |
| | ), |
| | void *pCtx, /* First argument passed to xConflict */ |
| | void **ppRebase, int *pnRebase, |
| | int flags |
| | ); |
| | SQLITE_API int sqlite3changeset_concat_strm( |
| int (*xInputA)(void *pIn, void *pData, int *pnData), |
int (*xInputA)(void *pIn, void *pData, int *pnData), |
| void *pInA, |
void *pInA, |
| int (*xInputB)(void *pIn, void *pData, int *pnData), |
int (*xInputB)(void *pIn, void *pData, int *pnData), |
|
Line 9718 int sqlite3changeset_concat_strm(
|
Line 11120 int sqlite3changeset_concat_strm(
|
| int (*xOutput)(void *pOut, const void *pData, int nData), |
int (*xOutput)(void *pOut, const void *pData, int nData), |
| void *pOut |
void *pOut |
| ); |
); |
| int sqlite3changeset_invert_strm( | SQLITE_API int sqlite3changeset_invert_strm( |
| int (*xInput)(void *pIn, void *pData, int *pnData), |
int (*xInput)(void *pIn, void *pData, int *pnData), |
| void *pIn, |
void *pIn, |
| int (*xOutput)(void *pOut, const void *pData, int nData), |
int (*xOutput)(void *pOut, const void *pData, int nData), |
| void *pOut |
void *pOut |
| ); |
); |
| int sqlite3changeset_start_strm( | SQLITE_API int sqlite3changeset_start_strm( |
| sqlite3_changeset_iter **pp, |
sqlite3_changeset_iter **pp, |
| int (*xInput)(void *pIn, void *pData, int *pnData), |
int (*xInput)(void *pIn, void *pData, int *pnData), |
| void *pIn |
void *pIn |
| ); |
); |
| int sqlite3session_changeset_strm( | SQLITE_API int sqlite3changeset_start_v2_strm( |
| | sqlite3_changeset_iter **pp, |
| | int (*xInput)(void *pIn, void *pData, int *pnData), |
| | void *pIn, |
| | int flags |
| | ); |
| | SQLITE_API int sqlite3session_changeset_strm( |
| sqlite3_session *pSession, |
sqlite3_session *pSession, |
| int (*xOutput)(void *pOut, const void *pData, int nData), |
int (*xOutput)(void *pOut, const void *pData, int nData), |
| void *pOut |
void *pOut |
| ); |
); |
| int sqlite3session_patchset_strm( | SQLITE_API int sqlite3session_patchset_strm( |
| sqlite3_session *pSession, |
sqlite3_session *pSession, |
| int (*xOutput)(void *pOut, const void *pData, int nData), |
int (*xOutput)(void *pOut, const void *pData, int nData), |
| void *pOut |
void *pOut |
| ); |
); |
| int sqlite3changegroup_add_strm(sqlite3_changegroup*, | SQLITE_API int sqlite3changegroup_add_strm(sqlite3_changegroup*, |
| int (*xInput)(void *pIn, void *pData, int *pnData), |
int (*xInput)(void *pIn, void *pData, int *pnData), |
| void *pIn |
void *pIn |
| ); |
); |
| int sqlite3changegroup_output_strm(sqlite3_changegroup*, | SQLITE_API int sqlite3changegroup_output_strm(sqlite3_changegroup*, |
| int (*xOutput)(void *pOut, const void *pData, int nData), |
int (*xOutput)(void *pOut, const void *pData, int nData), |
| void *pOut |
void *pOut |
| ); |
); |
| |
SQLITE_API int sqlite3rebaser_rebase_strm( |
| |
sqlite3_rebaser *pRebaser, |
| |
int (*xInput)(void *pIn, void *pData, int *pnData), |
| |
void *pIn, |
| |
int (*xOutput)(void *pOut, const void *pData, int nData), |
| |
void *pOut |
| |
); |
| |
|
| |
/* |
| |
** CAPI3REF: Configure global parameters |
| |
** |
| |
** The sqlite3session_config() interface is used to make global configuration |
| |
** changes to the sessions module in order to tune it to the specific needs |
| |
** of the application. |
| |
** |
| |
** The sqlite3session_config() interface is not threadsafe. If it is invoked |
| |
** while any other thread is inside any other sessions method then the |
| |
** results are undefined. Furthermore, if it is invoked after any sessions |
| |
** related objects have been created, the results are also undefined. |
| |
** |
| |
** The first argument to the sqlite3session_config() function must be one |
| |
** of the SQLITE_SESSION_CONFIG_XXX constants defined below. The |
| |
** interpretation of the (void*) value passed as the second parameter and |
| |
** the effect of calling this function depends on the value of the first |
| |
** parameter. |
| |
** |
| |
** <dl> |
| |
** <dt>SQLITE_SESSION_CONFIG_STRMSIZE<dd> |
| |
** By default, the sessions module streaming interfaces attempt to input |
| |
** and output data in approximately 1 KiB chunks. This operand may be used |
| |
** to set and query the value of this configuration setting. The pointer |
| |
** passed as the second argument must point to a value of type (int). |
| |
** If this value is greater than 0, it is used as the new streaming data |
| |
** chunk size for both input and output. Before returning, the (int) value |
| |
** pointed to by pArg is set to the final value of the streaming interface |
| |
** chunk size. |
| |
** </dl> |
| |
** |
| |
** This function returns SQLITE_OK if successful, or an SQLite error code |
| |
** otherwise. |
| |
*/ |
| |
SQLITE_API int sqlite3session_config(int op, void *pArg); |
| |
|
| /* |
/* |
| |
** CAPI3REF: Values for sqlite3session_config(). |
| |
*/ |
| |
#define SQLITE_SESSION_CONFIG_STRMSIZE 1 |
| |
|
| |
/* |
| ** Make sure we can call this stuff from C++. |
** Make sure we can call this stuff from C++. |
| */ |
*/ |
| #ifdef __cplusplus |
#ifdef __cplusplus |
|
Line 9881 struct Fts5PhraseIter {
|
Line 11335 struct Fts5PhraseIter {
|
| ** |
** |
| ** Usually, output parameter *piPhrase is set to the phrase number, *piCol |
** Usually, output parameter *piPhrase is set to the phrase number, *piCol |
| ** to the column in which it occurs and *piOff the token offset of the |
** to the column in which it occurs and *piOff the token offset of the |
| ** first token of the phrase. The exception is if the table was created | ** first token of the phrase. Returns SQLITE_OK if successful, or an error |
| ** with the offsets=0 option specified. In this case *piOff is always | ** code (i.e. SQLITE_NOMEM) if an error occurs. |
| ** set to -1. | |
| ** |
** |
| ** Returns SQLITE_OK if successful, or an error code (i.e. SQLITE_NOMEM) |
|
| ** if an error occurs. |
|
| ** |
|
| ** This API can be quite slow if used with an FTS5 table created with the |
** This API can be quite slow if used with an FTS5 table created with the |
| ** "detail=none" or "detail=column" option. |
** "detail=none" or "detail=column" option. |
| ** |
** |
|
Line 9927 struct Fts5PhraseIter {
|
Line 11377 struct Fts5PhraseIter {
|
| ** Save the pointer passed as the second argument as the extension functions |
** Save the pointer passed as the second argument as the extension functions |
| ** "auxiliary data". The pointer may then be retrieved by the current or any |
** "auxiliary data". The pointer may then be retrieved by the current or any |
| ** future invocation of the same fts5 extension function made as part of |
** future invocation of the same fts5 extension function made as part of |
| ** of the same MATCH query using the xGetAuxdata() API. | ** the same MATCH query using the xGetAuxdata() API. |
| ** |
** |
| ** Each extension function is allocated a single auxiliary data slot for |
** Each extension function is allocated a single auxiliary data slot for |
| ** each FTS query (MATCH expression). If the extension function is invoked |
** each FTS query (MATCH expression). If the extension function is invoked |
|
Line 9942 struct Fts5PhraseIter {
|
Line 11392 struct Fts5PhraseIter {
|
| ** The xDelete callback, if one is specified, is also invoked on the |
** The xDelete callback, if one is specified, is also invoked on the |
| ** auxiliary data pointer after the FTS5 query has finished. |
** auxiliary data pointer after the FTS5 query has finished. |
| ** |
** |
| ** If an error (e.g. an OOM condition) occurs within this function, an | ** If an error (e.g. an OOM condition) occurs within this function, |
| ** the auxiliary data is set to NULL and an error code returned. If the |
** the auxiliary data is set to NULL and an error code returned. If the |
| ** xDelete parameter was not NULL, it is invoked on the auxiliary data |
** xDelete parameter was not NULL, it is invoked on the auxiliary data |
| ** pointer before returning. |
** pointer before returning. |
|
Line 10175 struct Fts5ExtensionApi {
|
Line 11625 struct Fts5ExtensionApi {
|
| ** the tokenizer substitutes "first" for "1st" and the query works |
** the tokenizer substitutes "first" for "1st" and the query works |
| ** as expected. |
** as expected. |
| ** |
** |
| ** <li> By adding multiple synonyms for a single term to the FTS index. | ** <li> By querying the index for all synonyms of each query term |
| ** In this case, when tokenizing query text, the tokenizer may | ** separately. In this case, when tokenizing query text, the |
| ** provide multiple synonyms for a single term within the document. | ** tokenizer may provide multiple synonyms for a single term |
| ** FTS5 then queries the index for each synonym individually. For | ** within the document. FTS5 then queries the index for each |
| ** example, faced with the query: | ** synonym individually. For example, faced with the query: |
| ** |
** |
| ** <codeblock> |
** <codeblock> |
| ** ... MATCH 'first place'</codeblock> |
** ... MATCH 'first place'</codeblock> |
|
Line 10203 struct Fts5ExtensionApi {
|
Line 11653 struct Fts5ExtensionApi {
|
| ** "place". |
** "place". |
| ** |
** |
| ** 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 so 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> |
| ** |
** |
|
Line 10233 struct Fts5ExtensionApi {
|
Line 11683 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> |