@photostructure/sqlite 0.0.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -2
- package/README.md +45 -484
- package/SECURITY.md +27 -84
- package/binding.gyp +69 -22
- package/dist/index.cjs +185 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +552 -100
- package/dist/index.d.mts +552 -100
- package/dist/index.d.ts +552 -100
- package/dist/index.mjs +183 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +51 -41
- package/prebuilds/darwin-arm64/@photostructure+sqlite.glibc.node +0 -0
- package/prebuilds/darwin-x64/@photostructure+sqlite.glibc.node +0 -0
- package/prebuilds/linux-arm64/@photostructure+sqlite.glibc.node +0 -0
- package/prebuilds/linux-arm64/@photostructure+sqlite.musl.node +0 -0
- package/prebuilds/linux-x64/@photostructure+sqlite.glibc.node +0 -0
- package/prebuilds/linux-x64/@photostructure+sqlite.musl.node +0 -0
- package/prebuilds/test_extension.so +0 -0
- package/prebuilds/win32-x64/@photostructure+sqlite.glibc.node +0 -0
- package/src/aggregate_function.cpp +503 -235
- package/src/aggregate_function.h +57 -42
- package/src/binding.cpp +117 -14
- package/src/dirname.ts +1 -1
- package/src/index.ts +122 -332
- package/src/lru-cache.ts +84 -0
- package/src/shims/env-inl.h +6 -15
- package/src/shims/node_errors.h +4 -0
- package/src/shims/sqlite_errors.h +162 -0
- package/src/shims/util.h +29 -4
- package/src/sql-tag-store.ts +140 -0
- package/src/sqlite_exception.h +49 -0
- package/src/sqlite_impl.cpp +711 -127
- package/src/sqlite_impl.h +84 -6
- package/src/{stack_path.ts → stack-path.ts} +7 -1
- package/src/types/aggregate-options.ts +22 -0
- package/src/types/changeset-apply-options.ts +18 -0
- package/src/types/database-sync-instance.ts +203 -0
- package/src/types/database-sync-options.ts +69 -0
- package/src/types/session-options.ts +10 -0
- package/src/types/sql-tag-store-instance.ts +51 -0
- package/src/types/sqlite-authorization-actions.ts +77 -0
- package/src/types/sqlite-authorization-results.ts +15 -0
- package/src/types/sqlite-changeset-conflict-types.ts +19 -0
- package/src/types/sqlite-changeset-resolution.ts +15 -0
- package/src/types/sqlite-open-flags.ts +50 -0
- package/src/types/statement-sync-instance.ts +73 -0
- package/src/types/user-functions-options.ts +14 -0
- package/src/upstream/node_sqlite.cc +960 -259
- package/src/upstream/node_sqlite.h +127 -2
- package/src/upstream/sqlite.js +1 -14
- package/src/upstream/sqlite3.c +4510 -1411
- package/src/upstream/sqlite3.h +390 -195
- package/src/upstream/sqlite3ext.h +7 -0
- package/src/user_function.cpp +88 -36
- package/src/user_function.h +2 -1
package/src/upstream/sqlite3.h
CHANGED
|
@@ -146,9 +146,12 @@ extern "C" {
|
|
|
146
146
|
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
|
147
147
|
** [sqlite_version()] and [sqlite_source_id()].
|
|
148
148
|
*/
|
|
149
|
-
#define SQLITE_VERSION "3.
|
|
150
|
-
#define SQLITE_VERSION_NUMBER
|
|
151
|
-
#define SQLITE_SOURCE_ID "2025-
|
|
149
|
+
#define SQLITE_VERSION "3.51.1"
|
|
150
|
+
#define SQLITE_VERSION_NUMBER 3051001
|
|
151
|
+
#define SQLITE_SOURCE_ID "2025-11-28 17:28:25 281fc0e9afc38674b9b0991943b9e9d1e64c6cbdb133d35f6f5c87ff6af38a88"
|
|
152
|
+
#define SQLITE_SCM_BRANCH "branch-3.51"
|
|
153
|
+
#define SQLITE_SCM_TAGS "release version-3.51.1"
|
|
154
|
+
#define SQLITE_SCM_DATETIME "2025-11-28T17:28:25.933Z"
|
|
152
155
|
|
|
153
156
|
/*
|
|
154
157
|
** CAPI3REF: Run-Time Library Version Numbers
|
|
@@ -168,9 +171,9 @@ extern "C" {
|
|
|
168
171
|
** assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 );
|
|
169
172
|
** </pre></blockquote>)^
|
|
170
173
|
**
|
|
171
|
-
** ^The sqlite3_version[] string constant contains the text of
|
|
172
|
-
** macro. ^The sqlite3_libversion() function returns a
|
|
173
|
-
** to the sqlite3_version[] string constant. The sqlite3_libversion()
|
|
174
|
+
** ^The sqlite3_version[] string constant contains the text of the
|
|
175
|
+
** [SQLITE_VERSION] macro. ^The sqlite3_libversion() function returns a
|
|
176
|
+
** pointer to the sqlite3_version[] string constant. The sqlite3_libversion()
|
|
174
177
|
** function is provided for use in DLLs since DLL users usually do not have
|
|
175
178
|
** direct access to string constants within the DLL. ^The
|
|
176
179
|
** sqlite3_libversion_number() function returns an integer equal to
|
|
@@ -370,7 +373,7 @@ typedef int (*sqlite3_callback)(void*,int,char**, char**);
|
|
|
370
373
|
** without having to use a lot of C code.
|
|
371
374
|
**
|
|
372
375
|
** ^The sqlite3_exec() interface runs zero or more UTF-8 encoded,
|
|
373
|
-
** semicolon-
|
|
376
|
+
** semicolon-separated SQL statements passed into its 2nd argument,
|
|
374
377
|
** in the context of the [database connection] passed in as its 1st
|
|
375
378
|
** argument. ^If the callback function of the 3rd argument to
|
|
376
379
|
** sqlite3_exec() is not NULL, then it is invoked for each result row
|
|
@@ -403,7 +406,7 @@ typedef int (*sqlite3_callback)(void*,int,char**, char**);
|
|
|
403
406
|
** result row is NULL then the corresponding string pointer for the
|
|
404
407
|
** sqlite3_exec() callback is a NULL pointer. ^The 4th argument to the
|
|
405
408
|
** sqlite3_exec() callback is an array of pointers to strings where each
|
|
406
|
-
** entry represents the name of corresponding result column as obtained
|
|
409
|
+
** entry represents the name of a corresponding result column as obtained
|
|
407
410
|
** from [sqlite3_column_name()].
|
|
408
411
|
**
|
|
409
412
|
** ^If the 2nd parameter to sqlite3_exec() is a NULL pointer, a pointer
|
|
@@ -497,6 +500,9 @@ SQLITE_API int sqlite3_exec(
|
|
|
497
500
|
#define SQLITE_ERROR_MISSING_COLLSEQ (SQLITE_ERROR | (1<<8))
|
|
498
501
|
#define SQLITE_ERROR_RETRY (SQLITE_ERROR | (2<<8))
|
|
499
502
|
#define SQLITE_ERROR_SNAPSHOT (SQLITE_ERROR | (3<<8))
|
|
503
|
+
#define SQLITE_ERROR_RESERVESIZE (SQLITE_ERROR | (4<<8))
|
|
504
|
+
#define SQLITE_ERROR_KEY (SQLITE_ERROR | (5<<8))
|
|
505
|
+
#define SQLITE_ERROR_UNABLE (SQLITE_ERROR | (6<<8))
|
|
500
506
|
#define SQLITE_IOERR_READ (SQLITE_IOERR | (1<<8))
|
|
501
507
|
#define SQLITE_IOERR_SHORT_READ (SQLITE_IOERR | (2<<8))
|
|
502
508
|
#define SQLITE_IOERR_WRITE (SQLITE_IOERR | (3<<8))
|
|
@@ -531,6 +537,8 @@ SQLITE_API int sqlite3_exec(
|
|
|
531
537
|
#define SQLITE_IOERR_DATA (SQLITE_IOERR | (32<<8))
|
|
532
538
|
#define SQLITE_IOERR_CORRUPTFS (SQLITE_IOERR | (33<<8))
|
|
533
539
|
#define SQLITE_IOERR_IN_PAGE (SQLITE_IOERR | (34<<8))
|
|
540
|
+
#define SQLITE_IOERR_BADKEY (SQLITE_IOERR | (35<<8))
|
|
541
|
+
#define SQLITE_IOERR_CODEC (SQLITE_IOERR | (36<<8))
|
|
534
542
|
#define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8))
|
|
535
543
|
#define SQLITE_LOCKED_VTAB (SQLITE_LOCKED | (2<<8))
|
|
536
544
|
#define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8))
|
|
@@ -589,7 +597,7 @@ SQLITE_API int sqlite3_exec(
|
|
|
589
597
|
** Note in particular that passing the SQLITE_OPEN_EXCLUSIVE flag into
|
|
590
598
|
** [sqlite3_open_v2()] does *not* cause the underlying database file
|
|
591
599
|
** to be opened using O_EXCL. Passing SQLITE_OPEN_EXCLUSIVE into
|
|
592
|
-
** [sqlite3_open_v2()] has historically
|
|
600
|
+
** [sqlite3_open_v2()] has historically been a no-op and might become an
|
|
593
601
|
** error in future versions of SQLite.
|
|
594
602
|
*/
|
|
595
603
|
#define SQLITE_OPEN_READONLY 0x00000001 /* Ok for sqlite3_open_v2() */
|
|
@@ -683,7 +691,7 @@ SQLITE_API int sqlite3_exec(
|
|
|
683
691
|
** SQLite uses one of these integer values as the second
|
|
684
692
|
** argument to calls it makes to the xLock() and xUnlock() methods
|
|
685
693
|
** of an [sqlite3_io_methods] object. These values are ordered from
|
|
686
|
-
**
|
|
694
|
+
** least restrictive to most restrictive.
|
|
687
695
|
**
|
|
688
696
|
** The argument to xLock() is always SHARED or higher. The argument to
|
|
689
697
|
** xUnlock is either SHARED or NONE.
|
|
@@ -924,7 +932,7 @@ struct sqlite3_io_methods {
|
|
|
924
932
|
** connection. See also [SQLITE_FCNTL_FILE_POINTER].
|
|
925
933
|
**
|
|
926
934
|
** <li>[[SQLITE_FCNTL_SYNC_OMITTED]]
|
|
927
|
-
**
|
|
935
|
+
** The SQLITE_FCNTL_SYNC_OMITTED file-control is no longer used.
|
|
928
936
|
**
|
|
929
937
|
** <li>[[SQLITE_FCNTL_SYNC]]
|
|
930
938
|
** The [SQLITE_FCNTL_SYNC] opcode is generated internally by SQLite and
|
|
@@ -999,7 +1007,7 @@ struct sqlite3_io_methods {
|
|
|
999
1007
|
**
|
|
1000
1008
|
** <li>[[SQLITE_FCNTL_VFSNAME]]
|
|
1001
1009
|
** ^The [SQLITE_FCNTL_VFSNAME] opcode can be used to obtain the names of
|
|
1002
|
-
** all [VFSes] in the VFS stack. The names
|
|
1010
|
+
** all [VFSes] in the VFS stack. The names of all VFS shims and the
|
|
1003
1011
|
** final bottom-level VFS are written into memory obtained from
|
|
1004
1012
|
** [sqlite3_malloc()] and the result is stored in the char* variable
|
|
1005
1013
|
** that the fourth parameter of [sqlite3_file_control()] points to.
|
|
@@ -1013,7 +1021,7 @@ struct sqlite3_io_methods {
|
|
|
1013
1021
|
** ^The [SQLITE_FCNTL_VFS_POINTER] opcode finds a pointer to the top-level
|
|
1014
1022
|
** [VFSes] currently in use. ^(The argument X in
|
|
1015
1023
|
** sqlite3_file_control(db,SQLITE_FCNTL_VFS_POINTER,X) must be
|
|
1016
|
-
** of type "[sqlite3_vfs] **". This
|
|
1024
|
+
** of type "[sqlite3_vfs] **". This opcode will set *X
|
|
1017
1025
|
** to a pointer to the top-level VFS.)^
|
|
1018
1026
|
** ^When there are multiple VFS shims in the stack, this opcode finds the
|
|
1019
1027
|
** upper-most shim only.
|
|
@@ -1203,7 +1211,7 @@ struct sqlite3_io_methods {
|
|
|
1203
1211
|
** <li>[[SQLITE_FCNTL_EXTERNAL_READER]]
|
|
1204
1212
|
** The EXPERIMENTAL [SQLITE_FCNTL_EXTERNAL_READER] opcode is used to detect
|
|
1205
1213
|
** whether or not there is a database client in another process with a wal-mode
|
|
1206
|
-
** transaction open on the database or not. It is only available on unix.The
|
|
1214
|
+
** transaction open on the database or not. It is only available on unix. The
|
|
1207
1215
|
** (void*) argument passed with this file-control should be a pointer to a
|
|
1208
1216
|
** value of type (int). The integer value is set to 1 if the database is a wal
|
|
1209
1217
|
** mode database and there exists at least one client in another process that
|
|
@@ -1221,6 +1229,15 @@ struct sqlite3_io_methods {
|
|
|
1221
1229
|
** database is not a temp db, then the [SQLITE_FCNTL_RESET_CACHE] file-control
|
|
1222
1230
|
** purges the contents of the in-memory page cache. If there is an open
|
|
1223
1231
|
** transaction, or if the db is a temp-db, this opcode is a no-op, not an error.
|
|
1232
|
+
**
|
|
1233
|
+
** <li>[[SQLITE_FCNTL_FILESTAT]]
|
|
1234
|
+
** The [SQLITE_FCNTL_FILESTAT] opcode returns low-level diagnostic information
|
|
1235
|
+
** about the [sqlite3_file] objects used access the database and journal files
|
|
1236
|
+
** for the given schema. The fourth parameter to [sqlite3_file_control()]
|
|
1237
|
+
** should be an initialized [sqlite3_str] pointer. JSON text describing
|
|
1238
|
+
** various aspects of the sqlite3_file object is appended to the sqlite3_str.
|
|
1239
|
+
** The SQLITE_FCNTL_FILESTAT opcode is usually a no-op, unless compile-time
|
|
1240
|
+
** options are used to enable it.
|
|
1224
1241
|
** </ul>
|
|
1225
1242
|
*/
|
|
1226
1243
|
#define SQLITE_FCNTL_LOCKSTATE 1
|
|
@@ -1266,6 +1283,7 @@ struct sqlite3_io_methods {
|
|
|
1266
1283
|
#define SQLITE_FCNTL_RESET_CACHE 42
|
|
1267
1284
|
#define SQLITE_FCNTL_NULL_IO 43
|
|
1268
1285
|
#define SQLITE_FCNTL_BLOCK_ON_CONNECT 44
|
|
1286
|
+
#define SQLITE_FCNTL_FILESTAT 45
|
|
1269
1287
|
|
|
1270
1288
|
/* deprecated names */
|
|
1271
1289
|
#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
|
|
@@ -1628,7 +1646,7 @@ struct sqlite3_vfs {
|
|
|
1628
1646
|
** SQLite interfaces so that an application usually does not need to
|
|
1629
1647
|
** invoke sqlite3_initialize() directly. For example, [sqlite3_open()]
|
|
1630
1648
|
** calls sqlite3_initialize() so the SQLite library will be automatically
|
|
1631
|
-
** initialized when [sqlite3_open()] is called if it has not
|
|
1649
|
+
** initialized when [sqlite3_open()] is called if it has not been initialized
|
|
1632
1650
|
** already. ^However, if SQLite is compiled with the [SQLITE_OMIT_AUTOINIT]
|
|
1633
1651
|
** compile-time option, then the automatic calls to sqlite3_initialize()
|
|
1634
1652
|
** are omitted and the application must call sqlite3_initialize() directly
|
|
@@ -1885,21 +1903,21 @@ struct sqlite3_mem_methods {
|
|
|
1885
1903
|
** The [sqlite3_mem_methods]
|
|
1886
1904
|
** structure is filled with the currently defined memory allocation routines.)^
|
|
1887
1905
|
** This option can be used to overload the default memory allocation
|
|
1888
|
-
** routines with a wrapper that
|
|
1906
|
+
** routines with a wrapper that simulates memory allocation failure or
|
|
1889
1907
|
** tracks memory usage, for example. </dd>
|
|
1890
1908
|
**
|
|
1891
1909
|
** [[SQLITE_CONFIG_SMALL_MALLOC]] <dt>SQLITE_CONFIG_SMALL_MALLOC</dt>
|
|
1892
|
-
** <dd> ^The SQLITE_CONFIG_SMALL_MALLOC option takes single argument of
|
|
1910
|
+
** <dd> ^The SQLITE_CONFIG_SMALL_MALLOC option takes a single argument of
|
|
1893
1911
|
** type int, interpreted as a boolean, which if true provides a hint to
|
|
1894
1912
|
** SQLite that it should avoid large memory allocations if possible.
|
|
1895
1913
|
** SQLite will run faster if it is free to make large memory allocations,
|
|
1896
|
-
** but some
|
|
1914
|
+
** but some applications might prefer to run slower in exchange for
|
|
1897
1915
|
** guarantees about memory fragmentation that are possible if large
|
|
1898
1916
|
** allocations are avoided. This hint is normally off.
|
|
1899
1917
|
** </dd>
|
|
1900
1918
|
**
|
|
1901
1919
|
** [[SQLITE_CONFIG_MEMSTATUS]] <dt>SQLITE_CONFIG_MEMSTATUS</dt>
|
|
1902
|
-
** <dd> ^The SQLITE_CONFIG_MEMSTATUS option takes single argument of type int,
|
|
1920
|
+
** <dd> ^The SQLITE_CONFIG_MEMSTATUS option takes a single argument of type int,
|
|
1903
1921
|
** interpreted as a boolean, which enables or disables the collection of
|
|
1904
1922
|
** memory allocation statistics. ^(When memory allocation statistics are
|
|
1905
1923
|
** disabled, the following SQLite interfaces become non-operational:
|
|
@@ -1944,7 +1962,7 @@ struct sqlite3_mem_methods {
|
|
|
1944
1962
|
** ^If pMem is NULL and N is non-zero, then each database connection
|
|
1945
1963
|
** does an initial bulk allocation for page cache memory
|
|
1946
1964
|
** from [sqlite3_malloc()] sufficient for N cache lines if N is positive or
|
|
1947
|
-
** of -1024*N bytes if N is negative
|
|
1965
|
+
** of -1024*N bytes if N is negative. ^If additional
|
|
1948
1966
|
** page cache memory is needed beyond what is provided by the initial
|
|
1949
1967
|
** allocation, then SQLite goes to [sqlite3_malloc()] separately for each
|
|
1950
1968
|
** additional cache line. </dd>
|
|
@@ -1973,7 +1991,7 @@ struct sqlite3_mem_methods {
|
|
|
1973
1991
|
** <dd> ^(The SQLITE_CONFIG_MUTEX option takes a single argument which is a
|
|
1974
1992
|
** pointer to an instance of the [sqlite3_mutex_methods] structure.
|
|
1975
1993
|
** The argument specifies alternative low-level mutex routines to be used
|
|
1976
|
-
** in place the mutex routines built into SQLite.)^ ^SQLite makes a copy of
|
|
1994
|
+
** in place of the mutex routines built into SQLite.)^ ^SQLite makes a copy of
|
|
1977
1995
|
** the content of the [sqlite3_mutex_methods] structure before the call to
|
|
1978
1996
|
** [sqlite3_config()] returns. ^If SQLite is compiled with
|
|
1979
1997
|
** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
|
|
@@ -2015,7 +2033,7 @@ struct sqlite3_mem_methods {
|
|
|
2015
2033
|
**
|
|
2016
2034
|
** [[SQLITE_CONFIG_GETPCACHE2]] <dt>SQLITE_CONFIG_GETPCACHE2</dt>
|
|
2017
2035
|
** <dd> ^(The SQLITE_CONFIG_GETPCACHE2 option takes a single argument which
|
|
2018
|
-
** is a pointer to an [sqlite3_pcache_methods2] object. SQLite copies
|
|
2036
|
+
** is a pointer to an [sqlite3_pcache_methods2] object. SQLite copies off
|
|
2019
2037
|
** the current page cache implementation into that object.)^ </dd>
|
|
2020
2038
|
**
|
|
2021
2039
|
** [[SQLITE_CONFIG_LOG]] <dt>SQLITE_CONFIG_LOG</dt>
|
|
@@ -2032,7 +2050,7 @@ struct sqlite3_mem_methods {
|
|
|
2032
2050
|
** the logger function is a copy of the first parameter to the corresponding
|
|
2033
2051
|
** [sqlite3_log()] call and is intended to be a [result code] or an
|
|
2034
2052
|
** [extended result code]. ^The third parameter passed to the logger is
|
|
2035
|
-
** log message after formatting via [sqlite3_snprintf()].
|
|
2053
|
+
** a log message after formatting via [sqlite3_snprintf()].
|
|
2036
2054
|
** The SQLite logging interface is not reentrant; the logger function
|
|
2037
2055
|
** supplied by the application must not invoke any SQLite interface.
|
|
2038
2056
|
** In a multi-threaded application, the application-defined logger
|
|
@@ -2223,7 +2241,7 @@ struct sqlite3_mem_methods {
|
|
|
2223
2241
|
** These constants are the available integer configuration options that
|
|
2224
2242
|
** can be passed as the second parameter to the [sqlite3_db_config()] interface.
|
|
2225
2243
|
**
|
|
2226
|
-
** The [sqlite3_db_config()] interface is a var-args
|
|
2244
|
+
** The [sqlite3_db_config()] interface is a var-args function. It takes a
|
|
2227
2245
|
** variable number of parameters, though always at least two. The number of
|
|
2228
2246
|
** parameters passed into sqlite3_db_config() depends on which of these
|
|
2229
2247
|
** constants is given as the second parameter. This documentation page
|
|
@@ -2335,17 +2353,20 @@ struct sqlite3_mem_methods {
|
|
|
2335
2353
|
**
|
|
2336
2354
|
** [[SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER]]
|
|
2337
2355
|
** <dt>SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER</dt>
|
|
2338
|
-
** <dd> ^This option is used to enable or disable the
|
|
2339
|
-
** [fts3_tokenizer()] function
|
|
2340
|
-
**
|
|
2341
|
-
** There must be two additional arguments.
|
|
2342
|
-
**
|
|
2343
|
-
**
|
|
2344
|
-
**
|
|
2345
|
-
**
|
|
2346
|
-
**
|
|
2347
|
-
**
|
|
2348
|
-
**
|
|
2356
|
+
** <dd> ^This option is used to enable or disable using the
|
|
2357
|
+
** [fts3_tokenizer()] function - part of the [FTS3] full-text search engine
|
|
2358
|
+
** extension - without using bound parameters as the parameters. Doing so
|
|
2359
|
+
** is disabled by default. There must be two additional arguments. The first
|
|
2360
|
+
** argument is an integer. If it is passed 0, then using fts3_tokenizer()
|
|
2361
|
+
** without bound parameters is disabled. If it is passed a positive value,
|
|
2362
|
+
** then calling fts3_tokenizer without bound parameters is enabled. If it
|
|
2363
|
+
** is passed a negative value, this setting is not modified - this can be
|
|
2364
|
+
** used to query for the current setting. The second parameter is a pointer
|
|
2365
|
+
** to an integer into which is written 0 or 1 to indicate the current value
|
|
2366
|
+
** of this setting (after it is modified, if applicable). The second
|
|
2367
|
+
** parameter may be a NULL pointer, in which case the value of the setting
|
|
2368
|
+
** is not reported back. Refer to [FTS3] documentation for further details.
|
|
2369
|
+
** </dd>
|
|
2349
2370
|
**
|
|
2350
2371
|
** [[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION]]
|
|
2351
2372
|
** <dt>SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION</dt>
|
|
@@ -2357,8 +2378,8 @@ struct sqlite3_mem_methods {
|
|
|
2357
2378
|
** When the first argument to this interface is 1, then only the C-API is
|
|
2358
2379
|
** enabled and the SQL function remains disabled. If the first argument to
|
|
2359
2380
|
** this interface is 0, then both the C-API and the SQL function are disabled.
|
|
2360
|
-
** If the first argument is -1, then no changes are made to state of either
|
|
2361
|
-
** C-API or the SQL function.
|
|
2381
|
+
** If the first argument is -1, then no changes are made to the state of either
|
|
2382
|
+
** the C-API or the SQL function.
|
|
2362
2383
|
** The second parameter is a pointer to an integer into which
|
|
2363
2384
|
** is written 0 or 1 to indicate whether [sqlite3_load_extension()] interface
|
|
2364
2385
|
** is disabled or enabled following this call. The second parameter may
|
|
@@ -2476,7 +2497,7 @@ struct sqlite3_mem_methods {
|
|
|
2476
2497
|
** [[SQLITE_DBCONFIG_LEGACY_ALTER_TABLE]]
|
|
2477
2498
|
** <dt>SQLITE_DBCONFIG_LEGACY_ALTER_TABLE</dt>
|
|
2478
2499
|
** <dd>The SQLITE_DBCONFIG_LEGACY_ALTER_TABLE option activates or deactivates
|
|
2479
|
-
** the legacy behavior of the [ALTER TABLE RENAME] command such it
|
|
2500
|
+
** the legacy behavior of the [ALTER TABLE RENAME] command such that it
|
|
2480
2501
|
** behaves as it did prior to [version 3.24.0] (2018-06-04). See the
|
|
2481
2502
|
** "Compatibility Notice" on the [ALTER TABLE RENAME documentation] for
|
|
2482
2503
|
** additional information. This feature can also be turned on and off
|
|
@@ -2525,7 +2546,7 @@ struct sqlite3_mem_methods {
|
|
|
2525
2546
|
** <dt>SQLITE_DBCONFIG_LEGACY_FILE_FORMAT</dt>
|
|
2526
2547
|
** <dd>The SQLITE_DBCONFIG_LEGACY_FILE_FORMAT option activates or deactivates
|
|
2527
2548
|
** the legacy file format flag. When activated, this flag causes all newly
|
|
2528
|
-
** created database
|
|
2549
|
+
** created database files to have a schema format version number (the 4-byte
|
|
2529
2550
|
** integer found at offset 44 into the database header) of 1. This in turn
|
|
2530
2551
|
** means that the resulting database file will be readable and writable by
|
|
2531
2552
|
** any SQLite version back to 3.0.0 ([dateof:3.0.0]). Without this setting,
|
|
@@ -2552,7 +2573,7 @@ struct sqlite3_mem_methods {
|
|
|
2552
2573
|
** the database handle both when the SQL statement is prepared and when it
|
|
2553
2574
|
** is stepped. The flag is set (collection of statistics is enabled)
|
|
2554
2575
|
** by default. <p>This option takes two arguments: an integer and a pointer to
|
|
2555
|
-
** an integer
|
|
2576
|
+
** an integer. The first argument is 1, 0, or -1 to enable, disable, or
|
|
2556
2577
|
** leave unchanged the statement scanstatus option. If the second argument
|
|
2557
2578
|
** is not NULL, then the value of the statement scanstatus setting after
|
|
2558
2579
|
** processing the first argument is written into the integer that the second
|
|
@@ -2595,8 +2616,8 @@ struct sqlite3_mem_methods {
|
|
|
2595
2616
|
** <dd>The SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE option enables or disables the
|
|
2596
2617
|
** ability of the [ATTACH DATABASE] SQL command to open a database for writing.
|
|
2597
2618
|
** This capability is enabled by default. Applications can disable or
|
|
2598
|
-
** reenable this capability using the current DBCONFIG option. If
|
|
2599
|
-
**
|
|
2619
|
+
** reenable this capability using the current DBCONFIG option. If
|
|
2620
|
+
** this capability is disabled, the [ATTACH] command will still work,
|
|
2600
2621
|
** but the database will be opened read-only. If this option is disabled,
|
|
2601
2622
|
** then the ability to create a new database using [ATTACH] is also disabled,
|
|
2602
2623
|
** regardless of the value of the [SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE]
|
|
@@ -2630,7 +2651,7 @@ struct sqlite3_mem_methods {
|
|
|
2630
2651
|
**
|
|
2631
2652
|
** <p>Most of the SQLITE_DBCONFIG options take two arguments, so that the
|
|
2632
2653
|
** overall call to [sqlite3_db_config()] has a total of four parameters.
|
|
2633
|
-
** The first argument (the third parameter to sqlite3_db_config()) is
|
|
2654
|
+
** The first argument (the third parameter to sqlite3_db_config()) is an integer.
|
|
2634
2655
|
** The second argument is a pointer to an integer. If the first argument is 1,
|
|
2635
2656
|
** then the option becomes enabled. If the first integer argument is 0, then the
|
|
2636
2657
|
** option is disabled. If the first argument is -1, then the option setting
|
|
@@ -2920,7 +2941,7 @@ SQLITE_API int sqlite3_is_interrupted(sqlite3*);
|
|
|
2920
2941
|
** ^These routines return 0 if the statement is incomplete. ^If a
|
|
2921
2942
|
** memory allocation fails, then SQLITE_NOMEM is returned.
|
|
2922
2943
|
**
|
|
2923
|
-
** ^These routines do not parse the SQL statements thus
|
|
2944
|
+
** ^These routines do not parse the SQL statements and thus
|
|
2924
2945
|
** will not detect syntactically incorrect SQL.
|
|
2925
2946
|
**
|
|
2926
2947
|
** ^(If SQLite has not been initialized using [sqlite3_initialize()] prior
|
|
@@ -3037,7 +3058,7 @@ SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms);
|
|
|
3037
3058
|
** indefinitely if possible. The results of passing any other negative value
|
|
3038
3059
|
** are undefined.
|
|
3039
3060
|
**
|
|
3040
|
-
** Internally, each SQLite database handle
|
|
3061
|
+
** Internally, each SQLite database handle stores two timeout values - the
|
|
3041
3062
|
** busy-timeout (used for rollback mode databases, or if the VFS does not
|
|
3042
3063
|
** support blocking locks) and the setlk-timeout (used for blocking locks
|
|
3043
3064
|
** on wal-mode databases). The sqlite3_busy_timeout() method sets both
|
|
@@ -3067,7 +3088,7 @@ SQLITE_API int sqlite3_setlk_timeout(sqlite3*, int ms, int flags);
|
|
|
3067
3088
|
** This is a legacy interface that is preserved for backwards compatibility.
|
|
3068
3089
|
** Use of this interface is not recommended.
|
|
3069
3090
|
**
|
|
3070
|
-
** Definition: A <b>result table</b> is memory data structure created by the
|
|
3091
|
+
** Definition: A <b>result table</b> is a memory data structure created by the
|
|
3071
3092
|
** [sqlite3_get_table()] interface. A result table records the
|
|
3072
3093
|
** complete query results from one or more queries.
|
|
3073
3094
|
**
|
|
@@ -3210,7 +3231,7 @@ SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list);
|
|
|
3210
3231
|
** ^Calling sqlite3_free() with a pointer previously returned
|
|
3211
3232
|
** by sqlite3_malloc() or sqlite3_realloc() releases that memory so
|
|
3212
3233
|
** that it might be reused. ^The sqlite3_free() routine is
|
|
3213
|
-
** a no-op if is called with a NULL pointer. Passing a NULL pointer
|
|
3234
|
+
** a no-op if it is called with a NULL pointer. Passing a NULL pointer
|
|
3214
3235
|
** to sqlite3_free() is harmless. After being freed, memory
|
|
3215
3236
|
** should neither be read nor written. Even reading previously freed
|
|
3216
3237
|
** memory might result in a segmentation fault or other severe error.
|
|
@@ -3228,13 +3249,13 @@ SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list);
|
|
|
3228
3249
|
** sqlite3_free(X).
|
|
3229
3250
|
** ^sqlite3_realloc(X,N) returns a pointer to a memory allocation
|
|
3230
3251
|
** of at least N bytes in size or NULL if insufficient memory is available.
|
|
3231
|
-
** ^If M is the size of the prior allocation, then min(N,M) bytes
|
|
3232
|
-
**
|
|
3252
|
+
** ^If M is the size of the prior allocation, then min(N,M) bytes of the
|
|
3253
|
+
** prior allocation are copied into the beginning of the buffer returned
|
|
3233
3254
|
** by sqlite3_realloc(X,N) and the prior allocation is freed.
|
|
3234
3255
|
** ^If sqlite3_realloc(X,N) returns NULL and N is positive, then the
|
|
3235
3256
|
** prior allocation is not freed.
|
|
3236
3257
|
**
|
|
3237
|
-
** ^The sqlite3_realloc64(X,N)
|
|
3258
|
+
** ^The sqlite3_realloc64(X,N) interface works the same as
|
|
3238
3259
|
** sqlite3_realloc(X,N) except that N is a 64-bit unsigned integer instead
|
|
3239
3260
|
** of a 32-bit signed integer.
|
|
3240
3261
|
**
|
|
@@ -3284,7 +3305,7 @@ SQLITE_API sqlite3_uint64 sqlite3_msize(void*);
|
|
|
3284
3305
|
** was last reset. ^The values returned by [sqlite3_memory_used()] and
|
|
3285
3306
|
** [sqlite3_memory_highwater()] include any overhead
|
|
3286
3307
|
** added by SQLite in its implementation of [sqlite3_malloc()],
|
|
3287
|
-
** but not overhead added by
|
|
3308
|
+
** but not overhead added by any underlying system library
|
|
3288
3309
|
** routines that [sqlite3_malloc()] may call.
|
|
3289
3310
|
**
|
|
3290
3311
|
** ^The memory high-water mark is reset to the current value of
|
|
@@ -3736,7 +3757,7 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
|
|
|
3736
3757
|
** there is no harm in trying.)
|
|
3737
3758
|
**
|
|
3738
3759
|
** ^(<dt>[SQLITE_OPEN_SHAREDCACHE]</dt>
|
|
3739
|
-
** <dd>The database is opened [shared cache] enabled, overriding
|
|
3760
|
+
** <dd>The database is opened with [shared cache] enabled, overriding
|
|
3740
3761
|
** the default shared cache setting provided by
|
|
3741
3762
|
** [sqlite3_enable_shared_cache()].)^
|
|
3742
3763
|
** The [use of shared cache mode is discouraged] and hence shared cache
|
|
@@ -3744,7 +3765,7 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
|
|
|
3744
3765
|
** this option is a no-op.
|
|
3745
3766
|
**
|
|
3746
3767
|
** ^(<dt>[SQLITE_OPEN_PRIVATECACHE]</dt>
|
|
3747
|
-
** <dd>The database is opened [shared cache] disabled, overriding
|
|
3768
|
+
** <dd>The database is opened with [shared cache] disabled, overriding
|
|
3748
3769
|
** the default shared cache setting provided by
|
|
3749
3770
|
** [sqlite3_enable_shared_cache()].)^
|
|
3750
3771
|
**
|
|
@@ -4079,7 +4100,7 @@ SQLITE_API sqlite3_file *sqlite3_database_file_object(const char*);
|
|
|
4079
4100
|
**
|
|
4080
4101
|
** The sqlite3_create_filename(D,J,W,N,P) allocates memory to hold a version of
|
|
4081
4102
|
** database filename D with corresponding journal file J and WAL file W and
|
|
4082
|
-
**
|
|
4103
|
+
** an array P of N URI Key/Value pairs. The result from
|
|
4083
4104
|
** sqlite3_create_filename(D,J,W,N,P) is a pointer to a database filename that
|
|
4084
4105
|
** is safe to pass to routines like:
|
|
4085
4106
|
** <ul>
|
|
@@ -4162,7 +4183,7 @@ SQLITE_API void sqlite3_free_filename(sqlite3_filename);
|
|
|
4162
4183
|
** subsequent calls to other SQLite interface functions.)^
|
|
4163
4184
|
**
|
|
4164
4185
|
** ^The sqlite3_errstr(E) interface returns the English-language text
|
|
4165
|
-
** that describes the [result code] E, as UTF-8, or NULL if E is not
|
|
4186
|
+
** that describes the [result code] E, as UTF-8, or NULL if E is not a
|
|
4166
4187
|
** result code for which a text error message is available.
|
|
4167
4188
|
** ^(Memory to hold the error message string is managed internally
|
|
4168
4189
|
** and must not be freed by the application)^.
|
|
@@ -4170,7 +4191,7 @@ SQLITE_API void sqlite3_free_filename(sqlite3_filename);
|
|
|
4170
4191
|
** ^If the most recent error references a specific token in the input
|
|
4171
4192
|
** SQL, the sqlite3_error_offset() interface returns the byte offset
|
|
4172
4193
|
** of the start of that token. ^The byte offset returned by
|
|
4173
|
-
** sqlite3_error_offset() assumes that the input SQL is
|
|
4194
|
+
** sqlite3_error_offset() assumes that the input SQL is UTF-8.
|
|
4174
4195
|
** ^If the most recent error does not reference a specific token in the input
|
|
4175
4196
|
** SQL, then the sqlite3_error_offset() function returns -1.
|
|
4176
4197
|
**
|
|
@@ -4195,6 +4216,34 @@ SQLITE_API const void *sqlite3_errmsg16(sqlite3*);
|
|
|
4195
4216
|
SQLITE_API const char *sqlite3_errstr(int);
|
|
4196
4217
|
SQLITE_API int sqlite3_error_offset(sqlite3 *db);
|
|
4197
4218
|
|
|
4219
|
+
/*
|
|
4220
|
+
** CAPI3REF: Set Error Codes And Message
|
|
4221
|
+
** METHOD: sqlite3
|
|
4222
|
+
**
|
|
4223
|
+
** Set the error code of the database handle passed as the first argument
|
|
4224
|
+
** to errcode, and the error message to a copy of nul-terminated string
|
|
4225
|
+
** zErrMsg. If zErrMsg is passed NULL, then the error message is set to
|
|
4226
|
+
** the default message associated with the supplied error code. Subsequent
|
|
4227
|
+
** calls to [sqlite3_errcode()] and [sqlite3_errmsg()] and similar will
|
|
4228
|
+
** return the values set by this routine in place of what was previously
|
|
4229
|
+
** set by SQLite itself.
|
|
4230
|
+
**
|
|
4231
|
+
** This function returns SQLITE_OK if the error code and error message are
|
|
4232
|
+
** successfully set, SQLITE_NOMEM if an OOM occurs, and SQLITE_MISUSE if
|
|
4233
|
+
** the database handle is NULL or invalid.
|
|
4234
|
+
**
|
|
4235
|
+
** The error code and message set by this routine remains in effect until
|
|
4236
|
+
** they are changed, either by another call to this routine or until they are
|
|
4237
|
+
** changed to by SQLite itself to reflect the result of some subsquent
|
|
4238
|
+
** API call.
|
|
4239
|
+
**
|
|
4240
|
+
** This function is intended for use by SQLite extensions or wrappers. The
|
|
4241
|
+
** idea is that an extension or wrapper can use this routine to set error
|
|
4242
|
+
** messages and error codes and thus behave more like a core SQLite
|
|
4243
|
+
** feature from the point of view of an application.
|
|
4244
|
+
*/
|
|
4245
|
+
SQLITE_API int sqlite3_set_errmsg(sqlite3 *db, int errcode, const char *zErrMsg);
|
|
4246
|
+
|
|
4198
4247
|
/*
|
|
4199
4248
|
** CAPI3REF: Prepared Statement Object
|
|
4200
4249
|
** KEYWORDS: {prepared statement} {prepared statements}
|
|
@@ -4269,8 +4318,8 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
|
|
|
4269
4318
|
**
|
|
4270
4319
|
** These constants define various performance limits
|
|
4271
4320
|
** that can be lowered at run-time using [sqlite3_limit()].
|
|
4272
|
-
**
|
|
4273
|
-
**
|
|
4321
|
+
** A concise description of these limits follows, and additional information
|
|
4322
|
+
** is available at [limits | Limits in SQLite].
|
|
4274
4323
|
**
|
|
4275
4324
|
** <dl>
|
|
4276
4325
|
** [[SQLITE_LIMIT_LENGTH]] ^(<dt>SQLITE_LIMIT_LENGTH</dt>
|
|
@@ -4335,7 +4384,7 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
|
|
|
4335
4384
|
/*
|
|
4336
4385
|
** CAPI3REF: Prepare Flags
|
|
4337
4386
|
**
|
|
4338
|
-
** These constants define various flags that can be passed into
|
|
4387
|
+
** These constants define various flags that can be passed into the
|
|
4339
4388
|
** "prepFlags" parameter of the [sqlite3_prepare_v3()] and
|
|
4340
4389
|
** [sqlite3_prepare16_v3()] interfaces.
|
|
4341
4390
|
**
|
|
@@ -4422,7 +4471,7 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
|
|
|
4422
4471
|
** there is a small performance advantage to passing an nByte parameter that
|
|
4423
4472
|
** is the number of bytes in the input string <i>including</i>
|
|
4424
4473
|
** the nul-terminator.
|
|
4425
|
-
** Note that nByte
|
|
4474
|
+
** Note that nByte measures the length of the input in bytes, not
|
|
4426
4475
|
** characters, even for the UTF-16 interfaces.
|
|
4427
4476
|
**
|
|
4428
4477
|
** ^If pzTail is not NULL then *pzTail is made to point to the first byte
|
|
@@ -4556,7 +4605,7 @@ SQLITE_API int sqlite3_prepare16_v3(
|
|
|
4556
4605
|
**
|
|
4557
4606
|
** ^The sqlite3_expanded_sql() interface returns NULL if insufficient memory
|
|
4558
4607
|
** is available to hold the result, or if the result would exceed the
|
|
4559
|
-
**
|
|
4608
|
+
** maximum string length determined by the [SQLITE_LIMIT_LENGTH].
|
|
4560
4609
|
**
|
|
4561
4610
|
** ^The [SQLITE_TRACE_SIZE_LIMIT] compile-time option limits the size of
|
|
4562
4611
|
** bound parameter expansions. ^The [SQLITE_OMIT_TRACE] compile-time
|
|
@@ -4744,7 +4793,7 @@ typedef struct sqlite3_value sqlite3_value;
|
|
|
4744
4793
|
**
|
|
4745
4794
|
** The context in which an SQL function executes is stored in an
|
|
4746
4795
|
** sqlite3_context object. ^A pointer to an sqlite3_context object
|
|
4747
|
-
** is always first parameter to [application-defined SQL functions].
|
|
4796
|
+
** is always the first parameter to [application-defined SQL functions].
|
|
4748
4797
|
** The application-defined SQL function implementation will pass this
|
|
4749
4798
|
** pointer through into calls to [sqlite3_result_int | sqlite3_result()],
|
|
4750
4799
|
** [sqlite3_aggregate_context()], [sqlite3_user_data()],
|
|
@@ -4760,7 +4809,7 @@ typedef struct sqlite3_context sqlite3_context;
|
|
|
4760
4809
|
** METHOD: sqlite3_stmt
|
|
4761
4810
|
**
|
|
4762
4811
|
** ^(In the SQL statement text input to [sqlite3_prepare_v2()] and its variants,
|
|
4763
|
-
** literals may be replaced by a [parameter] that matches one of following
|
|
4812
|
+
** literals may be replaced by a [parameter] that matches one of the following
|
|
4764
4813
|
** templates:
|
|
4765
4814
|
**
|
|
4766
4815
|
** <ul>
|
|
@@ -4805,7 +4854,7 @@ typedef struct sqlite3_context sqlite3_context;
|
|
|
4805
4854
|
**
|
|
4806
4855
|
** [[byte-order determination rules]] ^The byte-order of
|
|
4807
4856
|
** UTF16 input text is determined by the byte-order mark (BOM, U+FEFF)
|
|
4808
|
-
** found in first character, which is removed, or in the absence of a BOM
|
|
4857
|
+
** found in the first character, which is removed, or in the absence of a BOM
|
|
4809
4858
|
** the byte order is the native byte order of the host
|
|
4810
4859
|
** machine for sqlite3_bind_text16() or the byte order specified in
|
|
4811
4860
|
** the 6th parameter for sqlite3_bind_text64().)^
|
|
@@ -4825,7 +4874,7 @@ typedef struct sqlite3_context sqlite3_context;
|
|
|
4825
4874
|
** or sqlite3_bind_text16() or sqlite3_bind_text64() then
|
|
4826
4875
|
** that parameter must be the byte offset
|
|
4827
4876
|
** where the NUL terminator would occur assuming the string were NUL
|
|
4828
|
-
** terminated. If any NUL characters
|
|
4877
|
+
** terminated. If any NUL characters occur at byte offsets less than
|
|
4829
4878
|
** the value of the fourth parameter then the resulting string value will
|
|
4830
4879
|
** contain embedded NULs. The result of expressions involving strings
|
|
4831
4880
|
** with embedded NULs is undefined.
|
|
@@ -4868,9 +4917,11 @@ typedef struct sqlite3_context sqlite3_context;
|
|
|
4868
4917
|
** associated with the pointer P of type T. ^D is either a NULL pointer or
|
|
4869
4918
|
** a pointer to a destructor function for P. ^SQLite will invoke the
|
|
4870
4919
|
** destructor D with a single argument of P when it is finished using
|
|
4871
|
-
** P
|
|
4872
|
-
**
|
|
4873
|
-
**
|
|
4920
|
+
** P, even if the call to sqlite3_bind_pointer() fails. Due to a
|
|
4921
|
+
** historical design quirk, results are undefined if D is
|
|
4922
|
+
** SQLITE_TRANSIENT. The T parameter should be a static string,
|
|
4923
|
+
** preferably a string literal. The sqlite3_bind_pointer() routine is
|
|
4924
|
+
** part of the [pointer passing interface] added for SQLite 3.20.0.
|
|
4874
4925
|
**
|
|
4875
4926
|
** ^If any of the sqlite3_bind_*() routines are called with a NULL pointer
|
|
4876
4927
|
** for the [prepared statement] or with a prepared statement for which
|
|
@@ -5037,7 +5088,7 @@ SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt*, int N);
|
|
|
5037
5088
|
** METHOD: sqlite3_stmt
|
|
5038
5089
|
**
|
|
5039
5090
|
** ^These routines provide a means to determine the database, table, and
|
|
5040
|
-
** table column that is the origin of a particular result column in
|
|
5091
|
+
** table column that is the origin of a particular result column in a
|
|
5041
5092
|
** [SELECT] statement.
|
|
5042
5093
|
** ^The name of the database or table or column can be returned as
|
|
5043
5094
|
** either a UTF-8 or UTF-16 string. ^The _database_ routines return
|
|
@@ -5481,7 +5532,7 @@ SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol);
|
|
|
5481
5532
|
**
|
|
5482
5533
|
** ^The sqlite3_finalize() function is called to delete a [prepared statement].
|
|
5483
5534
|
** ^If the most recent evaluation of the statement encountered no errors
|
|
5484
|
-
** or if the statement
|
|
5535
|
+
** or if the statement has never been evaluated, then sqlite3_finalize() returns
|
|
5485
5536
|
** SQLITE_OK. ^If the most recent evaluation of statement S failed, then
|
|
5486
5537
|
** sqlite3_finalize(S) returns the appropriate [error code] or
|
|
5487
5538
|
** [extended error code].
|
|
@@ -5606,8 +5657,8 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
|
|
|
5606
5657
|
**
|
|
5607
5658
|
** For best security, the [SQLITE_DIRECTONLY] flag is recommended for
|
|
5608
5659
|
** all application-defined SQL functions that do not need to be
|
|
5609
|
-
** used inside of triggers,
|
|
5610
|
-
** the database schema. This
|
|
5660
|
+
** used inside of triggers, views, CHECK constraints, or other elements of
|
|
5661
|
+
** the database schema. This flag is especially recommended for SQL
|
|
5611
5662
|
** functions that have side effects or reveal internal application state.
|
|
5612
5663
|
** Without this flag, an attacker might be able to modify the schema of
|
|
5613
5664
|
** a database file to include invocations of the function with parameters
|
|
@@ -5638,7 +5689,7 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
|
|
|
5638
5689
|
** [user-defined window functions|available here].
|
|
5639
5690
|
**
|
|
5640
5691
|
** ^(If the final parameter to sqlite3_create_function_v2() or
|
|
5641
|
-
** sqlite3_create_window_function() is not NULL, then it is destructor for
|
|
5692
|
+
** sqlite3_create_window_function() is not NULL, then it is the destructor for
|
|
5642
5693
|
** the application data pointer. The destructor is invoked when the function
|
|
5643
5694
|
** is deleted, either by being overloaded or when the database connection
|
|
5644
5695
|
** closes.)^ ^The destructor is also invoked if the call to
|
|
@@ -5713,7 +5764,7 @@ SQLITE_API int sqlite3_create_window_function(
|
|
|
5713
5764
|
/*
|
|
5714
5765
|
** CAPI3REF: Text Encodings
|
|
5715
5766
|
**
|
|
5716
|
-
** These
|
|
5767
|
+
** These constants define integer codes that represent the various
|
|
5717
5768
|
** text encodings supported by SQLite.
|
|
5718
5769
|
*/
|
|
5719
5770
|
#define SQLITE_UTF8 1 /* IMP: R-37514-35566 */
|
|
@@ -5805,7 +5856,7 @@ SQLITE_API int sqlite3_create_window_function(
|
|
|
5805
5856
|
** result.
|
|
5806
5857
|
** Every function that invokes [sqlite3_result_subtype()] should have this
|
|
5807
5858
|
** property. If it does not, then the call to [sqlite3_result_subtype()]
|
|
5808
|
-
** might become a no-op if the function is used as term in an
|
|
5859
|
+
** might become a no-op if the function is used as a term in an
|
|
5809
5860
|
** [expression index]. On the other hand, SQL functions that never invoke
|
|
5810
5861
|
** [sqlite3_result_subtype()] should avoid setting this property, as the
|
|
5811
5862
|
** purpose of this property is to disable certain optimizations that are
|
|
@@ -5932,7 +5983,7 @@ SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int6
|
|
|
5932
5983
|
** sqlite3_value_nochange(X) interface returns true if and only if
|
|
5933
5984
|
** the column corresponding to X is unchanged by the UPDATE operation
|
|
5934
5985
|
** that the xUpdate method call was invoked to implement and if
|
|
5935
|
-
**
|
|
5986
|
+
** the prior [xColumn] method call that was invoked to extract
|
|
5936
5987
|
** the value for that column returned without setting a result (probably
|
|
5937
5988
|
** because it queried [sqlite3_vtab_nochange()] and found that the column
|
|
5938
5989
|
** was unchanging). ^Within an [xUpdate] method, any value for which
|
|
@@ -6038,7 +6089,7 @@ SQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value*);
|
|
|
6038
6089
|
** METHOD: sqlite3_value
|
|
6039
6090
|
**
|
|
6040
6091
|
** ^The sqlite3_value_dup(V) interface makes a copy of the [sqlite3_value]
|
|
6041
|
-
** object
|
|
6092
|
+
** object V and returns a pointer to that copy. ^The [sqlite3_value] returned
|
|
6042
6093
|
** is a [protected sqlite3_value] object even if the input is not.
|
|
6043
6094
|
** ^The sqlite3_value_dup(V) interface returns NULL if V is NULL or if a
|
|
6044
6095
|
** memory allocation fails. ^If V is a [pointer value], then the result
|
|
@@ -6076,7 +6127,7 @@ SQLITE_API void sqlite3_value_free(sqlite3_value*);
|
|
|
6076
6127
|
** allocation error occurs.
|
|
6077
6128
|
**
|
|
6078
6129
|
** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is
|
|
6079
|
-
** determined by the N parameter on first successful call. Changing the
|
|
6130
|
+
** determined by the N parameter on the first successful call. Changing the
|
|
6080
6131
|
** value of N in any subsequent call to sqlite3_aggregate_context() within
|
|
6081
6132
|
** the same aggregate function instance will not resize the memory
|
|
6082
6133
|
** allocation.)^ Within the xFinal callback, it is customary to set
|
|
@@ -6205,6 +6256,7 @@ SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(voi
|
|
|
6205
6256
|
** or a NULL pointer if there were no prior calls to
|
|
6206
6257
|
** sqlite3_set_clientdata() with the same values of D and N.
|
|
6207
6258
|
** Names are compared using strcmp() and are thus case sensitive.
|
|
6259
|
+
** It returns 0 on success and SQLITE_NOMEM on allocation failure.
|
|
6208
6260
|
**
|
|
6209
6261
|
** If P and X are both non-NULL, then the destructor X is invoked with
|
|
6210
6262
|
** argument P on the first of the following occurrences:
|
|
@@ -6238,7 +6290,7 @@ SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(voi
|
|
|
6238
6290
|
**
|
|
6239
6291
|
** Security Warning: These interfaces should not be exposed in scripting
|
|
6240
6292
|
** languages or in other circumstances where it might be possible for an
|
|
6241
|
-
**
|
|
6293
|
+
** attacker to invoke them. Any agent that can invoke these interfaces
|
|
6242
6294
|
** can probably also take control of the process.
|
|
6243
6295
|
**
|
|
6244
6296
|
** Database connection client data is only available for SQLite
|
|
@@ -6352,7 +6404,7 @@ typedef void (*sqlite3_destructor_type)(void*);
|
|
|
6352
6404
|
** pointed to by the 2nd parameter are taken as the application-defined
|
|
6353
6405
|
** function result. If the 3rd parameter is non-negative, then it
|
|
6354
6406
|
** must be the byte offset into the string where the NUL terminator would
|
|
6355
|
-
** appear if the string
|
|
6407
|
+
** appear if the string were NUL terminated. If any NUL characters occur
|
|
6356
6408
|
** in the string at a byte offset that is less than the value of the 3rd
|
|
6357
6409
|
** parameter, then the resulting string will contain embedded NULs and the
|
|
6358
6410
|
** result of expressions operating on strings with embedded NULs is undefined.
|
|
@@ -6410,7 +6462,7 @@ typedef void (*sqlite3_destructor_type)(void*);
|
|
|
6410
6462
|
** string and preferably a string literal. The sqlite3_result_pointer()
|
|
6411
6463
|
** routine is part of the [pointer passing interface] added for SQLite 3.20.0.
|
|
6412
6464
|
**
|
|
6413
|
-
** If these routines are called from within
|
|
6465
|
+
** If these routines are called from within a different thread
|
|
6414
6466
|
** than the one containing the application-defined function that received
|
|
6415
6467
|
** the [sqlite3_context] pointer, the results are undefined.
|
|
6416
6468
|
*/
|
|
@@ -6816,7 +6868,7 @@ SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*);
|
|
|
6816
6868
|
** METHOD: sqlite3
|
|
6817
6869
|
**
|
|
6818
6870
|
** ^The sqlite3_db_name(D,N) interface returns a pointer to the schema name
|
|
6819
|
-
** for the N-th database on database connection D, or a NULL pointer
|
|
6871
|
+
** for the N-th database on database connection D, or a NULL pointer if N is
|
|
6820
6872
|
** out of range. An N value of 0 means the main database file. An N of 1 is
|
|
6821
6873
|
** the "temp" schema. Larger values of N correspond to various ATTACH-ed
|
|
6822
6874
|
** databases.
|
|
@@ -6911,7 +6963,7 @@ SQLITE_API int sqlite3_txn_state(sqlite3*,const char *zSchema);
|
|
|
6911
6963
|
** <dd>The SQLITE_TXN_READ state means that the database is currently
|
|
6912
6964
|
** in a read transaction. Content has been read from the database file
|
|
6913
6965
|
** but nothing in the database file has changed. The transaction state
|
|
6914
|
-
** will advanced to SQLITE_TXN_WRITE if any changes occur and there are
|
|
6966
|
+
** will be advanced to SQLITE_TXN_WRITE if any changes occur and there are
|
|
6915
6967
|
** no other conflicting concurrent write transactions. The transaction
|
|
6916
6968
|
** state will revert to SQLITE_TXN_NONE following a [ROLLBACK] or
|
|
6917
6969
|
** [COMMIT].</dd>
|
|
@@ -6920,7 +6972,7 @@ SQLITE_API int sqlite3_txn_state(sqlite3*,const char *zSchema);
|
|
|
6920
6972
|
** <dd>The SQLITE_TXN_WRITE state means that the database is currently
|
|
6921
6973
|
** in a write transaction. Content has been written to the database file
|
|
6922
6974
|
** but has not yet committed. The transaction state will change to
|
|
6923
|
-
**
|
|
6975
|
+
** SQLITE_TXN_NONE at the next [ROLLBACK] or [COMMIT].</dd>
|
|
6924
6976
|
*/
|
|
6925
6977
|
#define SQLITE_TXN_NONE 0
|
|
6926
6978
|
#define SQLITE_TXN_READ 1
|
|
@@ -7201,7 +7253,7 @@ SQLITE_API int sqlite3_db_release_memory(sqlite3*);
|
|
|
7201
7253
|
** CAPI3REF: Impose A Limit On Heap Size
|
|
7202
7254
|
**
|
|
7203
7255
|
** These interfaces impose limits on the amount of heap memory that will be
|
|
7204
|
-
** by all database connections within a single process.
|
|
7256
|
+
** used by all database connections within a single process.
|
|
7205
7257
|
**
|
|
7206
7258
|
** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the
|
|
7207
7259
|
** soft limit on the amount of heap memory that may be allocated by SQLite.
|
|
@@ -7259,7 +7311,7 @@ SQLITE_API int sqlite3_db_release_memory(sqlite3*);
|
|
|
7259
7311
|
** </ul>)^
|
|
7260
7312
|
**
|
|
7261
7313
|
** The circumstances under which SQLite will enforce the heap limits may
|
|
7262
|
-
**
|
|
7314
|
+
** change in future releases of SQLite.
|
|
7263
7315
|
*/
|
|
7264
7316
|
SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N);
|
|
7265
7317
|
SQLITE_API sqlite3_int64 sqlite3_hard_heap_limit64(sqlite3_int64 N);
|
|
@@ -7374,8 +7426,8 @@ SQLITE_API int sqlite3_table_column_metadata(
|
|
|
7374
7426
|
** ^The entry point is zProc.
|
|
7375
7427
|
** ^(zProc may be 0, in which case SQLite will try to come up with an
|
|
7376
7428
|
** entry point name on its own. It first tries "sqlite3_extension_init".
|
|
7377
|
-
** If that does not work, it constructs a name "sqlite3_X_init" where
|
|
7378
|
-
** X
|
|
7429
|
+
** If that does not work, it constructs a name "sqlite3_X_init" where
|
|
7430
|
+
** X consists of the lower-case equivalent of all ASCII alphabetic
|
|
7379
7431
|
** characters in the filename from the last "/" to the first following
|
|
7380
7432
|
** "." and omitting any initial "lib".)^
|
|
7381
7433
|
** ^The sqlite3_load_extension() interface returns
|
|
@@ -7446,7 +7498,7 @@ SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff);
|
|
|
7446
7498
|
** ^(Even though the function prototype shows that xEntryPoint() takes
|
|
7447
7499
|
** no arguments and returns void, SQLite invokes xEntryPoint() with three
|
|
7448
7500
|
** arguments and expects an integer result as if the signature of the
|
|
7449
|
-
** entry point
|
|
7501
|
+
** entry point were as follows:
|
|
7450
7502
|
**
|
|
7451
7503
|
** <blockquote><pre>
|
|
7452
7504
|
** int xEntryPoint(
|
|
@@ -7610,7 +7662,7 @@ struct sqlite3_module {
|
|
|
7610
7662
|
** virtual table and might not be checked again by the byte code.)^ ^(The
|
|
7611
7663
|
** aConstraintUsage[].omit flag is an optimization hint. When the omit flag
|
|
7612
7664
|
** is left in its default setting of false, the constraint will always be
|
|
7613
|
-
** checked separately in byte code. If the omit flag is
|
|
7665
|
+
** checked separately in byte code. If the omit flag is changed to true, then
|
|
7614
7666
|
** the constraint may or may not be checked in byte code. In other words,
|
|
7615
7667
|
** when the omit flag is true there is no guarantee that the constraint will
|
|
7616
7668
|
** not be checked again using byte code.)^
|
|
@@ -7636,7 +7688,7 @@ struct sqlite3_module {
|
|
|
7636
7688
|
** The xBestIndex method may optionally populate the idxFlags field with a
|
|
7637
7689
|
** mask of SQLITE_INDEX_SCAN_* flags. One such flag is
|
|
7638
7690
|
** [SQLITE_INDEX_SCAN_HEX], which if set causes the [EXPLAIN QUERY PLAN]
|
|
7639
|
-
** output to show the idxNum
|
|
7691
|
+
** output to show the idxNum as hex instead of as decimal. Another flag is
|
|
7640
7692
|
** SQLITE_INDEX_SCAN_UNIQUE, which if set indicates that the query plan will
|
|
7641
7693
|
** return at most one row.
|
|
7642
7694
|
**
|
|
@@ -7777,7 +7829,7 @@ struct sqlite3_index_info {
|
|
|
7777
7829
|
** the implementation of the [virtual table module]. ^The fourth
|
|
7778
7830
|
** parameter is an arbitrary client data pointer that is passed through
|
|
7779
7831
|
** into the [xCreate] and [xConnect] methods of the virtual table module
|
|
7780
|
-
** when a new virtual table is
|
|
7832
|
+
** when a new virtual table is being created or reinitialized.
|
|
7781
7833
|
**
|
|
7782
7834
|
** ^The sqlite3_create_module_v2() interface has a fifth parameter which
|
|
7783
7835
|
** is a pointer to a destructor for the pClientData. ^SQLite will
|
|
@@ -7942,7 +7994,7 @@ typedef struct sqlite3_blob sqlite3_blob;
|
|
|
7942
7994
|
** in *ppBlob. Otherwise an [error code] is returned and, unless the error
|
|
7943
7995
|
** code is SQLITE_MISUSE, *ppBlob is set to NULL.)^ ^This means that, provided
|
|
7944
7996
|
** the API is not misused, it is always safe to call [sqlite3_blob_close()]
|
|
7945
|
-
** on *ppBlob after this function
|
|
7997
|
+
** on *ppBlob after this function returns.
|
|
7946
7998
|
**
|
|
7947
7999
|
** This function fails with SQLITE_ERROR if any of the following are true:
|
|
7948
8000
|
** <ul>
|
|
@@ -8062,7 +8114,7 @@ SQLITE_API int sqlite3_blob_close(sqlite3_blob *);
|
|
|
8062
8114
|
**
|
|
8063
8115
|
** ^Returns the size in bytes of the BLOB accessible via the
|
|
8064
8116
|
** successfully opened [BLOB handle] in its only argument. ^The
|
|
8065
|
-
** incremental blob I/O routines can only read or
|
|
8117
|
+
** incremental blob I/O routines can only read or overwrite existing
|
|
8066
8118
|
** blob content; they cannot change the size of a blob.
|
|
8067
8119
|
**
|
|
8068
8120
|
** This routine only works on a [BLOB handle] which has been created
|
|
@@ -8212,7 +8264,7 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
|
|
|
8212
8264
|
** ^The sqlite3_mutex_alloc() routine allocates a new
|
|
8213
8265
|
** mutex and returns a pointer to it. ^The sqlite3_mutex_alloc()
|
|
8214
8266
|
** routine returns NULL if it is unable to allocate the requested
|
|
8215
|
-
** mutex. The argument to sqlite3_mutex_alloc() must one of these
|
|
8267
|
+
** mutex. The argument to sqlite3_mutex_alloc() must be one of these
|
|
8216
8268
|
** integer constants:
|
|
8217
8269
|
**
|
|
8218
8270
|
** <ul>
|
|
@@ -8445,7 +8497,7 @@ SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*);
|
|
|
8445
8497
|
** CAPI3REF: Retrieve the mutex for a database connection
|
|
8446
8498
|
** METHOD: sqlite3
|
|
8447
8499
|
**
|
|
8448
|
-
** ^This interface returns a pointer the [sqlite3_mutex] object that
|
|
8500
|
+
** ^This interface returns a pointer to the [sqlite3_mutex] object that
|
|
8449
8501
|
** serializes access to the [database connection] given in the argument
|
|
8450
8502
|
** when the [threading mode] is Serialized.
|
|
8451
8503
|
** ^If the [threading mode] is Single-thread or Multi-thread then this
|
|
@@ -8568,7 +8620,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
|
|
|
8568
8620
|
** CAPI3REF: SQL Keyword Checking
|
|
8569
8621
|
**
|
|
8570
8622
|
** These routines provide access to the set of SQL language keywords
|
|
8571
|
-
** recognized by SQLite. Applications can
|
|
8623
|
+
** recognized by SQLite. Applications can use these routines to determine
|
|
8572
8624
|
** whether or not a specific identifier needs to be escaped (for example,
|
|
8573
8625
|
** by enclosing in double-quotes) so as not to confuse the parser.
|
|
8574
8626
|
**
|
|
@@ -8736,7 +8788,7 @@ SQLITE_API void sqlite3_str_reset(sqlite3_str*);
|
|
|
8736
8788
|
** content of the dynamic string under construction in X. The value
|
|
8737
8789
|
** returned by [sqlite3_str_value(X)] is managed by the sqlite3_str object X
|
|
8738
8790
|
** and might be freed or altered by any subsequent method on the same
|
|
8739
|
-
** [sqlite3_str] object. Applications must not
|
|
8791
|
+
** [sqlite3_str] object. Applications must not use the pointer returned by
|
|
8740
8792
|
** [sqlite3_str_value(X)] after any subsequent method call on the same
|
|
8741
8793
|
** object. ^Applications may change the content of the string returned
|
|
8742
8794
|
** by [sqlite3_str_value(X)] as long as they do not write into any bytes
|
|
@@ -8822,7 +8874,7 @@ SQLITE_API int sqlite3_status64(
|
|
|
8822
8874
|
** allocation which could not be satisfied by the [SQLITE_CONFIG_PAGECACHE]
|
|
8823
8875
|
** buffer and where forced to overflow to [sqlite3_malloc()]. The
|
|
8824
8876
|
** returned value includes allocations that overflowed because they
|
|
8825
|
-
**
|
|
8877
|
+
** were too large (they were larger than the "sz" parameter to
|
|
8826
8878
|
** [SQLITE_CONFIG_PAGECACHE]) and allocations that overflowed because
|
|
8827
8879
|
** no space was left in the page cache.</dd>)^
|
|
8828
8880
|
**
|
|
@@ -8881,9 +8933,18 @@ SQLITE_API int sqlite3_status64(
|
|
|
8881
8933
|
** ^The sqlite3_db_status() routine returns SQLITE_OK on success and a
|
|
8882
8934
|
** non-zero [error code] on failure.
|
|
8883
8935
|
**
|
|
8936
|
+
** ^The sqlite3_db_status64(D,O,C,H,R) routine works exactly the same
|
|
8937
|
+
** way as sqlite3_db_status(D,O,C,H,R) routine except that the C and H
|
|
8938
|
+
** parameters are pointer to 64-bit integers (type: sqlite3_int64) instead
|
|
8939
|
+
** of pointers to 32-bit integers, which allows larger status values
|
|
8940
|
+
** to be returned. If a status value exceeds 2,147,483,647 then
|
|
8941
|
+
** sqlite3_db_status() will truncate the value whereas sqlite3_db_status64()
|
|
8942
|
+
** will return the full value.
|
|
8943
|
+
**
|
|
8884
8944
|
** See also: [sqlite3_status()] and [sqlite3_stmt_status()].
|
|
8885
8945
|
*/
|
|
8886
8946
|
SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);
|
|
8947
|
+
SQLITE_API int sqlite3_db_status64(sqlite3*,int,sqlite3_int64*,sqlite3_int64*,int);
|
|
8887
8948
|
|
|
8888
8949
|
/*
|
|
8889
8950
|
** CAPI3REF: Status Parameters for database connections
|
|
@@ -8906,28 +8967,29 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
|
|
|
8906
8967
|
** [[SQLITE_DBSTATUS_LOOKASIDE_HIT]] ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_HIT</dt>
|
|
8907
8968
|
** <dd>This parameter returns the number of malloc attempts that were
|
|
8908
8969
|
** satisfied using lookaside memory. Only the high-water value is meaningful;
|
|
8909
|
-
** the current value is always zero
|
|
8970
|
+
** the current value is always zero.</dd>)^
|
|
8910
8971
|
**
|
|
8911
8972
|
** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE]]
|
|
8912
8973
|
** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE</dt>
|
|
8913
|
-
** <dd>This parameter returns the number malloc attempts that might have
|
|
8974
|
+
** <dd>This parameter returns the number of malloc attempts that might have
|
|
8914
8975
|
** been satisfied using lookaside memory but failed due to the amount of
|
|
8915
8976
|
** memory requested being larger than the lookaside slot size.
|
|
8916
8977
|
** Only the high-water value is meaningful;
|
|
8917
|
-
** the current value is always zero
|
|
8978
|
+
** the current value is always zero.</dd>)^
|
|
8918
8979
|
**
|
|
8919
8980
|
** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL]]
|
|
8920
8981
|
** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL</dt>
|
|
8921
|
-
** <dd>This parameter returns the number malloc attempts that might have
|
|
8982
|
+
** <dd>This parameter returns the number of malloc attempts that might have
|
|
8922
8983
|
** been satisfied using lookaside memory but failed due to all lookaside
|
|
8923
8984
|
** memory already being in use.
|
|
8924
8985
|
** Only the high-water value is meaningful;
|
|
8925
|
-
** the current value is always zero
|
|
8986
|
+
** the current value is always zero.</dd>)^
|
|
8926
8987
|
**
|
|
8927
8988
|
** [[SQLITE_DBSTATUS_CACHE_USED]] ^(<dt>SQLITE_DBSTATUS_CACHE_USED</dt>
|
|
8928
8989
|
** <dd>This parameter returns the approximate number of bytes of heap
|
|
8929
8990
|
** memory used by all pager caches associated with the database connection.)^
|
|
8930
8991
|
** ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED is always 0.
|
|
8992
|
+
** </dd>
|
|
8931
8993
|
**
|
|
8932
8994
|
** [[SQLITE_DBSTATUS_CACHE_USED_SHARED]]
|
|
8933
8995
|
** ^(<dt>SQLITE_DBSTATUS_CACHE_USED_SHARED</dt>
|
|
@@ -8936,10 +8998,10 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
|
|
|
8936
8998
|
** memory used by that pager cache is divided evenly between the attached
|
|
8937
8999
|
** connections.)^ In other words, if none of the pager caches associated
|
|
8938
9000
|
** with the database connection are shared, this request returns the same
|
|
8939
|
-
** value as DBSTATUS_CACHE_USED. Or, if one or more
|
|
9001
|
+
** value as DBSTATUS_CACHE_USED. Or, if one or more of the pager caches are
|
|
8940
9002
|
** shared, the value returned by this call will be smaller than that returned
|
|
8941
9003
|
** by DBSTATUS_CACHE_USED. ^The highwater mark associated with
|
|
8942
|
-
** SQLITE_DBSTATUS_CACHE_USED_SHARED is always 0
|
|
9004
|
+
** SQLITE_DBSTATUS_CACHE_USED_SHARED is always 0.</dd>
|
|
8943
9005
|
**
|
|
8944
9006
|
** [[SQLITE_DBSTATUS_SCHEMA_USED]] ^(<dt>SQLITE_DBSTATUS_SCHEMA_USED</dt>
|
|
8945
9007
|
** <dd>This parameter returns the approximate number of bytes of heap
|
|
@@ -8949,6 +9011,7 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
|
|
|
8949
9011
|
** schema memory is shared with other database connections due to
|
|
8950
9012
|
** [shared cache mode] being enabled.
|
|
8951
9013
|
** ^The highwater mark associated with SQLITE_DBSTATUS_SCHEMA_USED is always 0.
|
|
9014
|
+
** </dd>
|
|
8952
9015
|
**
|
|
8953
9016
|
** [[SQLITE_DBSTATUS_STMT_USED]] ^(<dt>SQLITE_DBSTATUS_STMT_USED</dt>
|
|
8954
9017
|
** <dd>This parameter returns the approximate number of bytes of heap
|
|
@@ -8978,6 +9041,10 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
|
|
|
8978
9041
|
** If an IO or other error occurs while writing a page to disk, the effect
|
|
8979
9042
|
** on subsequent SQLITE_DBSTATUS_CACHE_WRITE requests is undefined.)^ ^The
|
|
8980
9043
|
** highwater mark associated with SQLITE_DBSTATUS_CACHE_WRITE is always 0.
|
|
9044
|
+
** <p>
|
|
9045
|
+
** ^(There is overlap between the quantities measured by this parameter
|
|
9046
|
+
** (SQLITE_DBSTATUS_CACHE_WRITE) and SQLITE_DBSTATUS_TEMPBUF_SPILL.
|
|
9047
|
+
** Resetting one will reduce the other.)^
|
|
8981
9048
|
** </dd>
|
|
8982
9049
|
**
|
|
8983
9050
|
** [[SQLITE_DBSTATUS_CACHE_SPILL]] ^(<dt>SQLITE_DBSTATUS_CACHE_SPILL</dt>
|
|
@@ -8985,7 +9052,7 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
|
|
|
8985
9052
|
** been written to disk in the middle of a transaction due to the page
|
|
8986
9053
|
** cache overflowing. Transactions are more efficient if they are written
|
|
8987
9054
|
** to disk all at once. When pages spill mid-transaction, that introduces
|
|
8988
|
-
** additional overhead. This parameter can be used help identify
|
|
9055
|
+
** additional overhead. This parameter can be used to help identify
|
|
8989
9056
|
** inefficiencies that can be resolved by increasing the cache size.
|
|
8990
9057
|
** </dd>
|
|
8991
9058
|
**
|
|
@@ -8993,6 +9060,18 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
|
|
|
8993
9060
|
** <dd>This parameter returns zero for the current value if and only if
|
|
8994
9061
|
** all foreign key constraints (deferred or immediate) have been
|
|
8995
9062
|
** resolved.)^ ^The highwater mark is always 0.
|
|
9063
|
+
**
|
|
9064
|
+
** [[SQLITE_DBSTATUS_TEMPBUF_SPILL] ^(<dt>SQLITE_DBSTATUS_TEMPBUF_SPILL</dt>
|
|
9065
|
+
** <dd>^(This parameter returns the number of bytes written to temporary
|
|
9066
|
+
** files on disk that could have been kept in memory had sufficient memory
|
|
9067
|
+
** been available. This value includes writes to intermediate tables that
|
|
9068
|
+
** are part of complex queries, external sorts that spill to disk, and
|
|
9069
|
+
** writes to TEMP tables.)^
|
|
9070
|
+
** ^The highwater mark is always 0.
|
|
9071
|
+
** <p>
|
|
9072
|
+
** ^(There is overlap between the quantities measured by this parameter
|
|
9073
|
+
** (SQLITE_DBSTATUS_TEMPBUF_SPILL) and SQLITE_DBSTATUS_CACHE_WRITE.
|
|
9074
|
+
** Resetting one will reduce the other.)^
|
|
8996
9075
|
** </dd>
|
|
8997
9076
|
** </dl>
|
|
8998
9077
|
*/
|
|
@@ -9009,7 +9088,8 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
|
|
|
9009
9088
|
#define SQLITE_DBSTATUS_DEFERRED_FKS 10
|
|
9010
9089
|
#define SQLITE_DBSTATUS_CACHE_USED_SHARED 11
|
|
9011
9090
|
#define SQLITE_DBSTATUS_CACHE_SPILL 12
|
|
9012
|
-
#define
|
|
9091
|
+
#define SQLITE_DBSTATUS_TEMPBUF_SPILL 13
|
|
9092
|
+
#define SQLITE_DBSTATUS_MAX 13 /* Largest defined DBSTATUS */
|
|
9013
9093
|
|
|
9014
9094
|
|
|
9015
9095
|
/*
|
|
@@ -9056,13 +9136,13 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
|
|
|
9056
9136
|
** [[SQLITE_STMTSTATUS_SORT]] <dt>SQLITE_STMTSTATUS_SORT</dt>
|
|
9057
9137
|
** <dd>^This is the number of sort operations that have occurred.
|
|
9058
9138
|
** A non-zero value in this counter may indicate an opportunity to
|
|
9059
|
-
**
|
|
9139
|
+
** improve performance through careful use of indices.</dd>
|
|
9060
9140
|
**
|
|
9061
9141
|
** [[SQLITE_STMTSTATUS_AUTOINDEX]] <dt>SQLITE_STMTSTATUS_AUTOINDEX</dt>
|
|
9062
9142
|
** <dd>^This is the number of rows inserted into transient indices that
|
|
9063
9143
|
** were created automatically in order to help joins run faster.
|
|
9064
9144
|
** A non-zero value in this counter may indicate an opportunity to
|
|
9065
|
-
**
|
|
9145
|
+
** improve performance by adding permanent indices that do not
|
|
9066
9146
|
** need to be reinitialized each time the statement is run.</dd>
|
|
9067
9147
|
**
|
|
9068
9148
|
** [[SQLITE_STMTSTATUS_VM_STEP]] <dt>SQLITE_STMTSTATUS_VM_STEP</dt>
|
|
@@ -9071,19 +9151,19 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
|
|
|
9071
9151
|
** to 2147483647. The number of virtual machine operations can be
|
|
9072
9152
|
** used as a proxy for the total work done by the prepared statement.
|
|
9073
9153
|
** If the number of virtual machine operations exceeds 2147483647
|
|
9074
|
-
** then the value returned by this statement status code is undefined
|
|
9154
|
+
** then the value returned by this statement status code is undefined.</dd>
|
|
9075
9155
|
**
|
|
9076
9156
|
** [[SQLITE_STMTSTATUS_REPREPARE]] <dt>SQLITE_STMTSTATUS_REPREPARE</dt>
|
|
9077
9157
|
** <dd>^This is the number of times that the prepare statement has been
|
|
9078
9158
|
** automatically regenerated due to schema changes or changes to
|
|
9079
|
-
** [bound parameters] that might affect the query plan
|
|
9159
|
+
** [bound parameters] that might affect the query plan.</dd>
|
|
9080
9160
|
**
|
|
9081
9161
|
** [[SQLITE_STMTSTATUS_RUN]] <dt>SQLITE_STMTSTATUS_RUN</dt>
|
|
9082
9162
|
** <dd>^This is the number of times that the prepared statement has
|
|
9083
9163
|
** been run. A single "run" for the purposes of this counter is one
|
|
9084
9164
|
** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()].
|
|
9085
9165
|
** The counter is incremented on the first [sqlite3_step()] call of each
|
|
9086
|
-
** cycle
|
|
9166
|
+
** cycle.</dd>
|
|
9087
9167
|
**
|
|
9088
9168
|
** [[SQLITE_STMTSTATUS_FILTER_MISS]]
|
|
9089
9169
|
** [[SQLITE_STMTSTATUS_FILTER HIT]]
|
|
@@ -9093,7 +9173,7 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
|
|
|
9093
9173
|
** step was bypassed because a Bloom filter returned not-found. The
|
|
9094
9174
|
** corresponding SQLITE_STMTSTATUS_FILTER_MISS value is the number of
|
|
9095
9175
|
** times that the Bloom filter returned a find, and thus the join step
|
|
9096
|
-
** had to be processed as normal
|
|
9176
|
+
** had to be processed as normal.</dd>
|
|
9097
9177
|
**
|
|
9098
9178
|
** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt>
|
|
9099
9179
|
** <dd>^This is the approximate number of bytes of heap memory
|
|
@@ -9198,9 +9278,9 @@ struct sqlite3_pcache_page {
|
|
|
9198
9278
|
** SQLite will typically create one cache instance for each open database file,
|
|
9199
9279
|
** though this is not guaranteed. ^The
|
|
9200
9280
|
** first parameter, szPage, is the size in bytes of the pages that must
|
|
9201
|
-
** be allocated by the cache. ^szPage will always a power of two. ^The
|
|
9281
|
+
** be allocated by the cache. ^szPage will always be a power of two. ^The
|
|
9202
9282
|
** second parameter szExtra is a number of bytes of extra storage
|
|
9203
|
-
** associated with each page cache entry. ^The szExtra parameter will
|
|
9283
|
+
** associated with each page cache entry. ^The szExtra parameter will be
|
|
9204
9284
|
** a number less than 250. SQLite will use the
|
|
9205
9285
|
** extra szExtra bytes on each page to store metadata about the underlying
|
|
9206
9286
|
** database page on disk. The value passed into szExtra depends
|
|
@@ -9208,17 +9288,17 @@ struct sqlite3_pcache_page {
|
|
|
9208
9288
|
** ^The third argument to xCreate(), bPurgeable, is true if the cache being
|
|
9209
9289
|
** created will be used to cache database pages of a file stored on disk, or
|
|
9210
9290
|
** false if it is used for an in-memory database. The cache implementation
|
|
9211
|
-
** does not have to do anything special based
|
|
9291
|
+
** does not have to do anything special based upon the value of bPurgeable;
|
|
9212
9292
|
** it is purely advisory. ^On a cache where bPurgeable is false, SQLite will
|
|
9213
9293
|
** never invoke xUnpin() except to deliberately delete a page.
|
|
9214
9294
|
** ^In other words, calls to xUnpin() on a cache with bPurgeable set to
|
|
9215
9295
|
** false will always have the "discard" flag set to true.
|
|
9216
|
-
** ^Hence, a cache created with bPurgeable false will
|
|
9296
|
+
** ^Hence, a cache created with bPurgeable set to false will
|
|
9217
9297
|
** never contain any unpinned pages.
|
|
9218
9298
|
**
|
|
9219
9299
|
** [[the xCachesize() page cache method]]
|
|
9220
9300
|
** ^(The xCachesize() method may be called at any time by SQLite to set the
|
|
9221
|
-
** suggested maximum cache-size (number of pages stored
|
|
9301
|
+
** suggested maximum cache-size (number of pages stored) for the cache
|
|
9222
9302
|
** instance passed as the first argument. This is the value configured using
|
|
9223
9303
|
** the SQLite "[PRAGMA cache_size]" command.)^ As with the bPurgeable
|
|
9224
9304
|
** parameter, the implementation is not required to do anything with this
|
|
@@ -9245,12 +9325,12 @@ struct sqlite3_pcache_page {
|
|
|
9245
9325
|
** implementation must return a pointer to the page buffer with its content
|
|
9246
9326
|
** intact. If the requested page is not already in the cache, then the
|
|
9247
9327
|
** cache implementation should use the value of the createFlag
|
|
9248
|
-
** parameter to help it
|
|
9328
|
+
** parameter to help it determine what action to take:
|
|
9249
9329
|
**
|
|
9250
9330
|
** <table border=1 width=85% align=center>
|
|
9251
9331
|
** <tr><th> createFlag <th> Behavior when page is not already in cache
|
|
9252
9332
|
** <tr><td> 0 <td> Do not allocate a new page. Return NULL.
|
|
9253
|
-
** <tr><td> 1 <td> Allocate a new page if it easy and convenient to do so.
|
|
9333
|
+
** <tr><td> 1 <td> Allocate a new page if it is easy and convenient to do so.
|
|
9254
9334
|
** Otherwise return NULL.
|
|
9255
9335
|
** <tr><td> 2 <td> Make every effort to allocate a new page. Only return
|
|
9256
9336
|
** NULL if allocating a new page is effectively impossible.
|
|
@@ -9267,7 +9347,7 @@ struct sqlite3_pcache_page {
|
|
|
9267
9347
|
** as its second argument. If the third parameter, discard, is non-zero,
|
|
9268
9348
|
** then the page must be evicted from the cache.
|
|
9269
9349
|
** ^If the discard parameter is
|
|
9270
|
-
** zero, then the page may be discarded or retained at the discretion of
|
|
9350
|
+
** zero, then the page may be discarded or retained at the discretion of the
|
|
9271
9351
|
** page cache implementation. ^The page cache implementation
|
|
9272
9352
|
** may choose to evict unpinned pages at any time.
|
|
9273
9353
|
**
|
|
@@ -9285,7 +9365,7 @@ struct sqlite3_pcache_page {
|
|
|
9285
9365
|
** When SQLite calls the xTruncate() method, the cache must discard all
|
|
9286
9366
|
** existing cache entries with page numbers (keys) greater than or equal
|
|
9287
9367
|
** to the value of the iLimit parameter passed to xTruncate(). If any
|
|
9288
|
-
** of these pages are pinned, they
|
|
9368
|
+
** of these pages are pinned, they become implicitly unpinned, meaning that
|
|
9289
9369
|
** they can be safely discarded.
|
|
9290
9370
|
**
|
|
9291
9371
|
** [[the xDestroy() page cache method]]
|
|
@@ -9465,7 +9545,7 @@ typedef struct sqlite3_backup sqlite3_backup;
|
|
|
9465
9545
|
** external process or via a database connection other than the one being
|
|
9466
9546
|
** used by the backup operation, then the backup will be automatically
|
|
9467
9547
|
** restarted by the next call to sqlite3_backup_step(). ^If the source
|
|
9468
|
-
** database is modified by
|
|
9548
|
+
** database is modified by using the same database connection as is used
|
|
9469
9549
|
** by the backup operation, then the backup database is automatically
|
|
9470
9550
|
** updated at the same time.
|
|
9471
9551
|
**
|
|
@@ -9482,7 +9562,7 @@ typedef struct sqlite3_backup sqlite3_backup;
|
|
|
9482
9562
|
** and may not be used following a call to sqlite3_backup_finish().
|
|
9483
9563
|
**
|
|
9484
9564
|
** ^The value returned by sqlite3_backup_finish is [SQLITE_OK] if no
|
|
9485
|
-
** sqlite3_backup_step() errors occurred, regardless
|
|
9565
|
+
** sqlite3_backup_step() errors occurred, regardless of whether or not
|
|
9486
9566
|
** sqlite3_backup_step() completed.
|
|
9487
9567
|
** ^If an out-of-memory condition or IO error occurred during any prior
|
|
9488
9568
|
** sqlite3_backup_step() call on the same [sqlite3_backup] object, then
|
|
@@ -9584,7 +9664,7 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p);
|
|
|
9584
9664
|
** application receives an SQLITE_LOCKED error, it may call the
|
|
9585
9665
|
** sqlite3_unlock_notify() method with the blocked connection handle as
|
|
9586
9666
|
** the first argument to register for a callback that will be invoked
|
|
9587
|
-
** when the blocking
|
|
9667
|
+
** when the blocking connection's current transaction is concluded. ^The
|
|
9588
9668
|
** callback is invoked from within the [sqlite3_step] or [sqlite3_close]
|
|
9589
9669
|
** call that concludes the blocking connection's transaction.
|
|
9590
9670
|
**
|
|
@@ -9604,7 +9684,7 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p);
|
|
|
9604
9684
|
** blocked connection already has a registered unlock-notify callback,
|
|
9605
9685
|
** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is
|
|
9606
9686
|
** called with a NULL pointer as its second argument, then any existing
|
|
9607
|
-
** unlock-notify callback is canceled. ^The blocked
|
|
9687
|
+
** unlock-notify callback is canceled. ^The blocked connection's
|
|
9608
9688
|
** unlock-notify callback may also be canceled by closing the blocked
|
|
9609
9689
|
** connection using [sqlite3_close()].
|
|
9610
9690
|
**
|
|
@@ -9774,7 +9854,7 @@ SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);
|
|
|
9774
9854
|
** is the number of pages currently in the write-ahead log file,
|
|
9775
9855
|
** including those that were just committed.
|
|
9776
9856
|
**
|
|
9777
|
-
** The callback function should normally return [SQLITE_OK]. ^If an error
|
|
9857
|
+
** ^The callback function should normally return [SQLITE_OK]. ^If an error
|
|
9778
9858
|
** code is returned, that error will propagate back up through the
|
|
9779
9859
|
** SQLite code base to cause the statement that provoked the callback
|
|
9780
9860
|
** to report an error, though the commit will have still occurred. If the
|
|
@@ -9782,13 +9862,26 @@ SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);
|
|
|
9782
9862
|
** that does not correspond to any valid SQLite error code, the results
|
|
9783
9863
|
** are undefined.
|
|
9784
9864
|
**
|
|
9785
|
-
** A single database handle may have at most a single write-ahead log
|
|
9786
|
-
** registered at one time. ^Calling [sqlite3_wal_hook()]
|
|
9787
|
-
** previously registered write-ahead
|
|
9788
|
-
**
|
|
9789
|
-
**
|
|
9790
|
-
**
|
|
9791
|
-
**
|
|
9865
|
+
** ^A single database handle may have at most a single write-ahead log
|
|
9866
|
+
** callback registered at one time. ^Calling [sqlite3_wal_hook()]
|
|
9867
|
+
** replaces the default behavior or previously registered write-ahead
|
|
9868
|
+
** log callback.
|
|
9869
|
+
**
|
|
9870
|
+
** ^The return value is a copy of the third parameter from the
|
|
9871
|
+
** previous call, if any, or 0.
|
|
9872
|
+
**
|
|
9873
|
+
** ^The [sqlite3_wal_autocheckpoint()] interface and the
|
|
9874
|
+
** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and
|
|
9875
|
+
** will overwrite any prior [sqlite3_wal_hook()] settings.
|
|
9876
|
+
**
|
|
9877
|
+
** ^If a write-ahead log callback is set using this function then
|
|
9878
|
+
** [sqlite3_wal_checkpoint_v2()] or [PRAGMA wal_checkpoint]
|
|
9879
|
+
** should be invoked periodically to keep the write-ahead log file
|
|
9880
|
+
** from growing without bound.
|
|
9881
|
+
**
|
|
9882
|
+
** ^Passing a NULL pointer for the callback disables automatic
|
|
9883
|
+
** checkpointing entirely. To re-enable the default behavior, call
|
|
9884
|
+
** sqlite3_wal_autocheckpoint(db,1000) or use [PRAGMA wal_checkpoint].
|
|
9792
9885
|
*/
|
|
9793
9886
|
SQLITE_API void *sqlite3_wal_hook(
|
|
9794
9887
|
sqlite3*,
|
|
@@ -9805,7 +9898,7 @@ SQLITE_API void *sqlite3_wal_hook(
|
|
|
9805
9898
|
** to automatically [checkpoint]
|
|
9806
9899
|
** after committing a transaction if there are N or
|
|
9807
9900
|
** more frames in the [write-ahead log] file. ^Passing zero or
|
|
9808
|
-
** a negative value as the
|
|
9901
|
+
** a negative value as the N parameter disables automatic
|
|
9809
9902
|
** checkpoints entirely.
|
|
9810
9903
|
**
|
|
9811
9904
|
** ^The callback registered by this function replaces any existing callback
|
|
@@ -9821,9 +9914,10 @@ SQLITE_API void *sqlite3_wal_hook(
|
|
|
9821
9914
|
**
|
|
9822
9915
|
** ^Every new [database connection] defaults to having the auto-checkpoint
|
|
9823
9916
|
** enabled with a threshold of 1000 or [SQLITE_DEFAULT_WAL_AUTOCHECKPOINT]
|
|
9824
|
-
** pages.
|
|
9825
|
-
**
|
|
9826
|
-
**
|
|
9917
|
+
** pages.
|
|
9918
|
+
**
|
|
9919
|
+
** ^The use of this interface is only necessary if the default setting
|
|
9920
|
+
** is found to be suboptimal for a particular application.
|
|
9827
9921
|
*/
|
|
9828
9922
|
SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
|
|
9829
9923
|
|
|
@@ -9888,6 +9982,11 @@ SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);
|
|
|
9888
9982
|
** ^This mode works the same way as SQLITE_CHECKPOINT_RESTART with the
|
|
9889
9983
|
** addition that it also truncates the log file to zero bytes just prior
|
|
9890
9984
|
** to a successful return.
|
|
9985
|
+
**
|
|
9986
|
+
** <dt>SQLITE_CHECKPOINT_NOOP<dd>
|
|
9987
|
+
** ^This mode always checkpoints zero frames. The only reason to invoke
|
|
9988
|
+
** a NOOP checkpoint is to access the values returned by
|
|
9989
|
+
** sqlite3_wal_checkpoint_v2() via output parameters *pnLog and *pnCkpt.
|
|
9891
9990
|
** </dl>
|
|
9892
9991
|
**
|
|
9893
9992
|
** ^If pnLog is not NULL, then *pnLog is set to the total number of frames in
|
|
@@ -9958,6 +10057,7 @@ SQLITE_API int sqlite3_wal_checkpoint_v2(
|
|
|
9958
10057
|
** See the [sqlite3_wal_checkpoint_v2()] documentation for details on the
|
|
9959
10058
|
** meaning of each of these checkpoint modes.
|
|
9960
10059
|
*/
|
|
10060
|
+
#define SQLITE_CHECKPOINT_NOOP -1 /* Do no work at all */
|
|
9961
10061
|
#define SQLITE_CHECKPOINT_PASSIVE 0 /* Do as much as possible w/o blocking */
|
|
9962
10062
|
#define SQLITE_CHECKPOINT_FULL 1 /* Wait for writers, then checkpoint */
|
|
9963
10063
|
#define SQLITE_CHECKPOINT_RESTART 2 /* Like FULL but wait for readers */
|
|
@@ -10002,7 +10102,7 @@ SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);
|
|
|
10002
10102
|
** support constraints. In this configuration (which is the default) if
|
|
10003
10103
|
** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire
|
|
10004
10104
|
** statement is rolled back as if [ON CONFLICT | OR ABORT] had been
|
|
10005
|
-
** specified as part of the
|
|
10105
|
+
** specified as part of the user's SQL statement, regardless of the actual
|
|
10006
10106
|
** ON CONFLICT mode specified.
|
|
10007
10107
|
**
|
|
10008
10108
|
** If X is non-zero, then the virtual table implementation guarantees
|
|
@@ -10036,7 +10136,7 @@ SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);
|
|
|
10036
10136
|
** [[SQLITE_VTAB_INNOCUOUS]]<dt>SQLITE_VTAB_INNOCUOUS</dt>
|
|
10037
10137
|
** <dd>Calls of the form
|
|
10038
10138
|
** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the
|
|
10039
|
-
**
|
|
10139
|
+
** [xConnect] or [xCreate] methods of a [virtual table] implementation
|
|
10040
10140
|
** identify that virtual table as being safe to use from within triggers
|
|
10041
10141
|
** and views. Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the
|
|
10042
10142
|
** virtual table can do no serious harm even if it is controlled by a
|
|
@@ -10204,7 +10304,7 @@ SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
|
|
|
10204
10304
|
** </table>
|
|
10205
10305
|
**
|
|
10206
10306
|
** ^For the purposes of comparing virtual table output values to see if the
|
|
10207
|
-
** values are same value for sorting purposes, two NULL values are considered
|
|
10307
|
+
** values are the same value for sorting purposes, two NULL values are considered
|
|
10208
10308
|
** to be the same. In other words, the comparison operator is "IS"
|
|
10209
10309
|
** (or "IS NOT DISTINCT FROM") and not "==".
|
|
10210
10310
|
**
|
|
@@ -10214,7 +10314,7 @@ SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
|
|
|
10214
10314
|
**
|
|
10215
10315
|
** ^A virtual table implementation is always free to return rows in any order
|
|
10216
10316
|
** it wants, as long as the "orderByConsumed" flag is not set. ^When the
|
|
10217
|
-
**
|
|
10317
|
+
** "orderByConsumed" flag is unset, the query planner will add extra
|
|
10218
10318
|
** [bytecode] to ensure that the final results returned by the SQL query are
|
|
10219
10319
|
** ordered correctly. The use of the "orderByConsumed" flag and the
|
|
10220
10320
|
** sqlite3_vtab_distinct() interface is merely an optimization. ^Careful
|
|
@@ -10311,7 +10411,7 @@ SQLITE_API int sqlite3_vtab_in(sqlite3_index_info*, int iCons, int bHandle);
|
|
|
10311
10411
|
** sqlite3_vtab_in_next(X,P) should be one of the parameters to the
|
|
10312
10412
|
** xFilter method which invokes these routines, and specifically
|
|
10313
10413
|
** a parameter that was previously selected for all-at-once IN constraint
|
|
10314
|
-
** processing
|
|
10414
|
+
** processing using the [sqlite3_vtab_in()] interface in the
|
|
10315
10415
|
** [xBestIndex|xBestIndex method]. ^(If the X parameter is not
|
|
10316
10416
|
** an xFilter argument that was selected for all-at-once IN constraint
|
|
10317
10417
|
** processing, then these routines return [SQLITE_ERROR].)^
|
|
@@ -10326,7 +10426,7 @@ SQLITE_API int sqlite3_vtab_in(sqlite3_index_info*, int iCons, int bHandle);
|
|
|
10326
10426
|
** ){
|
|
10327
10427
|
** // do something with pVal
|
|
10328
10428
|
** }
|
|
10329
|
-
** if( rc!=
|
|
10429
|
+
** if( rc!=SQLITE_DONE ){
|
|
10330
10430
|
** // an error has occurred
|
|
10331
10431
|
** }
|
|
10332
10432
|
** </pre></blockquote>)^
|
|
@@ -10366,7 +10466,7 @@ SQLITE_API int sqlite3_vtab_in_next(sqlite3_value *pVal, sqlite3_value **ppOut);
|
|
|
10366
10466
|
** and only if *V is set to a value. ^The sqlite3_vtab_rhs_value(P,J,V)
|
|
10367
10467
|
** inteface returns SQLITE_NOTFOUND if the right-hand side of the J-th
|
|
10368
10468
|
** constraint is not available. ^The sqlite3_vtab_rhs_value() interface
|
|
10369
|
-
** can return
|
|
10469
|
+
** can return a result code other than SQLITE_OK or SQLITE_NOTFOUND if
|
|
10370
10470
|
** something goes wrong.
|
|
10371
10471
|
**
|
|
10372
10472
|
** The sqlite3_vtab_rhs_value() interface is usually only successful if
|
|
@@ -10394,8 +10494,8 @@ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **
|
|
|
10394
10494
|
** KEYWORDS: {conflict resolution mode}
|
|
10395
10495
|
**
|
|
10396
10496
|
** These constants are returned by [sqlite3_vtab_on_conflict()] to
|
|
10397
|
-
** inform a [virtual table] implementation
|
|
10398
|
-
**
|
|
10497
|
+
** inform a [virtual table] implementation of the [ON CONFLICT] mode
|
|
10498
|
+
** for the SQL statement being evaluated.
|
|
10399
10499
|
**
|
|
10400
10500
|
** Note that the [SQLITE_IGNORE] constant is also used as a potential
|
|
10401
10501
|
** return value from the [sqlite3_set_authorizer()] callback and that
|
|
@@ -10435,39 +10535,39 @@ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **
|
|
|
10435
10535
|
** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt>
|
|
10436
10536
|
** <dd>^The "double" variable pointed to by the V parameter will be set to the
|
|
10437
10537
|
** query planner's estimate for the average number of rows output from each
|
|
10438
|
-
** iteration of the X-th loop. If the query planner's
|
|
10538
|
+
** iteration of the X-th loop. If the query planner's estimate was accurate,
|
|
10439
10539
|
** then this value will approximate the quotient NVISIT/NLOOP and the
|
|
10440
10540
|
** product of this value for all prior loops with the same SELECTID will
|
|
10441
|
-
** be the NLOOP value for the current loop
|
|
10541
|
+
** be the NLOOP value for the current loop.</dd>
|
|
10442
10542
|
**
|
|
10443
10543
|
** [[SQLITE_SCANSTAT_NAME]] <dt>SQLITE_SCANSTAT_NAME</dt>
|
|
10444
10544
|
** <dd>^The "const char *" variable pointed to by the V parameter will be set
|
|
10445
10545
|
** to a zero-terminated UTF-8 string containing the name of the index or table
|
|
10446
|
-
** used for the X-th loop
|
|
10546
|
+
** used for the X-th loop.</dd>
|
|
10447
10547
|
**
|
|
10448
10548
|
** [[SQLITE_SCANSTAT_EXPLAIN]] <dt>SQLITE_SCANSTAT_EXPLAIN</dt>
|
|
10449
10549
|
** <dd>^The "const char *" variable pointed to by the V parameter will be set
|
|
10450
10550
|
** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN]
|
|
10451
|
-
** description for the X-th loop
|
|
10551
|
+
** description for the X-th loop.</dd>
|
|
10452
10552
|
**
|
|
10453
10553
|
** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECTID</dt>
|
|
10454
10554
|
** <dd>^The "int" variable pointed to by the V parameter will be set to the
|
|
10455
10555
|
** id for the X-th query plan element. The id value is unique within the
|
|
10456
10556
|
** statement. The select-id is the same value as is output in the first
|
|
10457
|
-
** column of an [EXPLAIN QUERY PLAN] query
|
|
10557
|
+
** column of an [EXPLAIN QUERY PLAN] query.</dd>
|
|
10458
10558
|
**
|
|
10459
10559
|
** [[SQLITE_SCANSTAT_PARENTID]] <dt>SQLITE_SCANSTAT_PARENTID</dt>
|
|
10460
10560
|
** <dd>The "int" variable pointed to by the V parameter will be set to the
|
|
10461
|
-
**
|
|
10561
|
+
** id of the parent of the current query element, if applicable, or
|
|
10462
10562
|
** to zero if the query element has no parent. This is the same value as
|
|
10463
|
-
** returned in the second column of an [EXPLAIN QUERY PLAN] query
|
|
10563
|
+
** returned in the second column of an [EXPLAIN QUERY PLAN] query.</dd>
|
|
10464
10564
|
**
|
|
10465
10565
|
** [[SQLITE_SCANSTAT_NCYCLE]] <dt>SQLITE_SCANSTAT_NCYCLE</dt>
|
|
10466
10566
|
** <dd>The sqlite3_int64 output value is set to the number of cycles,
|
|
10467
10567
|
** according to the processor time-stamp counter, that elapsed while the
|
|
10468
10568
|
** query element was being processed. This value is not available for
|
|
10469
10569
|
** all query elements - if it is unavailable the output variable is
|
|
10470
|
-
** set to -1
|
|
10570
|
+
** set to -1.</dd>
|
|
10471
10571
|
** </dl>
|
|
10472
10572
|
*/
|
|
10473
10573
|
#define SQLITE_SCANSTAT_NLOOP 0
|
|
@@ -10508,8 +10608,8 @@ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **
|
|
|
10508
10608
|
** sqlite3_stmt_scanstatus_v2() with a zeroed flags parameter.
|
|
10509
10609
|
**
|
|
10510
10610
|
** Parameter "idx" identifies the specific query element to retrieve statistics
|
|
10511
|
-
** for. Query elements are numbered starting from zero. A value of -1 may
|
|
10512
|
-
**
|
|
10611
|
+
** for. Query elements are numbered starting from zero. A value of -1 may
|
|
10612
|
+
** retrieve statistics for the entire query. ^If idx is out of range
|
|
10513
10613
|
** - less than -1 or greater than or equal to the total number of query
|
|
10514
10614
|
** elements used to implement the statement - a non-zero value is returned and
|
|
10515
10615
|
** the variable that pOut points to is unchanged.
|
|
@@ -10552,7 +10652,7 @@ SQLITE_API void sqlite3_stmt_scanstatus_reset(sqlite3_stmt*);
|
|
|
10552
10652
|
** METHOD: sqlite3
|
|
10553
10653
|
**
|
|
10554
10654
|
** ^If a write-transaction is open on [database connection] D when the
|
|
10555
|
-
** [sqlite3_db_cacheflush(D)] interface invoked, any dirty
|
|
10655
|
+
** [sqlite3_db_cacheflush(D)] interface is invoked, any dirty
|
|
10556
10656
|
** pages in the pager-cache that are not currently in use are written out
|
|
10557
10657
|
** to disk. A dirty page may be in use if a database cursor created by an
|
|
10558
10658
|
** active SQL statement is reading from it, or if it is page 1 of a database
|
|
@@ -10666,8 +10766,8 @@ SQLITE_API int sqlite3_db_cacheflush(sqlite3*);
|
|
|
10666
10766
|
** triggers; and so forth.
|
|
10667
10767
|
**
|
|
10668
10768
|
** When the [sqlite3_blob_write()] API is used to update a blob column,
|
|
10669
|
-
** the pre-update hook is invoked with SQLITE_DELETE
|
|
10670
|
-
**
|
|
10769
|
+
** the pre-update hook is invoked with SQLITE_DELETE, because
|
|
10770
|
+
** the new values are not yet available. In this case, when a
|
|
10671
10771
|
** callback made with op==SQLITE_DELETE is actually a write using the
|
|
10672
10772
|
** sqlite3_blob_write() API, the [sqlite3_preupdate_blobwrite()] returns
|
|
10673
10773
|
** the index of the column being written. In other cases, where the
|
|
@@ -10785,7 +10885,7 @@ typedef struct sqlite3_snapshot {
|
|
|
10785
10885
|
** The [sqlite3_snapshot_get()] interface is only available when the
|
|
10786
10886
|
** [SQLITE_ENABLE_SNAPSHOT] compile-time option is used.
|
|
10787
10887
|
*/
|
|
10788
|
-
SQLITE_API
|
|
10888
|
+
SQLITE_API int sqlite3_snapshot_get(
|
|
10789
10889
|
sqlite3 *db,
|
|
10790
10890
|
const char *zSchema,
|
|
10791
10891
|
sqlite3_snapshot **ppSnapshot
|
|
@@ -10834,7 +10934,7 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_get(
|
|
|
10834
10934
|
** The [sqlite3_snapshot_open()] interface is only available when the
|
|
10835
10935
|
** [SQLITE_ENABLE_SNAPSHOT] compile-time option is used.
|
|
10836
10936
|
*/
|
|
10837
|
-
SQLITE_API
|
|
10937
|
+
SQLITE_API int sqlite3_snapshot_open(
|
|
10838
10938
|
sqlite3 *db,
|
|
10839
10939
|
const char *zSchema,
|
|
10840
10940
|
sqlite3_snapshot *pSnapshot
|
|
@@ -10851,7 +10951,7 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_open(
|
|
|
10851
10951
|
** The [sqlite3_snapshot_free()] interface is only available when the
|
|
10852
10952
|
** [SQLITE_ENABLE_SNAPSHOT] compile-time option is used.
|
|
10853
10953
|
*/
|
|
10854
|
-
SQLITE_API
|
|
10954
|
+
SQLITE_API void sqlite3_snapshot_free(sqlite3_snapshot*);
|
|
10855
10955
|
|
|
10856
10956
|
/*
|
|
10857
10957
|
** CAPI3REF: Compare the ages of two snapshot handles.
|
|
@@ -10878,7 +10978,7 @@ SQLITE_API SQLITE_EXPERIMENTAL void sqlite3_snapshot_free(sqlite3_snapshot*);
|
|
|
10878
10978
|
** This interface is only available if SQLite is compiled with the
|
|
10879
10979
|
** [SQLITE_ENABLE_SNAPSHOT] option.
|
|
10880
10980
|
*/
|
|
10881
|
-
SQLITE_API
|
|
10981
|
+
SQLITE_API int sqlite3_snapshot_cmp(
|
|
10882
10982
|
sqlite3_snapshot *p1,
|
|
10883
10983
|
sqlite3_snapshot *p2
|
|
10884
10984
|
);
|
|
@@ -10906,7 +11006,7 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_cmp(
|
|
|
10906
11006
|
** This interface is only available if SQLite is compiled with the
|
|
10907
11007
|
** [SQLITE_ENABLE_SNAPSHOT] option.
|
|
10908
11008
|
*/
|
|
10909
|
-
SQLITE_API
|
|
11009
|
+
SQLITE_API int sqlite3_snapshot_recover(sqlite3 *db, const char *zDb);
|
|
10910
11010
|
|
|
10911
11011
|
/*
|
|
10912
11012
|
** CAPI3REF: Serialize a database
|
|
@@ -10920,7 +11020,7 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const c
|
|
|
10920
11020
|
** For an ordinary on-disk database file, the serialization is just a
|
|
10921
11021
|
** copy of the disk file. For an in-memory database or a "TEMP" database,
|
|
10922
11022
|
** the serialization is the same sequence of bytes which would be written
|
|
10923
|
-
** to disk if that database
|
|
11023
|
+
** to disk if that database were backed up to disk.
|
|
10924
11024
|
**
|
|
10925
11025
|
** The usual case is that sqlite3_serialize() copies the serialization of
|
|
10926
11026
|
** the database into memory obtained from [sqlite3_malloc64()] and returns
|
|
@@ -10929,7 +11029,7 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const c
|
|
|
10929
11029
|
** contains the SQLITE_SERIALIZE_NOCOPY bit, then no memory allocations
|
|
10930
11030
|
** are made, and the sqlite3_serialize() function will return a pointer
|
|
10931
11031
|
** to the contiguous memory representation of the database that SQLite
|
|
10932
|
-
** is currently using for that database, or NULL if
|
|
11032
|
+
** is currently using for that database, or NULL if no such contiguous
|
|
10933
11033
|
** memory representation of the database exists. A contiguous memory
|
|
10934
11034
|
** representation of the database will usually only exist if there has
|
|
10935
11035
|
** been a prior call to [sqlite3_deserialize(D,S,...)] with the same
|
|
@@ -10980,12 +11080,13 @@ SQLITE_API unsigned char *sqlite3_serialize(
|
|
|
10980
11080
|
**
|
|
10981
11081
|
** The sqlite3_deserialize(D,S,P,N,M,F) interface causes the
|
|
10982
11082
|
** [database connection] D to disconnect from database S and then
|
|
10983
|
-
** reopen S as an in-memory database based on the serialization
|
|
10984
|
-
** in P.
|
|
10985
|
-
**
|
|
10986
|
-
** the
|
|
10987
|
-
**
|
|
10988
|
-
**
|
|
11083
|
+
** reopen S as an in-memory database based on the serialization
|
|
11084
|
+
** contained in P. If S is a NULL pointer, the main database is
|
|
11085
|
+
** used. The serialized database P is N bytes in size. M is the size
|
|
11086
|
+
** of the buffer P, which might be larger than N. If M is larger than
|
|
11087
|
+
** N, and the SQLITE_DESERIALIZE_READONLY bit is not set in F, then
|
|
11088
|
+
** SQLite is permitted to add content to the in-memory database as
|
|
11089
|
+
** long as the total size does not exceed M bytes.
|
|
10989
11090
|
**
|
|
10990
11091
|
** If the SQLITE_DESERIALIZE_FREEONCLOSE bit is set in F, then SQLite will
|
|
10991
11092
|
** invoke sqlite3_free() on the serialization buffer when the database
|
|
@@ -11000,7 +11101,7 @@ SQLITE_API unsigned char *sqlite3_serialize(
|
|
|
11000
11101
|
** database is currently in a read transaction or is involved in a backup
|
|
11001
11102
|
** operation.
|
|
11002
11103
|
**
|
|
11003
|
-
** It is not possible to
|
|
11104
|
+
** It is not possible to deserialize into the TEMP database. If the
|
|
11004
11105
|
** S argument to sqlite3_deserialize(D,S,P,N,M,F) is "temp" then the
|
|
11005
11106
|
** function returns SQLITE_ERROR.
|
|
11006
11107
|
**
|
|
@@ -11022,7 +11123,7 @@ SQLITE_API int sqlite3_deserialize(
|
|
|
11022
11123
|
sqlite3 *db, /* The database connection */
|
|
11023
11124
|
const char *zSchema, /* Which DB to reopen with the deserialization */
|
|
11024
11125
|
unsigned char *pData, /* The serialized database content */
|
|
11025
|
-
sqlite3_int64 szDb, /* Number bytes in the deserialization */
|
|
11126
|
+
sqlite3_int64 szDb, /* Number of bytes in the deserialization */
|
|
11026
11127
|
sqlite3_int64 szBuf, /* Total size of buffer pData[] */
|
|
11027
11128
|
unsigned mFlags /* Zero or more SQLITE_DESERIALIZE_* flags */
|
|
11028
11129
|
);
|
|
@@ -11030,7 +11131,7 @@ SQLITE_API int sqlite3_deserialize(
|
|
|
11030
11131
|
/*
|
|
11031
11132
|
** CAPI3REF: Flags for sqlite3_deserialize()
|
|
11032
11133
|
**
|
|
11033
|
-
** The following are allowed values for 6th argument (the F argument) to
|
|
11134
|
+
** The following are allowed values for the 6th argument (the F argument) to
|
|
11034
11135
|
** the [sqlite3_deserialize(D,S,P,N,M,F)] interface.
|
|
11035
11136
|
**
|
|
11036
11137
|
** The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization
|
|
@@ -11052,6 +11153,54 @@ SQLITE_API int sqlite3_deserialize(
|
|
|
11052
11153
|
#define SQLITE_DESERIALIZE_RESIZEABLE 2 /* Resize using sqlite3_realloc64() */
|
|
11053
11154
|
#define SQLITE_DESERIALIZE_READONLY 4 /* Database is read-only */
|
|
11054
11155
|
|
|
11156
|
+
/*
|
|
11157
|
+
** CAPI3REF: Bind array values to the CARRAY table-valued function
|
|
11158
|
+
**
|
|
11159
|
+
** The sqlite3_carray_bind(S,I,P,N,F,X) interface binds an array value to
|
|
11160
|
+
** one of the first argument of the [carray() table-valued function]. The
|
|
11161
|
+
** S parameter is a pointer to the [prepared statement] that uses the carray()
|
|
11162
|
+
** functions. I is the parameter index to be bound. P is a pointer to the
|
|
11163
|
+
** array to be bound, and N is the number of eements in the array. The
|
|
11164
|
+
** F argument is one of constants [SQLITE_CARRAY_INT32], [SQLITE_CARRAY_INT64],
|
|
11165
|
+
** [SQLITE_CARRAY_DOUBLE], [SQLITE_CARRAY_TEXT], or [SQLITE_CARRAY_BLOB] to
|
|
11166
|
+
** indicate the datatype of the array being bound. The X argument is not a
|
|
11167
|
+
** NULL pointer, then SQLite will invoke the function X on the P parameter
|
|
11168
|
+
** after it has finished using P, even if the call to
|
|
11169
|
+
** sqlite3_carray_bind() fails. The special-case finalizer
|
|
11170
|
+
** SQLITE_TRANSIENT has no effect here.
|
|
11171
|
+
*/
|
|
11172
|
+
SQLITE_API int sqlite3_carray_bind(
|
|
11173
|
+
sqlite3_stmt *pStmt, /* Statement to be bound */
|
|
11174
|
+
int i, /* Parameter index */
|
|
11175
|
+
void *aData, /* Pointer to array data */
|
|
11176
|
+
int nData, /* Number of data elements */
|
|
11177
|
+
int mFlags, /* CARRAY flags */
|
|
11178
|
+
void (*xDel)(void*) /* Destructor for aData */
|
|
11179
|
+
);
|
|
11180
|
+
|
|
11181
|
+
/*
|
|
11182
|
+
** CAPI3REF: Datatypes for the CARRAY table-valued function
|
|
11183
|
+
**
|
|
11184
|
+
** The fifth argument to the [sqlite3_carray_bind()] interface musts be
|
|
11185
|
+
** one of the following constants, to specify the datatype of the array
|
|
11186
|
+
** that is being bound into the [carray table-valued function].
|
|
11187
|
+
*/
|
|
11188
|
+
#define SQLITE_CARRAY_INT32 0 /* Data is 32-bit signed integers */
|
|
11189
|
+
#define SQLITE_CARRAY_INT64 1 /* Data is 64-bit signed integers */
|
|
11190
|
+
#define SQLITE_CARRAY_DOUBLE 2 /* Data is doubles */
|
|
11191
|
+
#define SQLITE_CARRAY_TEXT 3 /* Data is char* */
|
|
11192
|
+
#define SQLITE_CARRAY_BLOB 4 /* Data is struct iovec */
|
|
11193
|
+
|
|
11194
|
+
/*
|
|
11195
|
+
** Versions of the above #defines that omit the initial SQLITE_, for
|
|
11196
|
+
** legacy compatibility.
|
|
11197
|
+
*/
|
|
11198
|
+
#define CARRAY_INT32 0 /* Data is 32-bit signed integers */
|
|
11199
|
+
#define CARRAY_INT64 1 /* Data is 64-bit signed integers */
|
|
11200
|
+
#define CARRAY_DOUBLE 2 /* Data is doubles */
|
|
11201
|
+
#define CARRAY_TEXT 3 /* Data is char* */
|
|
11202
|
+
#define CARRAY_BLOB 4 /* Data is struct iovec */
|
|
11203
|
+
|
|
11055
11204
|
/*
|
|
11056
11205
|
** Undo the hack that converts floating point types to integer for
|
|
11057
11206
|
** builds on processors without floating point support.
|
|
@@ -12311,14 +12460,32 @@ SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup*);
|
|
|
12311
12460
|
** update the "main" database attached to handle db with the changes found in
|
|
12312
12461
|
** the changeset passed via the second and third arguments.
|
|
12313
12462
|
**
|
|
12463
|
+
** All changes made by these functions are enclosed in a savepoint transaction.
|
|
12464
|
+
** If any other error (aside from a constraint failure when attempting to
|
|
12465
|
+
** write to the target database) occurs, then the savepoint transaction is
|
|
12466
|
+
** rolled back, restoring the target database to its original state, and an
|
|
12467
|
+
** SQLite error code returned. Additionally, starting with version 3.51.0,
|
|
12468
|
+
** an error code and error message that may be accessed using the
|
|
12469
|
+
** [sqlite3_errcode()] and [sqlite3_errmsg()] APIs are left in the database
|
|
12470
|
+
** handle.
|
|
12471
|
+
**
|
|
12314
12472
|
** The fourth argument (xFilter) passed to these functions is the "filter
|
|
12315
|
-
** callback".
|
|
12316
|
-
**
|
|
12317
|
-
**
|
|
12318
|
-
**
|
|
12319
|
-
**
|
|
12320
|
-
**
|
|
12321
|
-
**
|
|
12473
|
+
** callback". This may be passed NULL, in which case all changes in the
|
|
12474
|
+
** changeset are applied to the database. For sqlite3changeset_apply() and
|
|
12475
|
+
** sqlite3_changeset_apply_v2(), if it is not NULL, then it is invoked once
|
|
12476
|
+
** for each table affected by at least one change in the changeset. In this
|
|
12477
|
+
** case the table name is passed as the second argument, and a copy of
|
|
12478
|
+
** the context pointer passed as the sixth argument to apply() or apply_v2()
|
|
12479
|
+
** as the first. If the "filter callback" returns zero, then no attempt is
|
|
12480
|
+
** made to apply any changes to the table. Otherwise, if the return value is
|
|
12481
|
+
** non-zero, all changes related to the table are attempted.
|
|
12482
|
+
**
|
|
12483
|
+
** For sqlite3_changeset_apply_v3(), the xFilter callback is invoked once
|
|
12484
|
+
** per change. The second argument in this case is an sqlite3_changeset_iter
|
|
12485
|
+
** that may be queried using the usual APIs for the details of the current
|
|
12486
|
+
** change. If the "filter callback" returns zero in this case, then no attempt
|
|
12487
|
+
** is made to apply the current change. If it returns non-zero, the change
|
|
12488
|
+
** is applied.
|
|
12322
12489
|
**
|
|
12323
12490
|
** For each table that is not excluded by the filter callback, this function
|
|
12324
12491
|
** tests that the target database contains a compatible table. A table is
|
|
@@ -12339,11 +12506,11 @@ SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup*);
|
|
|
12339
12506
|
** one such warning is issued for each table in the changeset.
|
|
12340
12507
|
**
|
|
12341
12508
|
** For each change for which there is a compatible table, an attempt is made
|
|
12342
|
-
** to modify the table contents according to
|
|
12343
|
-
** change. If a change cannot be
|
|
12344
|
-
** function passed as the fifth argument
|
|
12345
|
-
** invoked. A description of exactly when
|
|
12346
|
-
** each type of change is below.
|
|
12509
|
+
** to modify the table contents according to each UPDATE, INSERT or DELETE
|
|
12510
|
+
** change that is not excluded by a filter callback. If a change cannot be
|
|
12511
|
+
** applied cleanly, the conflict handler function passed as the fifth argument
|
|
12512
|
+
** to sqlite3changeset_apply() may be invoked. A description of exactly when
|
|
12513
|
+
** the conflict handler is invoked for each type of change is below.
|
|
12347
12514
|
**
|
|
12348
12515
|
** Unlike the xFilter argument, xConflict may not be passed NULL. The results
|
|
12349
12516
|
** of passing anything other than a valid function pointer as the xConflict
|
|
@@ -12439,12 +12606,6 @@ SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup*);
|
|
|
12439
12606
|
** This can be used to further customize the application's conflict
|
|
12440
12607
|
** resolution strategy.
|
|
12441
12608
|
**
|
|
12442
|
-
** All changes made by these functions are enclosed in a savepoint transaction.
|
|
12443
|
-
** If any other error (aside from a constraint failure when attempting to
|
|
12444
|
-
** write to the target database) occurs, then the savepoint transaction is
|
|
12445
|
-
** rolled back, restoring the target database to its original state, and an
|
|
12446
|
-
** SQLite error code returned.
|
|
12447
|
-
**
|
|
12448
12609
|
** If the output parameters (ppRebase) and (pnRebase) are non-NULL and
|
|
12449
12610
|
** the input is a changeset (not a patchset), then sqlite3changeset_apply_v2()
|
|
12450
12611
|
** may set (*ppRebase) to point to a "rebase" that may be used with the
|
|
@@ -12494,6 +12655,23 @@ SQLITE_API int sqlite3changeset_apply_v2(
|
|
|
12494
12655
|
void **ppRebase, int *pnRebase, /* OUT: Rebase data */
|
|
12495
12656
|
int flags /* SESSION_CHANGESETAPPLY_* flags */
|
|
12496
12657
|
);
|
|
12658
|
+
SQLITE_API int sqlite3changeset_apply_v3(
|
|
12659
|
+
sqlite3 *db, /* Apply change to "main" db of this handle */
|
|
12660
|
+
int nChangeset, /* Size of changeset in bytes */
|
|
12661
|
+
void *pChangeset, /* Changeset blob */
|
|
12662
|
+
int(*xFilter)(
|
|
12663
|
+
void *pCtx, /* Copy of sixth arg to _apply() */
|
|
12664
|
+
sqlite3_changeset_iter *p /* Handle describing change */
|
|
12665
|
+
),
|
|
12666
|
+
int(*xConflict)(
|
|
12667
|
+
void *pCtx, /* Copy of sixth arg to _apply() */
|
|
12668
|
+
int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */
|
|
12669
|
+
sqlite3_changeset_iter *p /* Handle describing change and conflict */
|
|
12670
|
+
),
|
|
12671
|
+
void *pCtx, /* First argument passed to xConflict */
|
|
12672
|
+
void **ppRebase, int *pnRebase, /* OUT: Rebase data */
|
|
12673
|
+
int flags /* SESSION_CHANGESETAPPLY_* flags */
|
|
12674
|
+
);
|
|
12497
12675
|
|
|
12498
12676
|
/*
|
|
12499
12677
|
** CAPI3REF: Flags for sqlite3changeset_apply_v2
|
|
@@ -12913,6 +13091,23 @@ SQLITE_API int sqlite3changeset_apply_v2_strm(
|
|
|
12913
13091
|
void **ppRebase, int *pnRebase,
|
|
12914
13092
|
int flags
|
|
12915
13093
|
);
|
|
13094
|
+
SQLITE_API int sqlite3changeset_apply_v3_strm(
|
|
13095
|
+
sqlite3 *db, /* Apply change to "main" db of this handle */
|
|
13096
|
+
int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */
|
|
13097
|
+
void *pIn, /* First arg for xInput */
|
|
13098
|
+
int(*xFilter)(
|
|
13099
|
+
void *pCtx, /* Copy of sixth arg to _apply() */
|
|
13100
|
+
sqlite3_changeset_iter *p
|
|
13101
|
+
),
|
|
13102
|
+
int(*xConflict)(
|
|
13103
|
+
void *pCtx, /* Copy of sixth arg to _apply() */
|
|
13104
|
+
int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */
|
|
13105
|
+
sqlite3_changeset_iter *p /* Handle describing change and conflict */
|
|
13106
|
+
),
|
|
13107
|
+
void *pCtx, /* First argument passed to xConflict */
|
|
13108
|
+
void **ppRebase, int *pnRebase,
|
|
13109
|
+
int flags
|
|
13110
|
+
);
|
|
12916
13111
|
SQLITE_API int sqlite3changeset_concat_strm(
|
|
12917
13112
|
int (*xInputA)(void *pIn, void *pData, int *pnData),
|
|
12918
13113
|
void *pInA,
|