diff options
| author | 2023-11-21 15:40:00 -0800 | |
|---|---|---|
| committer | 2023-11-21 15:40:00 -0800 | |
| commit | 82266f557a692e7a0125fa7c8edc20994bf94718 (patch) | |
| tree | abadac09c5eab0334de76d1afd938a8ab4da90bf /c/sqlite3.h | |
| parent | Update to zig 0.12.0-dev.1664+8ca4a5240 (diff) | |
| download | zig-sqlite-82266f557a692e7a0125fa7c8edc20994bf94718.tar.gz zig-sqlite-82266f557a692e7a0125fa7c8edc20994bf94718.tar.xz zig-sqlite-82266f557a692e7a0125fa7c8edc20994bf94718.zip | |
Update to sqlite 3.44.0
Diffstat (limited to '')
| -rw-r--r-- | c/sqlite3.h | 199 |
1 files changed, 168 insertions, 31 deletions
diff --git a/c/sqlite3.h b/c/sqlite3.h index 0376113..d4f1c81 100644 --- a/c/sqlite3.h +++ b/c/sqlite3.h | |||
| @@ -146,9 +146,9 @@ extern "C" { | |||
| 146 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], | 146 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 147 | ** [sqlite_version()] and [sqlite_source_id()]. | 147 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 148 | */ | 148 | */ |
| 149 | #define SQLITE_VERSION "3.43.2" | 149 | #define SQLITE_VERSION "3.44.0" |
| 150 | #define SQLITE_VERSION_NUMBER 3043002 | 150 | #define SQLITE_VERSION_NUMBER 3044000 |
| 151 | #define SQLITE_SOURCE_ID "2023-10-10 12:14:04 4310099cce5a487035fa535dd3002c59ac7f1d1bec68d7cf317fd3e769484790" | 151 | #define SQLITE_SOURCE_ID "2023-11-01 11:23:50 17129ba1ff7f0daf37100ee82d507aef7827cf38de1866e2633096ae6ad81301" |
| 152 | 152 | ||
| 153 | /* | 153 | /* |
| 154 | ** CAPI3REF: Run-Time Library Version Numbers | 154 | ** CAPI3REF: Run-Time Library Version Numbers |
| @@ -2127,7 +2127,7 @@ struct sqlite3_mem_methods { | |||
| 2127 | ** is stored in each sorted record and the required column values loaded | 2127 | ** is stored in each sorted record and the required column values loaded |
| 2128 | ** from the database as records are returned in sorted order. The default | 2128 | ** from the database as records are returned in sorted order. The default |
| 2129 | ** value for this option is to never use this optimization. Specifying a | 2129 | ** value for this option is to never use this optimization. Specifying a |
| 2130 | ** negative value for this option restores the default behaviour. | 2130 | ** negative value for this option restores the default behavior. |
| 2131 | ** This option is only available if SQLite is compiled with the | 2131 | ** This option is only available if SQLite is compiled with the |
| 2132 | ** [SQLITE_ENABLE_SORTER_REFERENCES] compile-time option. | 2132 | ** [SQLITE_ENABLE_SORTER_REFERENCES] compile-time option. |
| 2133 | ** | 2133 | ** |
| @@ -2302,7 +2302,7 @@ struct sqlite3_mem_methods { | |||
| 2302 | ** database handle, SQLite checks if this will mean that there are now no | 2302 | ** database handle, SQLite checks if this will mean that there are now no |
| 2303 | ** connections at all to the database. If so, it performs a checkpoint | 2303 | ** connections at all to the database. If so, it performs a checkpoint |
| 2304 | ** operation before closing the connection. This option may be used to | 2304 | ** operation before closing the connection. This option may be used to |
| 2305 | ** override this behaviour. The first parameter passed to this operation | 2305 | ** override this behavior. The first parameter passed to this operation |
| 2306 | ** is an integer - positive to disable checkpoints-on-close, or zero (the | 2306 | ** is an integer - positive to disable checkpoints-on-close, or zero (the |
| 2307 | ** default) to enable them, and negative to leave the setting unchanged. | 2307 | ** default) to enable them, and negative to leave the setting unchanged. |
| 2308 | ** The second parameter is a pointer to an integer | 2308 | ** The second parameter is a pointer to an integer |
| @@ -3955,6 +3955,7 @@ SQLITE_API void sqlite3_free_filename(sqlite3_filename); | |||
| 3955 | ** | 3955 | ** |
| 3956 | ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language | 3956 | ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language |
| 3957 | ** text that describes the error, as either UTF-8 or UTF-16 respectively. | 3957 | ** text that describes the error, as either UTF-8 or UTF-16 respectively. |
| 3958 | ** (See how SQLite handles [invalid UTF] for exceptions to this rule.) | ||
| 3958 | ** ^(Memory to hold the error message string is managed internally. | 3959 | ** ^(Memory to hold the error message string is managed internally. |
| 3959 | ** The application does not need to worry about freeing the result. | 3960 | ** The application does not need to worry about freeing the result. |
| 3960 | ** However, the error string might be overwritten or deallocated by | 3961 | ** However, the error string might be overwritten or deallocated by |
| @@ -5325,6 +5326,7 @@ SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt); | |||
| 5325 | */ | 5326 | */ |
| 5326 | SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt); | 5327 | SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt); |
| 5327 | 5328 | ||
| 5329 | |||
| 5328 | /* | 5330 | /* |
| 5329 | ** CAPI3REF: Create Or Redefine SQL Functions | 5331 | ** CAPI3REF: Create Or Redefine SQL Functions |
| 5330 | ** KEYWORDS: {function creation routines} | 5332 | ** KEYWORDS: {function creation routines} |
| @@ -5879,32 +5881,32 @@ SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*); | |||
| 5879 | ** METHOD: sqlite3_context | 5881 | ** METHOD: sqlite3_context |
| 5880 | ** | 5882 | ** |
| 5881 | ** These functions may be used by (non-aggregate) SQL functions to | 5883 | ** These functions may be used by (non-aggregate) SQL functions to |
| 5882 | ** associate metadata with argument values. If the same value is passed to | 5884 | ** associate auxiliary data with argument values. If the same argument |
| 5883 | ** multiple invocations of the same SQL function during query execution, under | 5885 | ** value is passed to multiple invocations of the same SQL function during |
| 5884 | ** some circumstances the associated metadata may be preserved. An example | 5886 | ** query execution, under some circumstances the associated auxiliary data |
| 5885 | ** of where this might be useful is in a regular-expression matching | 5887 | ** might be preserved. An example of where this might be useful is in a |
| 5886 | ** function. The compiled version of the regular expression can be stored as | 5888 | ** regular-expression matching function. The compiled version of the regular |
| 5887 | ** metadata associated with the pattern string. | 5889 | ** expression can be stored as auxiliary data associated with the pattern string. |
| 5888 | ** Then as long as the pattern string remains the same, | 5890 | ** Then as long as the pattern string remains the same, |
| 5889 | ** the compiled regular expression can be reused on multiple | 5891 | ** the compiled regular expression can be reused on multiple |
| 5890 | ** invocations of the same function. | 5892 | ** invocations of the same function. |
| 5891 | ** | 5893 | ** |
| 5892 | ** ^The sqlite3_get_auxdata(C,N) interface returns a pointer to the metadata | 5894 | ** ^The sqlite3_get_auxdata(C,N) interface returns a pointer to the auxiliary data |
| 5893 | ** associated by the sqlite3_set_auxdata(C,N,P,X) function with the Nth argument | 5895 | ** associated by the sqlite3_set_auxdata(C,N,P,X) function with the Nth argument |
| 5894 | ** value to the application-defined function. ^N is zero for the left-most | 5896 | ** value to the application-defined function. ^N is zero for the left-most |
| 5895 | ** function argument. ^If there is no metadata | 5897 | ** function argument. ^If there is no auxiliary data |
| 5896 | ** associated with the function argument, the sqlite3_get_auxdata(C,N) interface | 5898 | ** associated with the function argument, the sqlite3_get_auxdata(C,N) interface |
| 5897 | ** returns a NULL pointer. | 5899 | ** returns a NULL pointer. |
| 5898 | ** | 5900 | ** |
| 5899 | ** ^The sqlite3_set_auxdata(C,N,P,X) interface saves P as metadata for the N-th | 5901 | ** ^The sqlite3_set_auxdata(C,N,P,X) interface saves P as auxiliary data for the |
| 5900 | ** argument of the application-defined function. ^Subsequent | 5902 | ** N-th argument of the application-defined function. ^Subsequent |
| 5901 | ** calls to sqlite3_get_auxdata(C,N) return P from the most recent | 5903 | ** calls to sqlite3_get_auxdata(C,N) return P from the most recent |
| 5902 | ** sqlite3_set_auxdata(C,N,P,X) call if the metadata is still valid or | 5904 | ** sqlite3_set_auxdata(C,N,P,X) call if the auxiliary data is still valid or |
| 5903 | ** NULL if the metadata has been discarded. | 5905 | ** NULL if the auxiliary data has been discarded. |
| 5904 | ** ^After each call to sqlite3_set_auxdata(C,N,P,X) where X is not NULL, | 5906 | ** ^After each call to sqlite3_set_auxdata(C,N,P,X) where X is not NULL, |
| 5905 | ** SQLite will invoke the destructor function X with parameter P exactly | 5907 | ** SQLite will invoke the destructor function X with parameter P exactly |
| 5906 | ** once, when the metadata is discarded. | 5908 | ** once, when the auxiliary data is discarded. |
| 5907 | ** SQLite is free to discard the metadata at any time, including: <ul> | 5909 | ** SQLite is free to discard the auxiliary data at any time, including: <ul> |
| 5908 | ** <li> ^(when the corresponding function parameter changes)^, or | 5910 | ** <li> ^(when the corresponding function parameter changes)^, or |
| 5909 | ** <li> ^(when [sqlite3_reset()] or [sqlite3_finalize()] is called for the | 5911 | ** <li> ^(when [sqlite3_reset()] or [sqlite3_finalize()] is called for the |
| 5910 | ** SQL statement)^, or | 5912 | ** SQL statement)^, or |
| @@ -5920,7 +5922,7 @@ SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*); | |||
| 5920 | ** function implementation should not make any use of P after | 5922 | ** function implementation should not make any use of P after |
| 5921 | ** sqlite3_set_auxdata() has been called. | 5923 | ** sqlite3_set_auxdata() has been called. |
| 5922 | ** | 5924 | ** |
| 5923 | ** ^(In practice, metadata is preserved between function calls for | 5925 | ** ^(In practice, auxiliary data is preserved between function calls for |
| 5924 | ** function parameters that are compile-time constants, including literal | 5926 | ** function parameters that are compile-time constants, including literal |
| 5925 | ** values and [parameters] and expressions composed from the same.)^ | 5927 | ** values and [parameters] and expressions composed from the same.)^ |
| 5926 | ** | 5928 | ** |
| @@ -5930,10 +5932,67 @@ SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*); | |||
| 5930 | ** | 5932 | ** |
| 5931 | ** These routines must be called from the same thread in which | 5933 | ** These routines must be called from the same thread in which |
| 5932 | ** the SQL function is running. | 5934 | ** the SQL function is running. |
| 5935 | ** | ||
| 5936 | ** See also: [sqlite3_get_clientdata()] and [sqlite3_set_clientdata()]. | ||
| 5933 | */ | 5937 | */ |
| 5934 | SQLITE_API void *sqlite3_get_auxdata(sqlite3_context*, int N); | 5938 | SQLITE_API void *sqlite3_get_auxdata(sqlite3_context*, int N); |
| 5935 | SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*)); | 5939 | SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*)); |
| 5936 | 5940 | ||
| 5941 | /* | ||
| 5942 | ** CAPI3REF: Database Connection Client Data | ||
| 5943 | ** METHOD: sqlite3 | ||
| 5944 | ** | ||
| 5945 | ** These functions are used to associate one or more named pointers | ||
| 5946 | ** with a [database connection]. | ||
| 5947 | ** A call to sqlite3_set_clientdata(D,N,P,X) causes the pointer P | ||
| 5948 | ** to be attached to [database connection] D using name N. Subsequent | ||
| 5949 | ** calls to sqlite3_get_clientdata(D,N) will return a copy of pointer P | ||
| 5950 | ** or a NULL pointer if there were no prior calls to | ||
| 5951 | ** sqlite3_set_clientdata() with the same values of D and N. | ||
| 5952 | ** Names are compared using strcmp() and are thus case sensitive. | ||
| 5953 | ** | ||
| 5954 | ** If P and X are both non-NULL, then the destructor X is invoked with | ||
| 5955 | ** argument P on the first of the following occurrences: | ||
| 5956 | ** <ul> | ||
| 5957 | ** <li> An out-of-memory error occurs during the call to | ||
| 5958 | ** sqlite3_set_clientdata() which attempts to register pointer P. | ||
| 5959 | ** <li> A subsequent call to sqlite3_set_clientdata(D,N,P,X) is made | ||
| 5960 | ** with the same D and N parameters. | ||
| 5961 | ** <li> The database connection closes. SQLite does not make any guarantees | ||
| 5962 | ** about the order in which destructors are called, only that all | ||
| 5963 | ** destructors will be called exactly once at some point during the | ||
| 5964 | ** database connection closing process. | ||
| 5965 | ** </ul> | ||
| 5966 | ** | ||
| 5967 | ** SQLite does not do anything with client data other than invoke | ||
| 5968 | ** destructors on the client data at the appropriate time. The intended | ||
| 5969 | ** use for client data is to provide a mechanism for wrapper libraries | ||
| 5970 | ** to store additional information about an SQLite database connection. | ||
| 5971 | ** | ||
| 5972 | ** There is no limit (other than available memory) on the number of different | ||
| 5973 | ** client data pointers (with different names) that can be attached to a | ||
| 5974 | ** single database connection. However, the implementation is optimized | ||
| 5975 | ** for the case of having only one or two different client data names. | ||
| 5976 | ** Applications and wrapper libraries are discouraged from using more than | ||
| 5977 | ** one client data name each. | ||
| 5978 | ** | ||
| 5979 | ** There is no way to enumerate the client data pointers | ||
| 5980 | ** associated with a database connection. The N parameter can be thought | ||
| 5981 | ** of as a secret key such that only code that knows the secret key is able | ||
| 5982 | ** to access the associated data. | ||
| 5983 | ** | ||
| 5984 | ** Security Warning: These interfaces should not be exposed in scripting | ||
| 5985 | ** languages or in other circumstances where it might be possible for an | ||
| 5986 | ** an attacker to invoke them. Any agent that can invoke these interfaces | ||
| 5987 | ** can probably also take control of the process. | ||
| 5988 | ** | ||
| 5989 | ** Database connection client data is only available for SQLite | ||
| 5990 | ** version 3.44.0 ([dateof:3.44.0]) and later. | ||
| 5991 | ** | ||
| 5992 | ** See also: [sqlite3_set_auxdata()] and [sqlite3_get_auxdata()]. | ||
| 5993 | */ | ||
| 5994 | SQLITE_API void *sqlite3_get_clientdata(sqlite3*,const char*); | ||
| 5995 | SQLITE_API int sqlite3_set_clientdata(sqlite3*, const char*, void*, void(*)(void*)); | ||
| 5937 | 5996 | ||
| 5938 | /* | 5997 | /* |
| 5939 | ** CAPI3REF: Constants Defining Special Destructor Behavior | 5998 | ** CAPI3REF: Constants Defining Special Destructor Behavior |
| @@ -6566,7 +6625,7 @@ SQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName); | |||
| 6566 | SQLITE_API int sqlite3_txn_state(sqlite3*,const char *zSchema); | 6625 | SQLITE_API int sqlite3_txn_state(sqlite3*,const char *zSchema); |
| 6567 | 6626 | ||
| 6568 | /* | 6627 | /* |
| 6569 | ** CAPI3REF: Allowed return values from [sqlite3_txn_state()] | 6628 | ** CAPI3REF: Allowed return values from sqlite3_txn_state() |
| 6570 | ** KEYWORDS: {transaction state} | 6629 | ** KEYWORDS: {transaction state} |
| 6571 | ** | 6630 | ** |
| 6572 | ** These constants define the current transaction state of a database file. | 6631 | ** These constants define the current transaction state of a database file. |
| @@ -6698,7 +6757,7 @@ SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*); | |||
| 6698 | ** ^Each call to the sqlite3_autovacuum_pages() interface overrides all | 6757 | ** ^Each call to the sqlite3_autovacuum_pages() interface overrides all |
| 6699 | ** previous invocations for that database connection. ^If the callback | 6758 | ** previous invocations for that database connection. ^If the callback |
| 6700 | ** argument (C) to sqlite3_autovacuum_pages(D,C,P,X) is a NULL pointer, | 6759 | ** argument (C) to sqlite3_autovacuum_pages(D,C,P,X) is a NULL pointer, |
| 6701 | ** then the autovacuum steps callback is cancelled. The return value | 6760 | ** then the autovacuum steps callback is canceled. The return value |
| 6702 | ** from sqlite3_autovacuum_pages() is normally SQLITE_OK, but might | 6761 | ** from sqlite3_autovacuum_pages() is normally SQLITE_OK, but might |
| 6703 | ** be some other error code if something goes wrong. The current | 6762 | ** be some other error code if something goes wrong. The current |
| 6704 | ** implementation will only return SQLITE_OK or SQLITE_MISUSE, but other | 6763 | ** implementation will only return SQLITE_OK or SQLITE_MISUSE, but other |
| @@ -7217,6 +7276,10 @@ struct sqlite3_module { | |||
| 7217 | /* The methods above are in versions 1 and 2 of the sqlite_module object. | 7276 | /* The methods above are in versions 1 and 2 of the sqlite_module object. |
| 7218 | ** Those below are for version 3 and greater. */ | 7277 | ** Those below are for version 3 and greater. */ |
| 7219 | int (*xShadowName)(const char*); | 7278 | int (*xShadowName)(const char*); |
| 7279 | /* The methods above are in versions 1 through 3 of the sqlite_module object. | ||
| 7280 | ** Those below are for version 4 and greater. */ | ||
| 7281 | int (*xIntegrity)(sqlite3_vtab *pVTab, const char *zSchema, | ||
| 7282 | const char *zTabName, int mFlags, char **pzErr); | ||
| 7220 | }; | 7283 | }; |
| 7221 | 7284 | ||
| 7222 | /* | 7285 | /* |
| @@ -7704,7 +7767,7 @@ SQLITE_API int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64); | |||
| 7704 | ** code is returned and the transaction rolled back. | 7767 | ** code is returned and the transaction rolled back. |
| 7705 | ** | 7768 | ** |
| 7706 | ** Calling this function with an argument that is not a NULL pointer or an | 7769 | ** Calling this function with an argument that is not a NULL pointer or an |
| 7707 | ** open blob handle results in undefined behaviour. ^Calling this routine | 7770 | ** open blob handle results in undefined behavior. ^Calling this routine |
| 7708 | ** with a null pointer (such as would be returned by a failed call to | 7771 | ** with a null pointer (such as would be returned by a failed call to |
| 7709 | ** [sqlite3_blob_open()]) is a harmless no-op. ^Otherwise, if this function | 7772 | ** [sqlite3_blob_open()]) is a harmless no-op. ^Otherwise, if this function |
| 7710 | ** is passed a valid open blob handle, the values returned by the | 7773 | ** is passed a valid open blob handle, the values returned by the |
| @@ -8184,6 +8247,7 @@ SQLITE_API int sqlite3_test_control(int op, ...); | |||
| 8184 | #define SQLITE_TESTCTRL_PRNG_SAVE 5 | 8247 | #define SQLITE_TESTCTRL_PRNG_SAVE 5 |
| 8185 | #define SQLITE_TESTCTRL_PRNG_RESTORE 6 | 8248 | #define SQLITE_TESTCTRL_PRNG_RESTORE 6 |
| 8186 | #define SQLITE_TESTCTRL_PRNG_RESET 7 /* NOT USED */ | 8249 | #define SQLITE_TESTCTRL_PRNG_RESET 7 /* NOT USED */ |
| 8250 | #define SQLITE_TESTCTRL_FK_NO_ACTION 7 | ||
| 8187 | #define SQLITE_TESTCTRL_BITVEC_TEST 8 | 8251 | #define SQLITE_TESTCTRL_BITVEC_TEST 8 |
| 8188 | #define SQLITE_TESTCTRL_FAULT_INSTALL 9 | 8252 | #define SQLITE_TESTCTRL_FAULT_INSTALL 9 |
| 8189 | #define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10 | 8253 | #define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10 |
| @@ -9245,8 +9309,8 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p); | |||
| 9245 | ** blocked connection already has a registered unlock-notify callback, | 9309 | ** blocked connection already has a registered unlock-notify callback, |
| 9246 | ** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is | 9310 | ** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is |
| 9247 | ** called with a NULL pointer as its second argument, then any existing | 9311 | ** called with a NULL pointer as its second argument, then any existing |
| 9248 | ** unlock-notify callback is cancelled. ^The blocked connections | 9312 | ** unlock-notify callback is canceled. ^The blocked connections |
| 9249 | ** unlock-notify callback may also be cancelled by closing the blocked | 9313 | ** unlock-notify callback may also be canceled by closing the blocked |
| 9250 | ** connection using [sqlite3_close()]. | 9314 | ** connection using [sqlite3_close()]. |
| 9251 | ** | 9315 | ** |
| 9252 | ** The unlock-notify callback is not reentrant. If an application invokes | 9316 | ** The unlock-notify callback is not reentrant. If an application invokes |
| @@ -10549,6 +10613,13 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const c | |||
| 10549 | ** SQLITE_SERIALIZE_NOCOPY bit is set but no contiguous copy | 10613 | ** SQLITE_SERIALIZE_NOCOPY bit is set but no contiguous copy |
| 10550 | ** of the database exists. | 10614 | ** of the database exists. |
| 10551 | ** | 10615 | ** |
| 10616 | ** After the call, if the SQLITE_SERIALIZE_NOCOPY bit had been set, | ||
| 10617 | ** the returned buffer content will remain accessible and unchanged | ||
| 10618 | ** until either the next write operation on the connection or when | ||
| 10619 | ** the connection is closed, and applications must not modify the | ||
| 10620 | ** buffer. If the bit had been clear, the returned buffer will not | ||
| 10621 | ** be accessed by SQLite after the call. | ||
| 10622 | ** | ||
| 10552 | ** A call to sqlite3_serialize(D,S,P,F) might return NULL even if the | 10623 | ** A call to sqlite3_serialize(D,S,P,F) might return NULL even if the |
| 10553 | ** SQLITE_SERIALIZE_NOCOPY bit is omitted from argument F if a memory | 10624 | ** SQLITE_SERIALIZE_NOCOPY bit is omitted from argument F if a memory |
| 10554 | ** allocation error occurs. | 10625 | ** allocation error occurs. |
| @@ -10597,6 +10668,9 @@ SQLITE_API unsigned char *sqlite3_serialize( | |||
| 10597 | ** SQLite will try to increase the buffer size using sqlite3_realloc64() | 10668 | ** SQLite will try to increase the buffer size using sqlite3_realloc64() |
| 10598 | ** if writes on the database cause it to grow larger than M bytes. | 10669 | ** if writes on the database cause it to grow larger than M bytes. |
| 10599 | ** | 10670 | ** |
| 10671 | ** Applications must not modify the buffer P or invalidate it before | ||
| 10672 | ** the database connection D is closed. | ||
| 10673 | ** | ||
| 10600 | ** The sqlite3_deserialize() interface will fail with SQLITE_BUSY if the | 10674 | ** The sqlite3_deserialize() interface will fail with SQLITE_BUSY if the |
| 10601 | ** database is currently in a read transaction or is involved in a backup | 10675 | ** database is currently in a read transaction or is involved in a backup |
| 10602 | ** operation. | 10676 | ** operation. |
| @@ -10605,6 +10679,13 @@ SQLITE_API unsigned char *sqlite3_serialize( | |||
| 10605 | ** S argument to sqlite3_deserialize(D,S,P,N,M,F) is "temp" then the | 10679 | ** S argument to sqlite3_deserialize(D,S,P,N,M,F) is "temp" then the |
| 10606 | ** function returns SQLITE_ERROR. | 10680 | ** function returns SQLITE_ERROR. |
| 10607 | ** | 10681 | ** |
| 10682 | ** The deserialized database should not be in [WAL mode]. If the database | ||
| 10683 | ** is in WAL mode, then any attempt to use the database file will result | ||
| 10684 | ** in an [SQLITE_CANTOPEN] error. The application can set the | ||
| 10685 | ** [file format version numbers] (bytes 18 and 19) of the input database P | ||
| 10686 | ** to 0x01 prior to invoking sqlite3_deserialize(D,S,P,N,M,F) to force the | ||
| 10687 | ** database file into rollback mode and work around this limitation. | ||
| 10688 | ** | ||
| 10608 | ** If sqlite3_deserialize(D,S,P,N,M,F) fails for any reason and if the | 10689 | ** If sqlite3_deserialize(D,S,P,N,M,F) fails for any reason and if the |
| 10609 | ** SQLITE_DESERIALIZE_FREEONCLOSE bit is set in argument F, then | 10690 | ** SQLITE_DESERIALIZE_FREEONCLOSE bit is set in argument F, then |
| 10610 | ** [sqlite3_free()] is invoked on argument P prior to returning. | 10691 | ** [sqlite3_free()] is invoked on argument P prior to returning. |
| @@ -11678,6 +11759,18 @@ SQLITE_API int sqlite3changeset_concat( | |||
| 11678 | 11759 | ||
| 11679 | 11760 | ||
| 11680 | /* | 11761 | /* |
| 11762 | ** CAPI3REF: Upgrade the Schema of a Changeset/Patchset | ||
| 11763 | */ | ||
| 11764 | SQLITE_API int sqlite3changeset_upgrade( | ||
| 11765 | sqlite3 *db, | ||
| 11766 | const char *zDb, | ||
| 11767 | int nIn, const void *pIn, /* Input changeset */ | ||
| 11768 | int *pnOut, void **ppOut /* OUT: Inverse of input */ | ||
| 11769 | ); | ||
| 11770 | |||
| 11771 | |||
| 11772 | |||
| 11773 | /* | ||
| 11681 | ** CAPI3REF: Changegroup Handle | 11774 | ** CAPI3REF: Changegroup Handle |
| 11682 | ** | 11775 | ** |
| 11683 | ** A changegroup is an object used to combine two or more | 11776 | ** A changegroup is an object used to combine two or more |
| @@ -11724,6 +11817,38 @@ typedef struct sqlite3_changegroup sqlite3_changegroup; | |||
| 11724 | SQLITE_API int sqlite3changegroup_new(sqlite3_changegroup **pp); | 11817 | SQLITE_API int sqlite3changegroup_new(sqlite3_changegroup **pp); |
| 11725 | 11818 | ||
| 11726 | /* | 11819 | /* |
| 11820 | ** CAPI3REF: Add a Schema to a Changegroup | ||
| 11821 | ** METHOD: sqlite3_changegroup_schema | ||
| 11822 | ** | ||
| 11823 | ** This method may be used to optionally enforce the rule that the changesets | ||
| 11824 | ** added to the changegroup handle must match the schema of database zDb | ||
| 11825 | ** ("main", "temp", or the name of an attached database). If | ||
| 11826 | ** sqlite3changegroup_add() is called to add a changeset that is not compatible | ||
| 11827 | ** with the configured schema, SQLITE_SCHEMA is returned and the changegroup | ||
| 11828 | ** object is left in an undefined state. | ||
| 11829 | ** | ||
| 11830 | ** A changeset schema is considered compatible with the database schema in | ||
| 11831 | ** the same way as for sqlite3changeset_apply(). Specifically, for each | ||
| 11832 | ** table in the changeset, there exists a database table with: | ||
| 11833 | ** | ||
| 11834 | ** <ul> | ||
| 11835 | ** <li> The name identified by the changeset, and | ||
| 11836 | ** <li> at least as many columns as recorded in the changeset, and | ||
| 11837 | ** <li> the primary key columns in the same position as recorded in | ||
| 11838 | ** the changeset. | ||
| 11839 | ** </ul> | ||
| 11840 | ** | ||
| 11841 | ** The output of the changegroup object always has the same schema as the | ||
| 11842 | ** database nominated using this function. In cases where changesets passed | ||
| 11843 | ** to sqlite3changegroup_add() have fewer columns than the corresponding table | ||
| 11844 | ** in the database schema, these are filled in using the default column | ||
| 11845 | ** values from the database schema. This makes it possible to combined | ||
| 11846 | ** changesets that have different numbers of columns for a single table | ||
| 11847 | ** within a changegroup, provided that they are otherwise compatible. | ||
| 11848 | */ | ||
| 11849 | SQLITE_API int sqlite3changegroup_schema(sqlite3_changegroup*, sqlite3*, const char *zDb); | ||
| 11850 | |||
| 11851 | /* | ||
| 11727 | ** CAPI3REF: Add A Changeset To A Changegroup | 11852 | ** CAPI3REF: Add A Changeset To A Changegroup |
| 11728 | ** METHOD: sqlite3_changegroup | 11853 | ** METHOD: sqlite3_changegroup |
| 11729 | ** | 11854 | ** |
| @@ -11791,13 +11916,18 @@ SQLITE_API int sqlite3changegroup_new(sqlite3_changegroup **pp); | |||
| 11791 | ** If the new changeset contains changes to a table that is already present | 11916 | ** If the new changeset contains changes to a table that is already present |
| 11792 | ** in the changegroup, then the number of columns and the position of the | 11917 | ** in the changegroup, then the number of columns and the position of the |
| 11793 | ** primary key columns for the table must be consistent. If this is not the | 11918 | ** primary key columns for the table must be consistent. If this is not the |
| 11794 | ** case, this function fails with SQLITE_SCHEMA. If the input changeset | 11919 | ** case, this function fails with SQLITE_SCHEMA. Except, if the changegroup |
| 11795 | ** appears to be corrupt and the corruption is detected, SQLITE_CORRUPT is | 11920 | ** object has been configured with a database schema using the |
| 11796 | ** returned. Or, if an out-of-memory condition occurs during processing, this | 11921 | ** sqlite3changegroup_schema() API, then it is possible to combine changesets |
| 11797 | ** function returns SQLITE_NOMEM. In all cases, if an error occurs the state | 11922 | ** with different numbers of columns for a single table, provided that |
| 11798 | ** of the final contents of the changegroup is undefined. | 11923 | ** they are otherwise compatible. |
| 11799 | ** | 11924 | ** |
| 11800 | ** If no error occurs, SQLITE_OK is returned. | 11925 | ** If the input changeset appears to be corrupt and the corruption is |
| 11926 | ** detected, SQLITE_CORRUPT is returned. Or, if an out-of-memory condition | ||
| 11927 | ** occurs during processing, this function returns SQLITE_NOMEM. | ||
| 11928 | ** | ||
| 11929 | ** In all cases, if an error occurs the state of the final contents of the | ||
| 11930 | ** changegroup is undefined. If no error occurs, SQLITE_OK is returned. | ||
| 11801 | */ | 11931 | */ |
| 11802 | SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData); | 11932 | SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData); |
| 11803 | 11933 | ||
| @@ -12062,10 +12192,17 @@ SQLITE_API int sqlite3changeset_apply_v2( | |||
| 12062 | ** <li>an insert change if all fields of the conflicting row match | 12192 | ** <li>an insert change if all fields of the conflicting row match |
| 12063 | ** the row being inserted. | 12193 | ** the row being inserted. |
| 12064 | ** </ul> | 12194 | ** </ul> |
| 12195 | ** | ||
| 12196 | ** <dt>SQLITE_CHANGESETAPPLY_FKNOACTION <dd> | ||
| 12197 | ** If this flag it set, then all foreign key constraints in the target | ||
| 12198 | ** database behave as if they were declared with "ON UPDATE NO ACTION ON | ||
| 12199 | ** DELETE NO ACTION", even if they are actually CASCADE, RESTRICT, SET NULL | ||
| 12200 | ** or SET DEFAULT. | ||
| 12065 | */ | 12201 | */ |
| 12066 | #define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001 | 12202 | #define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001 |
| 12067 | #define SQLITE_CHANGESETAPPLY_INVERT 0x0002 | 12203 | #define SQLITE_CHANGESETAPPLY_INVERT 0x0002 |
| 12068 | #define SQLITE_CHANGESETAPPLY_IGNORENOOP 0x0004 | 12204 | #define SQLITE_CHANGESETAPPLY_IGNORENOOP 0x0004 |
| 12205 | #define SQLITE_CHANGESETAPPLY_FKNOACTION 0x0008 | ||
| 12069 | 12206 | ||
| 12070 | /* | 12207 | /* |
| 12071 | ** CAPI3REF: Constants Passed To The Conflict Handler | 12208 | ** CAPI3REF: Constants Passed To The Conflict Handler |