summaryrefslogtreecommitdiff
path: root/c/sqlite3.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--c/sqlite3.h167
1 files changed, 153 insertions, 14 deletions
diff --git a/c/sqlite3.h b/c/sqlite3.h
index 3274bbe..393e9d2 100644
--- a/c/sqlite3.h
+++ b/c/sqlite3.h
@@ -43,7 +43,30 @@ extern "C" {
43 43
44 44
45/* 45/*
46** Provide the ability to override linkage features of the interface. 46** Facilitate override of interface linkage and calling conventions.
47** Be aware that these macros may not be used within this particular
48** translation of the amalgamation and its associated header file.
49**
50** The SQLITE_EXTERN and SQLITE_API macros are used to instruct the
51** compiler that the target identifier should have external linkage.
52**
53** The SQLITE_CDECL macro is used to set the calling convention for
54** public functions that accept a variable number of arguments.
55**
56** The SQLITE_APICALL macro is used to set the calling convention for
57** public functions that accept a fixed number of arguments.
58**
59** The SQLITE_STDCALL macro is no longer used and is now deprecated.
60**
61** The SQLITE_CALLBACK macro is used to set the calling convention for
62** function pointers.
63**
64** The SQLITE_SYSAPI macro is used to set the calling convention for
65** functions provided by the operating system.
66**
67** Currently, the SQLITE_CDECL, SQLITE_APICALL, SQLITE_CALLBACK, and
68** SQLITE_SYSAPI macros are used only when building for environments
69** that require non-default calling conventions.
47*/ 70*/
48#ifndef SQLITE_EXTERN 71#ifndef SQLITE_EXTERN
49# define SQLITE_EXTERN extern 72# define SQLITE_EXTERN extern
@@ -123,9 +146,9 @@ extern "C" {
123** [sqlite3_libversion_number()], [sqlite3_sourceid()], 146** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124** [sqlite_version()] and [sqlite_source_id()]. 147** [sqlite_version()] and [sqlite_source_id()].
125*/ 148*/
126#define SQLITE_VERSION "3.36.0" 149#define SQLITE_VERSION "3.37.1"
127#define SQLITE_VERSION_NUMBER 3036000 150#define SQLITE_VERSION_NUMBER 3037001
128#define SQLITE_SOURCE_ID "2021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5" 151#define SQLITE_SOURCE_ID "2021-12-30 15:30:28 378629bf2ea546f73eee84063c5358439a12f7300e433f18c9e1bddd948dea62"
129 152
130/* 153/*
131** CAPI3REF: Run-Time Library Version Numbers 154** CAPI3REF: Run-Time Library Version Numbers
@@ -537,6 +560,7 @@ SQLITE_API int sqlite3_exec(
537#define SQLITE_CONSTRAINT_VTAB (SQLITE_CONSTRAINT | (9<<8)) 560#define SQLITE_CONSTRAINT_VTAB (SQLITE_CONSTRAINT | (9<<8))
538#define SQLITE_CONSTRAINT_ROWID (SQLITE_CONSTRAINT |(10<<8)) 561#define SQLITE_CONSTRAINT_ROWID (SQLITE_CONSTRAINT |(10<<8))
539#define SQLITE_CONSTRAINT_PINNED (SQLITE_CONSTRAINT |(11<<8)) 562#define SQLITE_CONSTRAINT_PINNED (SQLITE_CONSTRAINT |(11<<8))
563#define SQLITE_CONSTRAINT_DATATYPE (SQLITE_CONSTRAINT |(12<<8))
540#define SQLITE_NOTICE_RECOVER_WAL (SQLITE_NOTICE | (1<<8)) 564#define SQLITE_NOTICE_RECOVER_WAL (SQLITE_NOTICE | (1<<8))
541#define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2<<8)) 565#define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2<<8))
542#define SQLITE_WARNING_AUTOINDEX (SQLITE_WARNING | (1<<8)) 566#define SQLITE_WARNING_AUTOINDEX (SQLITE_WARNING | (1<<8))
@@ -550,6 +574,19 @@ SQLITE_API int sqlite3_exec(
550** These bit values are intended for use in the 574** These bit values are intended for use in the
551** 3rd parameter to the [sqlite3_open_v2()] interface and 575** 3rd parameter to the [sqlite3_open_v2()] interface and
552** in the 4th parameter to the [sqlite3_vfs.xOpen] method. 576** in the 4th parameter to the [sqlite3_vfs.xOpen] method.
577**
578** Only those flags marked as "Ok for sqlite3_open_v2()" may be
579** used as the third argument to the [sqlite3_open_v2()] interface.
580** The other flags have historically been ignored by sqlite3_open_v2(),
581** though future versions of SQLite might change so that an error is
582** raised if any of the disallowed bits are passed into sqlite3_open_v2().
583** Applications should not depend on the historical behavior.
584**
585** Note in particular that passing the SQLITE_OPEN_EXCLUSIVE flag into
586** [sqlite3_open_v2()] does *not* cause the underlying database file
587** to be opened using O_EXCL. Passing SQLITE_OPEN_EXCLUSIVE into
588** [sqlite3_open_v2()] has historically be a no-op and might become an
589** error in future versions of SQLite.
553*/ 590*/
554#define SQLITE_OPEN_READONLY 0x00000001 /* Ok for sqlite3_open_v2() */ 591#define SQLITE_OPEN_READONLY 0x00000001 /* Ok for sqlite3_open_v2() */
555#define SQLITE_OPEN_READWRITE 0x00000002 /* Ok for sqlite3_open_v2() */ 592#define SQLITE_OPEN_READWRITE 0x00000002 /* Ok for sqlite3_open_v2() */
@@ -572,6 +609,7 @@ SQLITE_API int sqlite3_exec(
572#define SQLITE_OPEN_PRIVATECACHE 0x00040000 /* Ok for sqlite3_open_v2() */ 609#define SQLITE_OPEN_PRIVATECACHE 0x00040000 /* Ok for sqlite3_open_v2() */
573#define SQLITE_OPEN_WAL 0x00080000 /* VFS only */ 610#define SQLITE_OPEN_WAL 0x00080000 /* VFS only */
574#define SQLITE_OPEN_NOFOLLOW 0x01000000 /* Ok for sqlite3_open_v2() */ 611#define SQLITE_OPEN_NOFOLLOW 0x01000000 /* Ok for sqlite3_open_v2() */
612#define SQLITE_OPEN_EXRESCODE 0x02000000 /* Extended result codes */
575 613
576/* Reserved: 0x00F00000 */ 614/* Reserved: 0x00F00000 */
577/* Legacy compatibility: */ 615/* Legacy compatibility: */
@@ -2464,11 +2502,14 @@ SQLITE_API void sqlite3_set_last_insert_rowid(sqlite3*,sqlite3_int64);
2464** CAPI3REF: Count The Number Of Rows Modified 2502** CAPI3REF: Count The Number Of Rows Modified
2465** METHOD: sqlite3 2503** METHOD: sqlite3
2466** 2504**
2467** ^This function returns the number of rows modified, inserted or 2505** ^These functions return the number of rows modified, inserted or
2468** deleted by the most recently completed INSERT, UPDATE or DELETE 2506** deleted by the most recently completed INSERT, UPDATE or DELETE
2469** statement on the database connection specified by the only parameter. 2507** statement on the database connection specified by the only parameter.
2470** ^Executing any other type of SQL statement does not modify the value 2508** The two functions are identical except for the type of the return value
2471** returned by this function. 2509** and that if the number of rows modified by the most recent INSERT, UPDATE
2510** or DELETE is greater than the maximum value supported by type "int", then
2511** the return value of sqlite3_changes() is undefined. ^Executing any other
2512** type of SQL statement does not modify the value returned by these functions.
2472** 2513**
2473** ^Only changes made directly by the INSERT, UPDATE or DELETE statement are 2514** ^Only changes made directly by the INSERT, UPDATE or DELETE statement are
2474** considered - auxiliary changes caused by [CREATE TRIGGER | triggers], 2515** considered - auxiliary changes caused by [CREATE TRIGGER | triggers],
@@ -2517,16 +2558,21 @@ SQLITE_API void sqlite3_set_last_insert_rowid(sqlite3*,sqlite3_int64);
2517** </ul> 2558** </ul>
2518*/ 2559*/
2519SQLITE_API int sqlite3_changes(sqlite3*); 2560SQLITE_API int sqlite3_changes(sqlite3*);
2561SQLITE_API sqlite3_int64 sqlite3_changes64(sqlite3*);
2520 2562
2521/* 2563/*
2522** CAPI3REF: Total Number Of Rows Modified 2564** CAPI3REF: Total Number Of Rows Modified
2523** METHOD: sqlite3 2565** METHOD: sqlite3
2524** 2566**
2525** ^This function returns the total number of rows inserted, modified or 2567** ^These functions return the total number of rows inserted, modified or
2526** deleted by all [INSERT], [UPDATE] or [DELETE] statements completed 2568** deleted by all [INSERT], [UPDATE] or [DELETE] statements completed
2527** since the database connection was opened, including those executed as 2569** since the database connection was opened, including those executed as
2528** part of trigger programs. ^Executing any other type of SQL statement 2570** part of trigger programs. The two functions are identical except for the
2529** does not affect the value returned by sqlite3_total_changes(). 2571** type of the return value and that if the number of rows modified by the
2572** connection exceeds the maximum value supported by type "int", then
2573** the return value of sqlite3_total_changes() is undefined. ^Executing
2574** any other type of SQL statement does not affect the value returned by
2575** sqlite3_total_changes().
2530** 2576**
2531** ^Changes made as part of [foreign key actions] are included in the 2577** ^Changes made as part of [foreign key actions] are included in the
2532** count, but those made as part of REPLACE constraint resolution are 2578** count, but those made as part of REPLACE constraint resolution are
@@ -2554,6 +2600,7 @@ SQLITE_API int sqlite3_changes(sqlite3*);
2554** </ul> 2600** </ul>
2555*/ 2601*/
2556SQLITE_API int sqlite3_total_changes(sqlite3*); 2602SQLITE_API int sqlite3_total_changes(sqlite3*);
2603SQLITE_API sqlite3_int64 sqlite3_total_changes64(sqlite3*);
2557 2604
2558/* 2605/*
2559** CAPI3REF: Interrupt A Long-Running Query 2606** CAPI3REF: Interrupt A Long-Running Query
@@ -3383,6 +3430,14 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
3383** the default shared cache setting provided by 3430** the default shared cache setting provided by
3384** [sqlite3_enable_shared_cache()].)^ 3431** [sqlite3_enable_shared_cache()].)^
3385** 3432**
3433** [[OPEN_EXRESCODE]] ^(<dt>[SQLITE_OPEN_EXRESCODE]</dt>
3434** <dd>The database connection comes up in "extended result code mode".
3435** In other words, the database behaves has if
3436** [sqlite3_extended_result_codes(db,1)] where called on the database
3437** connection as soon as the connection is created. In addition to setting
3438** the extended result code mode, this flag also causes [sqlite3_open_v2()]
3439** to return an extended result code.</dd>
3440**
3386** [[OPEN_NOFOLLOW]] ^(<dt>[SQLITE_OPEN_NOFOLLOW]</dt> 3441** [[OPEN_NOFOLLOW]] ^(<dt>[SQLITE_OPEN_NOFOLLOW]</dt>
3387** <dd>The database filename is not allowed to be a symbolic link</dd> 3442** <dd>The database filename is not allowed to be a symbolic link</dd>
3388** </dl>)^ 3443** </dl>)^
@@ -3390,7 +3445,15 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
3390** If the 3rd parameter to sqlite3_open_v2() is not one of the 3445** If the 3rd parameter to sqlite3_open_v2() is not one of the
3391** required combinations shown above optionally combined with other 3446** required combinations shown above optionally combined with other
3392** [SQLITE_OPEN_READONLY | SQLITE_OPEN_* bits] 3447** [SQLITE_OPEN_READONLY | SQLITE_OPEN_* bits]
3393** then the behavior is undefined. 3448** then the behavior is undefined. Historic versions of SQLite
3449** have silently ignored surplus bits in the flags parameter to
3450** sqlite3_open_v2(), however that behavior might not be carried through
3451** into future versions of SQLite and so applications should not rely
3452** upon it. Note in particular that the SQLITE_OPEN_EXCLUSIVE flag is a no-op
3453** for sqlite3_open_v2(). The SQLITE_OPEN_EXCLUSIVE does *not* cause
3454** the open to fail if the database already exists. The SQLITE_OPEN_EXCLUSIVE
3455** flag is intended for use by the [sqlite3_vfs|VFS interface] only, and not
3456** by sqlite3_open_v2().
3394** 3457**
3395** ^The fourth parameter to sqlite3_open_v2() is the name of the 3458** ^The fourth parameter to sqlite3_open_v2() is the name of the
3396** [sqlite3_vfs] object that defines the operating system interface that 3459** [sqlite3_vfs] object that defines the operating system interface that
@@ -4158,12 +4221,17 @@ SQLITE_API int sqlite3_prepare16_v3(
4158** are managed by SQLite and are automatically freed when the prepared 4221** are managed by SQLite and are automatically freed when the prepared
4159** statement is finalized. 4222** statement is finalized.
4160** ^The string returned by sqlite3_expanded_sql(P), on the other hand, 4223** ^The string returned by sqlite3_expanded_sql(P), on the other hand,
4161** is obtained from [sqlite3_malloc()] and must be free by the application 4224** is obtained from [sqlite3_malloc()] and must be freed by the application
4162** by passing it to [sqlite3_free()]. 4225** by passing it to [sqlite3_free()].
4226**
4227** ^The sqlite3_normalized_sql() interface is only available if
4228** the [SQLITE_ENABLE_NORMALIZE] compile-time option is defined.
4163*/ 4229*/
4164SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt); 4230SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt);
4165SQLITE_API char *sqlite3_expanded_sql(sqlite3_stmt *pStmt); 4231SQLITE_API char *sqlite3_expanded_sql(sqlite3_stmt *pStmt);
4232#ifdef SQLITE_ENABLE_NORMALIZE
4166SQLITE_API const char *sqlite3_normalized_sql(sqlite3_stmt *pStmt); 4233SQLITE_API const char *sqlite3_normalized_sql(sqlite3_stmt *pStmt);
4234#endif
4167 4235
4168/* 4236/*
4169** CAPI3REF: Determine If An SQL Statement Writes The Database 4237** CAPI3REF: Determine If An SQL Statement Writes The Database
@@ -6348,6 +6416,72 @@ SQLITE_API void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*);
6348SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*); 6416SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
6349 6417
6350/* 6418/*
6419** CAPI3REF: Autovacuum Compaction Amount Callback
6420** METHOD: sqlite3
6421**
6422** ^The sqlite3_autovacuum_pages(D,C,P,X) interface registers a callback
6423** function C that is invoked prior to each autovacuum of the database
6424** file. ^The callback is passed a copy of the generic data pointer (P),
6425** the schema-name of the attached database that is being autovacuumed,
6426** the the size of the database file in pages, the number of free pages,
6427** and the number of bytes per page, respectively. The callback should
6428** return the number of free pages that should be removed by the
6429** autovacuum. ^If the callback returns zero, then no autovacuum happens.
6430** ^If the value returned is greater than or equal to the number of
6431** free pages, then a complete autovacuum happens.
6432**
6433** <p>^If there are multiple ATTACH-ed database files that are being
6434** modified as part of a transaction commit, then the autovacuum pages
6435** callback is invoked separately for each file.
6436**
6437** <p><b>The callback is not reentrant.</b> The callback function should
6438** not attempt to invoke any other SQLite interface. If it does, bad
6439** things may happen, including segmentation faults and corrupt database
6440** files. The callback function should be a simple function that
6441** does some arithmetic on its input parameters and returns a result.
6442**
6443** ^The X parameter to sqlite3_autovacuum_pages(D,C,P,X) is an optional
6444** destructor for the P parameter. ^If X is not NULL, then X(P) is
6445** invoked whenever the database connection closes or when the callback
6446** is overwritten by another invocation of sqlite3_autovacuum_pages().
6447**
6448** <p>^There is only one autovacuum pages callback per database connection.
6449** ^Each call to the sqlite3_autovacuum_pages() interface overrides all
6450** previous invocations for that database connection. ^If the callback
6451** argument (C) to sqlite3_autovacuum_pages(D,C,P,X) is a NULL pointer,
6452** then the autovacuum steps callback is cancelled. The return value
6453** from sqlite3_autovacuum_pages() is normally SQLITE_OK, but might
6454** be some other error code if something goes wrong. The current
6455** implementation will only return SQLITE_OK or SQLITE_MISUSE, but other
6456** return codes might be added in future releases.
6457**
6458** <p>If no autovacuum pages callback is specified (the usual case) or
6459** a NULL pointer is provided for the callback,
6460** then the default behavior is to vacuum all free pages. So, in other
6461** words, the default behavior is the same as if the callback function
6462** were something like this:
6463**
6464** <blockquote><pre>
6465** &nbsp; unsigned int demonstration_autovac_pages_callback(
6466** &nbsp; void *pClientData,
6467** &nbsp; const char *zSchema,
6468** &nbsp; unsigned int nDbPage,
6469** &nbsp; unsigned int nFreePage,
6470** &nbsp; unsigned int nBytePerPage
6471** &nbsp; ){
6472** &nbsp; return nFreePage;
6473** &nbsp; }
6474** </pre></blockquote>
6475*/
6476SQLITE_API int sqlite3_autovacuum_pages(
6477 sqlite3 *db,
6478 unsigned int(*)(void*,const char*,unsigned int,unsigned int,unsigned int),
6479 void*,
6480 void(*)(void*)
6481);
6482
6483
6484/*
6351** CAPI3REF: Data Change Notification Callbacks 6485** CAPI3REF: Data Change Notification Callbacks
6352** METHOD: sqlite3 6486** METHOD: sqlite3
6353** 6487**
@@ -9010,8 +9144,9 @@ SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);
9010** 9144**
9011** A single database handle may have at most a single write-ahead log callback 9145** A single database handle may have at most a single write-ahead log callback
9012** registered at one time. ^Calling [sqlite3_wal_hook()] replaces any 9146** registered at one time. ^Calling [sqlite3_wal_hook()] replaces any
9013** previously registered write-ahead log callback. ^Note that the 9147** previously registered write-ahead log callback. ^The return value is
9014** [sqlite3_wal_autocheckpoint()] interface and the 9148** a copy of the third parameter from the previous call, if any, or 0.
9149** ^Note that the [sqlite3_wal_autocheckpoint()] interface and the
9015** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will 9150** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will
9016** overwrite any prior [sqlite3_wal_hook()] settings. 9151** overwrite any prior [sqlite3_wal_hook()] settings.
9017*/ 9152*/
@@ -9878,6 +10013,10 @@ SQLITE_API unsigned char *sqlite3_serialize(
9878** database is currently in a read transaction or is involved in a backup 10013** database is currently in a read transaction or is involved in a backup
9879** operation. 10014** operation.
9880** 10015**
10016** It is not possible to deserialized into the TEMP database. If the
10017** S argument to sqlite3_deserialize(D,S,P,N,M,F) is "temp" then the
10018** function returns SQLITE_ERROR.
10019**
9881** If sqlite3_deserialize(D,S,P,N,M,F) fails for any reason and if the 10020** If sqlite3_deserialize(D,S,P,N,M,F) fails for any reason and if the
9882** SQLITE_DESERIALIZE_FREEONCLOSE bit is set in argument F, then 10021** SQLITE_DESERIALIZE_FREEONCLOSE bit is set in argument F, then
9883** [sqlite3_free()] is invoked on argument P prior to returning. 10022** [sqlite3_free()] is invoked on argument P prior to returning.