better-sqlite3-multiple-ciphers 12.4.1 → 12.5.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.
@@ -31,9 +31,9 @@
31
31
 
32
32
  #define SQLITE3MC_VERSION_MAJOR 2
33
33
  #define SQLITE3MC_VERSION_MINOR 2
34
- #define SQLITE3MC_VERSION_RELEASE 4
34
+ #define SQLITE3MC_VERSION_RELEASE 6
35
35
  #define SQLITE3MC_VERSION_SUBRELEASE 0
36
- #define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 2.2.4"
36
+ #define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 2.2.6"
37
37
 
38
38
  #endif /* SQLITE3MC_VERSION_H_ */
39
39
  /*** End of #include "sqlite3mc_version.h" ***/
@@ -192,9 +192,12 @@ extern "C" {
192
192
  ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
193
193
  ** [sqlite_version()] and [sqlite_source_id()].
194
194
  */
195
- #define SQLITE_VERSION "3.50.4"
196
- #define SQLITE_VERSION_NUMBER 3050004
197
- #define SQLITE_SOURCE_ID "2025-07-30 19:33:53 4d8adfb30e03f9cf27f800a2c1ba3c48fb4ca1b08b0f5ed59a4d5ecbf45e20a3"
195
+ #define SQLITE_VERSION "3.51.1"
196
+ #define SQLITE_VERSION_NUMBER 3051001
197
+ #define SQLITE_SOURCE_ID "2025-11-28 17:28:25 281fc0e9afc38674b9b0991943b9e9d1e64c6cbdb133d35f6f5c87ff6af38a88"
198
+ #define SQLITE_SCM_BRANCH "branch-3.51"
199
+ #define SQLITE_SCM_TAGS "release version-3.51.1"
200
+ #define SQLITE_SCM_DATETIME "2025-11-28T17:28:25.933Z"
198
201
 
199
202
  /*
200
203
  ** CAPI3REF: Run-Time Library Version Numbers
@@ -214,9 +217,9 @@ extern "C" {
214
217
  ** assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 );
215
218
  ** </pre></blockquote>)^
216
219
  **
217
- ** ^The sqlite3_version[] string constant contains the text of [SQLITE_VERSION]
218
- ** macro. ^The sqlite3_libversion() function returns a pointer to the
219
- ** to the sqlite3_version[] string constant. The sqlite3_libversion()
220
+ ** ^The sqlite3_version[] string constant contains the text of the
221
+ ** [SQLITE_VERSION] macro. ^The sqlite3_libversion() function returns a
222
+ ** pointer to the sqlite3_version[] string constant. The sqlite3_libversion()
220
223
  ** function is provided for use in DLLs since DLL users usually do not have
221
224
  ** direct access to string constants within the DLL. ^The
222
225
  ** sqlite3_libversion_number() function returns an integer equal to
@@ -416,7 +419,7 @@ typedef int (*sqlite3_callback)(void*,int,char**, char**);
416
419
  ** without having to use a lot of C code.
417
420
  **
418
421
  ** ^The sqlite3_exec() interface runs zero or more UTF-8 encoded,
419
- ** semicolon-separate SQL statements passed into its 2nd argument,
422
+ ** semicolon-separated SQL statements passed into its 2nd argument,
420
423
  ** in the context of the [database connection] passed in as its 1st
421
424
  ** argument. ^If the callback function of the 3rd argument to
422
425
  ** sqlite3_exec() is not NULL, then it is invoked for each result row
@@ -449,7 +452,7 @@ typedef int (*sqlite3_callback)(void*,int,char**, char**);
449
452
  ** result row is NULL then the corresponding string pointer for the
450
453
  ** sqlite3_exec() callback is a NULL pointer. ^The 4th argument to the
451
454
  ** sqlite3_exec() callback is an array of pointers to strings where each
452
- ** entry represents the name of corresponding result column as obtained
455
+ ** entry represents the name of a corresponding result column as obtained
453
456
  ** from [sqlite3_column_name()].
454
457
  **
455
458
  ** ^If the 2nd parameter to sqlite3_exec() is a NULL pointer, a pointer
@@ -543,6 +546,9 @@ SQLITE_API int sqlite3_exec(
543
546
  #define SQLITE_ERROR_MISSING_COLLSEQ (SQLITE_ERROR | (1<<8))
544
547
  #define SQLITE_ERROR_RETRY (SQLITE_ERROR | (2<<8))
545
548
  #define SQLITE_ERROR_SNAPSHOT (SQLITE_ERROR | (3<<8))
549
+ #define SQLITE_ERROR_RESERVESIZE (SQLITE_ERROR | (4<<8))
550
+ #define SQLITE_ERROR_KEY (SQLITE_ERROR | (5<<8))
551
+ #define SQLITE_ERROR_UNABLE (SQLITE_ERROR | (6<<8))
546
552
  #define SQLITE_IOERR_READ (SQLITE_IOERR | (1<<8))
547
553
  #define SQLITE_IOERR_SHORT_READ (SQLITE_IOERR | (2<<8))
548
554
  #define SQLITE_IOERR_WRITE (SQLITE_IOERR | (3<<8))
@@ -577,6 +583,8 @@ SQLITE_API int sqlite3_exec(
577
583
  #define SQLITE_IOERR_DATA (SQLITE_IOERR | (32<<8))
578
584
  #define SQLITE_IOERR_CORRUPTFS (SQLITE_IOERR | (33<<8))
579
585
  #define SQLITE_IOERR_IN_PAGE (SQLITE_IOERR | (34<<8))
586
+ #define SQLITE_IOERR_BADKEY (SQLITE_IOERR | (35<<8))
587
+ #define SQLITE_IOERR_CODEC (SQLITE_IOERR | (36<<8))
580
588
  #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8))
581
589
  #define SQLITE_LOCKED_VTAB (SQLITE_LOCKED | (2<<8))
582
590
  #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8))
@@ -635,7 +643,7 @@ SQLITE_API int sqlite3_exec(
635
643
  ** Note in particular that passing the SQLITE_OPEN_EXCLUSIVE flag into
636
644
  ** [sqlite3_open_v2()] does *not* cause the underlying database file
637
645
  ** to be opened using O_EXCL. Passing SQLITE_OPEN_EXCLUSIVE into
638
- ** [sqlite3_open_v2()] has historically be a no-op and might become an
646
+ ** [sqlite3_open_v2()] has historically been a no-op and might become an
639
647
  ** error in future versions of SQLite.
640
648
  */
641
649
  #define SQLITE_OPEN_READONLY 0x00000001 /* Ok for sqlite3_open_v2() */
@@ -729,7 +737,7 @@ SQLITE_API int sqlite3_exec(
729
737
  ** SQLite uses one of these integer values as the second
730
738
  ** argument to calls it makes to the xLock() and xUnlock() methods
731
739
  ** of an [sqlite3_io_methods] object. These values are ordered from
732
- ** lest restrictive to most restrictive.
740
+ ** least restrictive to most restrictive.
733
741
  **
734
742
  ** The argument to xLock() is always SHARED or higher. The argument to
735
743
  ** xUnlock is either SHARED or NONE.
@@ -970,7 +978,7 @@ struct sqlite3_io_methods {
970
978
  ** connection. See also [SQLITE_FCNTL_FILE_POINTER].
971
979
  **
972
980
  ** <li>[[SQLITE_FCNTL_SYNC_OMITTED]]
973
- ** No longer in use.
981
+ ** The SQLITE_FCNTL_SYNC_OMITTED file-control is no longer used.
974
982
  **
975
983
  ** <li>[[SQLITE_FCNTL_SYNC]]
976
984
  ** The [SQLITE_FCNTL_SYNC] opcode is generated internally by SQLite and
@@ -1045,7 +1053,7 @@ struct sqlite3_io_methods {
1045
1053
  **
1046
1054
  ** <li>[[SQLITE_FCNTL_VFSNAME]]
1047
1055
  ** ^The [SQLITE_FCNTL_VFSNAME] opcode can be used to obtain the names of
1048
- ** all [VFSes] in the VFS stack. The names are of all VFS shims and the
1056
+ ** all [VFSes] in the VFS stack. The names of all VFS shims and the
1049
1057
  ** final bottom-level VFS are written into memory obtained from
1050
1058
  ** [sqlite3_malloc()] and the result is stored in the char* variable
1051
1059
  ** that the fourth parameter of [sqlite3_file_control()] points to.
@@ -1059,7 +1067,7 @@ struct sqlite3_io_methods {
1059
1067
  ** ^The [SQLITE_FCNTL_VFS_POINTER] opcode finds a pointer to the top-level
1060
1068
  ** [VFSes] currently in use. ^(The argument X in
1061
1069
  ** sqlite3_file_control(db,SQLITE_FCNTL_VFS_POINTER,X) must be
1062
- ** of type "[sqlite3_vfs] **". This opcodes will set *X
1070
+ ** of type "[sqlite3_vfs] **". This opcode will set *X
1063
1071
  ** to a pointer to the top-level VFS.)^
1064
1072
  ** ^When there are multiple VFS shims in the stack, this opcode finds the
1065
1073
  ** upper-most shim only.
@@ -1249,7 +1257,7 @@ struct sqlite3_io_methods {
1249
1257
  ** <li>[[SQLITE_FCNTL_EXTERNAL_READER]]
1250
1258
  ** The EXPERIMENTAL [SQLITE_FCNTL_EXTERNAL_READER] opcode is used to detect
1251
1259
  ** whether or not there is a database client in another process with a wal-mode
1252
- ** transaction open on the database or not. It is only available on unix.The
1260
+ ** transaction open on the database or not. It is only available on unix. The
1253
1261
  ** (void*) argument passed with this file-control should be a pointer to a
1254
1262
  ** value of type (int). The integer value is set to 1 if the database is a wal
1255
1263
  ** mode database and there exists at least one client in another process that
@@ -1267,6 +1275,15 @@ struct sqlite3_io_methods {
1267
1275
  ** database is not a temp db, then the [SQLITE_FCNTL_RESET_CACHE] file-control
1268
1276
  ** purges the contents of the in-memory page cache. If there is an open
1269
1277
  ** transaction, or if the db is a temp-db, this opcode is a no-op, not an error.
1278
+ **
1279
+ ** <li>[[SQLITE_FCNTL_FILESTAT]]
1280
+ ** The [SQLITE_FCNTL_FILESTAT] opcode returns low-level diagnostic information
1281
+ ** about the [sqlite3_file] objects used access the database and journal files
1282
+ ** for the given schema. The fourth parameter to [sqlite3_file_control()]
1283
+ ** should be an initialized [sqlite3_str] pointer. JSON text describing
1284
+ ** various aspects of the sqlite3_file object is appended to the sqlite3_str.
1285
+ ** The SQLITE_FCNTL_FILESTAT opcode is usually a no-op, unless compile-time
1286
+ ** options are used to enable it.
1270
1287
  ** </ul>
1271
1288
  */
1272
1289
  #define SQLITE_FCNTL_LOCKSTATE 1
@@ -1312,6 +1329,7 @@ struct sqlite3_io_methods {
1312
1329
  #define SQLITE_FCNTL_RESET_CACHE 42
1313
1330
  #define SQLITE_FCNTL_NULL_IO 43
1314
1331
  #define SQLITE_FCNTL_BLOCK_ON_CONNECT 44
1332
+ #define SQLITE_FCNTL_FILESTAT 45
1315
1333
 
1316
1334
  /* deprecated names */
1317
1335
  #define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
@@ -1674,7 +1692,7 @@ struct sqlite3_vfs {
1674
1692
  ** SQLite interfaces so that an application usually does not need to
1675
1693
  ** invoke sqlite3_initialize() directly. For example, [sqlite3_open()]
1676
1694
  ** calls sqlite3_initialize() so the SQLite library will be automatically
1677
- ** initialized when [sqlite3_open()] is called if it has not be initialized
1695
+ ** initialized when [sqlite3_open()] is called if it has not been initialized
1678
1696
  ** already. ^However, if SQLite is compiled with the [SQLITE_OMIT_AUTOINIT]
1679
1697
  ** compile-time option, then the automatic calls to sqlite3_initialize()
1680
1698
  ** are omitted and the application must call sqlite3_initialize() directly
@@ -1931,21 +1949,21 @@ struct sqlite3_mem_methods {
1931
1949
  ** The [sqlite3_mem_methods]
1932
1950
  ** structure is filled with the currently defined memory allocation routines.)^
1933
1951
  ** This option can be used to overload the default memory allocation
1934
- ** routines with a wrapper that simulations memory allocation failure or
1952
+ ** routines with a wrapper that simulates memory allocation failure or
1935
1953
  ** tracks memory usage, for example. </dd>
1936
1954
  **
1937
1955
  ** [[SQLITE_CONFIG_SMALL_MALLOC]] <dt>SQLITE_CONFIG_SMALL_MALLOC</dt>
1938
- ** <dd> ^The SQLITE_CONFIG_SMALL_MALLOC option takes single argument of
1956
+ ** <dd> ^The SQLITE_CONFIG_SMALL_MALLOC option takes a single argument of
1939
1957
  ** type int, interpreted as a boolean, which if true provides a hint to
1940
1958
  ** SQLite that it should avoid large memory allocations if possible.
1941
1959
  ** SQLite will run faster if it is free to make large memory allocations,
1942
- ** but some application might prefer to run slower in exchange for
1960
+ ** but some applications might prefer to run slower in exchange for
1943
1961
  ** guarantees about memory fragmentation that are possible if large
1944
1962
  ** allocations are avoided. This hint is normally off.
1945
1963
  ** </dd>
1946
1964
  **
1947
1965
  ** [[SQLITE_CONFIG_MEMSTATUS]] <dt>SQLITE_CONFIG_MEMSTATUS</dt>
1948
- ** <dd> ^The SQLITE_CONFIG_MEMSTATUS option takes single argument of type int,
1966
+ ** <dd> ^The SQLITE_CONFIG_MEMSTATUS option takes a single argument of type int,
1949
1967
  ** interpreted as a boolean, which enables or disables the collection of
1950
1968
  ** memory allocation statistics. ^(When memory allocation statistics are
1951
1969
  ** disabled, the following SQLite interfaces become non-operational:
@@ -1990,7 +2008,7 @@ struct sqlite3_mem_methods {
1990
2008
  ** ^If pMem is NULL and N is non-zero, then each database connection
1991
2009
  ** does an initial bulk allocation for page cache memory
1992
2010
  ** from [sqlite3_malloc()] sufficient for N cache lines if N is positive or
1993
- ** of -1024*N bytes if N is negative, . ^If additional
2011
+ ** of -1024*N bytes if N is negative. ^If additional
1994
2012
  ** page cache memory is needed beyond what is provided by the initial
1995
2013
  ** allocation, then SQLite goes to [sqlite3_malloc()] separately for each
1996
2014
  ** additional cache line. </dd>
@@ -2019,7 +2037,7 @@ struct sqlite3_mem_methods {
2019
2037
  ** <dd> ^(The SQLITE_CONFIG_MUTEX option takes a single argument which is a
2020
2038
  ** pointer to an instance of the [sqlite3_mutex_methods] structure.
2021
2039
  ** The argument specifies alternative low-level mutex routines to be used
2022
- ** in place the mutex routines built into SQLite.)^ ^SQLite makes a copy of
2040
+ ** in place of the mutex routines built into SQLite.)^ ^SQLite makes a copy of
2023
2041
  ** the content of the [sqlite3_mutex_methods] structure before the call to
2024
2042
  ** [sqlite3_config()] returns. ^If SQLite is compiled with
2025
2043
  ** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
@@ -2061,7 +2079,7 @@ struct sqlite3_mem_methods {
2061
2079
  **
2062
2080
  ** [[SQLITE_CONFIG_GETPCACHE2]] <dt>SQLITE_CONFIG_GETPCACHE2</dt>
2063
2081
  ** <dd> ^(The SQLITE_CONFIG_GETPCACHE2 option takes a single argument which
2064
- ** is a pointer to an [sqlite3_pcache_methods2] object. SQLite copies of
2082
+ ** is a pointer to an [sqlite3_pcache_methods2] object. SQLite copies off
2065
2083
  ** the current page cache implementation into that object.)^ </dd>
2066
2084
  **
2067
2085
  ** [[SQLITE_CONFIG_LOG]] <dt>SQLITE_CONFIG_LOG</dt>
@@ -2078,7 +2096,7 @@ struct sqlite3_mem_methods {
2078
2096
  ** the logger function is a copy of the first parameter to the corresponding
2079
2097
  ** [sqlite3_log()] call and is intended to be a [result code] or an
2080
2098
  ** [extended result code]. ^The third parameter passed to the logger is
2081
- ** log message after formatting via [sqlite3_snprintf()].
2099
+ ** a log message after formatting via [sqlite3_snprintf()].
2082
2100
  ** The SQLite logging interface is not reentrant; the logger function
2083
2101
  ** supplied by the application must not invoke any SQLite interface.
2084
2102
  ** In a multi-threaded application, the application-defined logger
@@ -2269,7 +2287,7 @@ struct sqlite3_mem_methods {
2269
2287
  ** These constants are the available integer configuration options that
2270
2288
  ** can be passed as the second parameter to the [sqlite3_db_config()] interface.
2271
2289
  **
2272
- ** The [sqlite3_db_config()] interface is a var-args functions. It takes a
2290
+ ** The [sqlite3_db_config()] interface is a var-args function. It takes a
2273
2291
  ** variable number of parameters, though always at least two. The number of
2274
2292
  ** parameters passed into sqlite3_db_config() depends on which of these
2275
2293
  ** constants is given as the second parameter. This documentation page
@@ -2381,17 +2399,20 @@ struct sqlite3_mem_methods {
2381
2399
  **
2382
2400
  ** [[SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER]]
2383
2401
  ** <dt>SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER</dt>
2384
- ** <dd> ^This option is used to enable or disable the
2385
- ** [fts3_tokenizer()] function which is part of the
2386
- ** [FTS3] full-text search engine extension.
2387
- ** There must be two additional arguments.
2388
- ** The first argument is an integer which is 0 to disable fts3_tokenizer() or
2389
- ** positive to enable fts3_tokenizer() or negative to leave the setting
2390
- ** unchanged.
2391
- ** The second parameter is a pointer to an integer into which
2392
- ** is written 0 or 1 to indicate whether fts3_tokenizer is disabled or enabled
2393
- ** following this call. The second parameter may be a NULL pointer, in
2394
- ** which case the new setting is not reported back. </dd>
2402
+ ** <dd> ^This option is used to enable or disable using the
2403
+ ** [fts3_tokenizer()] function - part of the [FTS3] full-text search engine
2404
+ ** extension - without using bound parameters as the parameters. Doing so
2405
+ ** is disabled by default. There must be two additional arguments. The first
2406
+ ** argument is an integer. If it is passed 0, then using fts3_tokenizer()
2407
+ ** without bound parameters is disabled. If it is passed a positive value,
2408
+ ** then calling fts3_tokenizer without bound parameters is enabled. If it
2409
+ ** is passed a negative value, this setting is not modified - this can be
2410
+ ** used to query for the current setting. The second parameter is a pointer
2411
+ ** to an integer into which is written 0 or 1 to indicate the current value
2412
+ ** of this setting (after it is modified, if applicable). The second
2413
+ ** parameter may be a NULL pointer, in which case the value of the setting
2414
+ ** is not reported back. Refer to [FTS3] documentation for further details.
2415
+ ** </dd>
2395
2416
  **
2396
2417
  ** [[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION]]
2397
2418
  ** <dt>SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION</dt>
@@ -2403,8 +2424,8 @@ struct sqlite3_mem_methods {
2403
2424
  ** When the first argument to this interface is 1, then only the C-API is
2404
2425
  ** enabled and the SQL function remains disabled. If the first argument to
2405
2426
  ** this interface is 0, then both the C-API and the SQL function are disabled.
2406
- ** If the first argument is -1, then no changes are made to state of either the
2407
- ** C-API or the SQL function.
2427
+ ** If the first argument is -1, then no changes are made to the state of either
2428
+ ** the C-API or the SQL function.
2408
2429
  ** The second parameter is a pointer to an integer into which
2409
2430
  ** is written 0 or 1 to indicate whether [sqlite3_load_extension()] interface
2410
2431
  ** is disabled or enabled following this call. The second parameter may
@@ -2522,7 +2543,7 @@ struct sqlite3_mem_methods {
2522
2543
  ** [[SQLITE_DBCONFIG_LEGACY_ALTER_TABLE]]
2523
2544
  ** <dt>SQLITE_DBCONFIG_LEGACY_ALTER_TABLE</dt>
2524
2545
  ** <dd>The SQLITE_DBCONFIG_LEGACY_ALTER_TABLE option activates or deactivates
2525
- ** the legacy behavior of the [ALTER TABLE RENAME] command such it
2546
+ ** the legacy behavior of the [ALTER TABLE RENAME] command such that it
2526
2547
  ** behaves as it did prior to [version 3.24.0] (2018-06-04). See the
2527
2548
  ** "Compatibility Notice" on the [ALTER TABLE RENAME documentation] for
2528
2549
  ** additional information. This feature can also be turned on and off
@@ -2571,7 +2592,7 @@ struct sqlite3_mem_methods {
2571
2592
  ** <dt>SQLITE_DBCONFIG_LEGACY_FILE_FORMAT</dt>
2572
2593
  ** <dd>The SQLITE_DBCONFIG_LEGACY_FILE_FORMAT option activates or deactivates
2573
2594
  ** the legacy file format flag. When activated, this flag causes all newly
2574
- ** created database file to have a schema format version number (the 4-byte
2595
+ ** created database files to have a schema format version number (the 4-byte
2575
2596
  ** integer found at offset 44 into the database header) of 1. This in turn
2576
2597
  ** means that the resulting database file will be readable and writable by
2577
2598
  ** any SQLite version back to 3.0.0 ([dateof:3.0.0]). Without this setting,
@@ -2598,7 +2619,7 @@ struct sqlite3_mem_methods {
2598
2619
  ** the database handle both when the SQL statement is prepared and when it
2599
2620
  ** is stepped. The flag is set (collection of statistics is enabled)
2600
2621
  ** by default. <p>This option takes two arguments: an integer and a pointer to
2601
- ** an integer.. The first argument is 1, 0, or -1 to enable, disable, or
2622
+ ** an integer. The first argument is 1, 0, or -1 to enable, disable, or
2602
2623
  ** leave unchanged the statement scanstatus option. If the second argument
2603
2624
  ** is not NULL, then the value of the statement scanstatus setting after
2604
2625
  ** processing the first argument is written into the integer that the second
@@ -2641,8 +2662,8 @@ struct sqlite3_mem_methods {
2641
2662
  ** <dd>The SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE option enables or disables the
2642
2663
  ** ability of the [ATTACH DATABASE] SQL command to open a database for writing.
2643
2664
  ** This capability is enabled by default. Applications can disable or
2644
- ** reenable this capability using the current DBCONFIG option. If the
2645
- ** the this capability is disabled, the [ATTACH] command will still work,
2665
+ ** reenable this capability using the current DBCONFIG option. If
2666
+ ** this capability is disabled, the [ATTACH] command will still work,
2646
2667
  ** but the database will be opened read-only. If this option is disabled,
2647
2668
  ** then the ability to create a new database using [ATTACH] is also disabled,
2648
2669
  ** regardless of the value of the [SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE]
@@ -2676,7 +2697,7 @@ struct sqlite3_mem_methods {
2676
2697
  **
2677
2698
  ** <p>Most of the SQLITE_DBCONFIG options take two arguments, so that the
2678
2699
  ** overall call to [sqlite3_db_config()] has a total of four parameters.
2679
- ** The first argument (the third parameter to sqlite3_db_config()) is a integer.
2700
+ ** The first argument (the third parameter to sqlite3_db_config()) is an integer.
2680
2701
  ** The second argument is a pointer to an integer. If the first argument is 1,
2681
2702
  ** then the option becomes enabled. If the first integer argument is 0, then the
2682
2703
  ** option is disabled. If the first argument is -1, then the option setting
@@ -2966,7 +2987,7 @@ SQLITE_API int sqlite3_is_interrupted(sqlite3*);
2966
2987
  ** ^These routines return 0 if the statement is incomplete. ^If a
2967
2988
  ** memory allocation fails, then SQLITE_NOMEM is returned.
2968
2989
  **
2969
- ** ^These routines do not parse the SQL statements thus
2990
+ ** ^These routines do not parse the SQL statements and thus
2970
2991
  ** will not detect syntactically incorrect SQL.
2971
2992
  **
2972
2993
  ** ^(If SQLite has not been initialized using [sqlite3_initialize()] prior
@@ -3083,7 +3104,7 @@ SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms);
3083
3104
  ** indefinitely if possible. The results of passing any other negative value
3084
3105
  ** are undefined.
3085
3106
  **
3086
- ** Internally, each SQLite database handle store two timeout values - the
3107
+ ** Internally, each SQLite database handle stores two timeout values - the
3087
3108
  ** busy-timeout (used for rollback mode databases, or if the VFS does not
3088
3109
  ** support blocking locks) and the setlk-timeout (used for blocking locks
3089
3110
  ** on wal-mode databases). The sqlite3_busy_timeout() method sets both
@@ -3113,7 +3134,7 @@ SQLITE_API int sqlite3_setlk_timeout(sqlite3*, int ms, int flags);
3113
3134
  ** This is a legacy interface that is preserved for backwards compatibility.
3114
3135
  ** Use of this interface is not recommended.
3115
3136
  **
3116
- ** Definition: A <b>result table</b> is memory data structure created by the
3137
+ ** Definition: A <b>result table</b> is a memory data structure created by the
3117
3138
  ** [sqlite3_get_table()] interface. A result table records the
3118
3139
  ** complete query results from one or more queries.
3119
3140
  **
@@ -3256,7 +3277,7 @@ SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list);
3256
3277
  ** ^Calling sqlite3_free() with a pointer previously returned
3257
3278
  ** by sqlite3_malloc() or sqlite3_realloc() releases that memory so
3258
3279
  ** that it might be reused. ^The sqlite3_free() routine is
3259
- ** a no-op if is called with a NULL pointer. Passing a NULL pointer
3280
+ ** a no-op if it is called with a NULL pointer. Passing a NULL pointer
3260
3281
  ** to sqlite3_free() is harmless. After being freed, memory
3261
3282
  ** should neither be read nor written. Even reading previously freed
3262
3283
  ** memory might result in a segmentation fault or other severe error.
@@ -3274,13 +3295,13 @@ SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list);
3274
3295
  ** sqlite3_free(X).
3275
3296
  ** ^sqlite3_realloc(X,N) returns a pointer to a memory allocation
3276
3297
  ** of at least N bytes in size or NULL if insufficient memory is available.
3277
- ** ^If M is the size of the prior allocation, then min(N,M) bytes
3278
- ** of the prior allocation are copied into the beginning of buffer returned
3298
+ ** ^If M is the size of the prior allocation, then min(N,M) bytes of the
3299
+ ** prior allocation are copied into the beginning of the buffer returned
3279
3300
  ** by sqlite3_realloc(X,N) and the prior allocation is freed.
3280
3301
  ** ^If sqlite3_realloc(X,N) returns NULL and N is positive, then the
3281
3302
  ** prior allocation is not freed.
3282
3303
  **
3283
- ** ^The sqlite3_realloc64(X,N) interfaces works the same as
3304
+ ** ^The sqlite3_realloc64(X,N) interface works the same as
3284
3305
  ** sqlite3_realloc(X,N) except that N is a 64-bit unsigned integer instead
3285
3306
  ** of a 32-bit signed integer.
3286
3307
  **
@@ -3330,7 +3351,7 @@ SQLITE_API sqlite3_uint64 sqlite3_msize(void*);
3330
3351
  ** was last reset. ^The values returned by [sqlite3_memory_used()] and
3331
3352
  ** [sqlite3_memory_highwater()] include any overhead
3332
3353
  ** added by SQLite in its implementation of [sqlite3_malloc()],
3333
- ** but not overhead added by the any underlying system library
3354
+ ** but not overhead added by any underlying system library
3334
3355
  ** routines that [sqlite3_malloc()] may call.
3335
3356
  **
3336
3357
  ** ^The memory high-water mark is reset to the current value of
@@ -3782,7 +3803,7 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
3782
3803
  ** there is no harm in trying.)
3783
3804
  **
3784
3805
  ** ^(<dt>[SQLITE_OPEN_SHAREDCACHE]</dt>
3785
- ** <dd>The database is opened [shared cache] enabled, overriding
3806
+ ** <dd>The database is opened with [shared cache] enabled, overriding
3786
3807
  ** the default shared cache setting provided by
3787
3808
  ** [sqlite3_enable_shared_cache()].)^
3788
3809
  ** The [use of shared cache mode is discouraged] and hence shared cache
@@ -3790,7 +3811,7 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
3790
3811
  ** this option is a no-op.
3791
3812
  **
3792
3813
  ** ^(<dt>[SQLITE_OPEN_PRIVATECACHE]</dt>
3793
- ** <dd>The database is opened [shared cache] disabled, overriding
3814
+ ** <dd>The database is opened with [shared cache] disabled, overriding
3794
3815
  ** the default shared cache setting provided by
3795
3816
  ** [sqlite3_enable_shared_cache()].)^
3796
3817
  **
@@ -4208,7 +4229,7 @@ SQLITE_API void sqlite3_free_filename(sqlite3_filename);
4208
4229
  ** subsequent calls to other SQLite interface functions.)^
4209
4230
  **
4210
4231
  ** ^The sqlite3_errstr(E) interface returns the English-language text
4211
- ** that describes the [result code] E, as UTF-8, or NULL if E is not an
4232
+ ** that describes the [result code] E, as UTF-8, or NULL if E is not a
4212
4233
  ** result code for which a text error message is available.
4213
4234
  ** ^(Memory to hold the error message string is managed internally
4214
4235
  ** and must not be freed by the application)^.
@@ -4216,7 +4237,7 @@ SQLITE_API void sqlite3_free_filename(sqlite3_filename);
4216
4237
  ** ^If the most recent error references a specific token in the input
4217
4238
  ** SQL, the sqlite3_error_offset() interface returns the byte offset
4218
4239
  ** of the start of that token. ^The byte offset returned by
4219
- ** sqlite3_error_offset() assumes that the input SQL is UTF8.
4240
+ ** sqlite3_error_offset() assumes that the input SQL is UTF-8.
4220
4241
  ** ^If the most recent error does not reference a specific token in the input
4221
4242
  ** SQL, then the sqlite3_error_offset() function returns -1.
4222
4243
  **
@@ -4241,6 +4262,34 @@ SQLITE_API const void *sqlite3_errmsg16(sqlite3*);
4241
4262
  SQLITE_API const char *sqlite3_errstr(int);
4242
4263
  SQLITE_API int sqlite3_error_offset(sqlite3 *db);
4243
4264
 
4265
+ /*
4266
+ ** CAPI3REF: Set Error Codes And Message
4267
+ ** METHOD: sqlite3
4268
+ **
4269
+ ** Set the error code of the database handle passed as the first argument
4270
+ ** to errcode, and the error message to a copy of nul-terminated string
4271
+ ** zErrMsg. If zErrMsg is passed NULL, then the error message is set to
4272
+ ** the default message associated with the supplied error code. Subsequent
4273
+ ** calls to [sqlite3_errcode()] and [sqlite3_errmsg()] and similar will
4274
+ ** return the values set by this routine in place of what was previously
4275
+ ** set by SQLite itself.
4276
+ **
4277
+ ** This function returns SQLITE_OK if the error code and error message are
4278
+ ** successfully set, SQLITE_NOMEM if an OOM occurs, and SQLITE_MISUSE if
4279
+ ** the database handle is NULL or invalid.
4280
+ **
4281
+ ** The error code and message set by this routine remains in effect until
4282
+ ** they are changed, either by another call to this routine or until they are
4283
+ ** changed to by SQLite itself to reflect the result of some subsquent
4284
+ ** API call.
4285
+ **
4286
+ ** This function is intended for use by SQLite extensions or wrappers. The
4287
+ ** idea is that an extension or wrapper can use this routine to set error
4288
+ ** messages and error codes and thus behave more like a core SQLite
4289
+ ** feature from the point of view of an application.
4290
+ */
4291
+ SQLITE_API int sqlite3_set_errmsg(sqlite3 *db, int errcode, const char *zErrMsg);
4292
+
4244
4293
  /*
4245
4294
  ** CAPI3REF: Prepared Statement Object
4246
4295
  ** KEYWORDS: {prepared statement} {prepared statements}
@@ -4315,8 +4364,8 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
4315
4364
  **
4316
4365
  ** These constants define various performance limits
4317
4366
  ** that can be lowered at run-time using [sqlite3_limit()].
4318
- ** The synopsis of the meanings of the various limits is shown below.
4319
- ** Additional information is available at [limits | Limits in SQLite].
4367
+ ** A concise description of these limits follows, and additional information
4368
+ ** is available at [limits | Limits in SQLite].
4320
4369
  **
4321
4370
  ** <dl>
4322
4371
  ** [[SQLITE_LIMIT_LENGTH]] ^(<dt>SQLITE_LIMIT_LENGTH</dt>
@@ -4381,7 +4430,7 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
4381
4430
  /*
4382
4431
  ** CAPI3REF: Prepare Flags
4383
4432
  **
4384
- ** These constants define various flags that can be passed into
4433
+ ** These constants define various flags that can be passed into the
4385
4434
  ** "prepFlags" parameter of the [sqlite3_prepare_v3()] and
4386
4435
  ** [sqlite3_prepare16_v3()] interfaces.
4387
4436
  **
@@ -4468,7 +4517,7 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
4468
4517
  ** there is a small performance advantage to passing an nByte parameter that
4469
4518
  ** is the number of bytes in the input string <i>including</i>
4470
4519
  ** the nul-terminator.
4471
- ** Note that nByte measure the length of the input in bytes, not
4520
+ ** Note that nByte measures the length of the input in bytes, not
4472
4521
  ** characters, even for the UTF-16 interfaces.
4473
4522
  **
4474
4523
  ** ^If pzTail is not NULL then *pzTail is made to point to the first byte
@@ -4602,7 +4651,7 @@ SQLITE_API int sqlite3_prepare16_v3(
4602
4651
  **
4603
4652
  ** ^The sqlite3_expanded_sql() interface returns NULL if insufficient memory
4604
4653
  ** is available to hold the result, or if the result would exceed the
4605
- ** the maximum string length determined by the [SQLITE_LIMIT_LENGTH].
4654
+ ** maximum string length determined by the [SQLITE_LIMIT_LENGTH].
4606
4655
  **
4607
4656
  ** ^The [SQLITE_TRACE_SIZE_LIMIT] compile-time option limits the size of
4608
4657
  ** bound parameter expansions. ^The [SQLITE_OMIT_TRACE] compile-time
@@ -4790,7 +4839,7 @@ typedef struct sqlite3_value sqlite3_value;
4790
4839
  **
4791
4840
  ** The context in which an SQL function executes is stored in an
4792
4841
  ** sqlite3_context object. ^A pointer to an sqlite3_context object
4793
- ** is always first parameter to [application-defined SQL functions].
4842
+ ** is always the first parameter to [application-defined SQL functions].
4794
4843
  ** The application-defined SQL function implementation will pass this
4795
4844
  ** pointer through into calls to [sqlite3_result_int | sqlite3_result()],
4796
4845
  ** [sqlite3_aggregate_context()], [sqlite3_user_data()],
@@ -4914,9 +4963,11 @@ typedef struct sqlite3_context sqlite3_context;
4914
4963
  ** associated with the pointer P of type T. ^D is either a NULL pointer or
4915
4964
  ** a pointer to a destructor function for P. ^SQLite will invoke the
4916
4965
  ** destructor D with a single argument of P when it is finished using
4917
- ** P. The T parameter should be a static string, preferably a string
4918
- ** literal. The sqlite3_bind_pointer() routine is part of the
4919
- ** [pointer passing interface] added for SQLite 3.20.0.
4966
+ ** P, even if the call to sqlite3_bind_pointer() fails. Due to a
4967
+ ** historical design quirk, results are undefined if D is
4968
+ ** SQLITE_TRANSIENT. The T parameter should be a static string,
4969
+ ** preferably a string literal. The sqlite3_bind_pointer() routine is
4970
+ ** part of the [pointer passing interface] added for SQLite 3.20.0.
4920
4971
  **
4921
4972
  ** ^If any of the sqlite3_bind_*() routines are called with a NULL pointer
4922
4973
  ** for the [prepared statement] or with a prepared statement for which
@@ -5527,7 +5578,7 @@ SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol);
5527
5578
  **
5528
5579
  ** ^The sqlite3_finalize() function is called to delete a [prepared statement].
5529
5580
  ** ^If the most recent evaluation of the statement encountered no errors
5530
- ** or if the statement is never been evaluated, then sqlite3_finalize() returns
5581
+ ** or if the statement has never been evaluated, then sqlite3_finalize() returns
5531
5582
  ** SQLITE_OK. ^If the most recent evaluation of statement S failed, then
5532
5583
  ** sqlite3_finalize(S) returns the appropriate [error code] or
5533
5584
  ** [extended error code].
@@ -5759,7 +5810,7 @@ SQLITE_API int sqlite3_create_window_function(
5759
5810
  /*
5760
5811
  ** CAPI3REF: Text Encodings
5761
5812
  **
5762
- ** These constant define integer codes that represent the various
5813
+ ** These constants define integer codes that represent the various
5763
5814
  ** text encodings supported by SQLite.
5764
5815
  */
5765
5816
  #define SQLITE_UTF8 1 /* IMP: R-37514-35566 */
@@ -5851,7 +5902,7 @@ SQLITE_API int sqlite3_create_window_function(
5851
5902
  ** result.
5852
5903
  ** Every function that invokes [sqlite3_result_subtype()] should have this
5853
5904
  ** property. If it does not, then the call to [sqlite3_result_subtype()]
5854
- ** might become a no-op if the function is used as term in an
5905
+ ** might become a no-op if the function is used as a term in an
5855
5906
  ** [expression index]. On the other hand, SQL functions that never invoke
5856
5907
  ** [sqlite3_result_subtype()] should avoid setting this property, as the
5857
5908
  ** purpose of this property is to disable certain optimizations that are
@@ -5978,7 +6029,7 @@ SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int6
5978
6029
  ** sqlite3_value_nochange(X) interface returns true if and only if
5979
6030
  ** the column corresponding to X is unchanged by the UPDATE operation
5980
6031
  ** that the xUpdate method call was invoked to implement and if
5981
- ** and the prior [xColumn] method call that was invoked to extracted
6032
+ ** the prior [xColumn] method call that was invoked to extract
5982
6033
  ** the value for that column returned without setting a result (probably
5983
6034
  ** because it queried [sqlite3_vtab_nochange()] and found that the column
5984
6035
  ** was unchanging). ^Within an [xUpdate] method, any value for which
@@ -6251,6 +6302,7 @@ SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(voi
6251
6302
  ** or a NULL pointer if there were no prior calls to
6252
6303
  ** sqlite3_set_clientdata() with the same values of D and N.
6253
6304
  ** Names are compared using strcmp() and are thus case sensitive.
6305
+ ** It returns 0 on success and SQLITE_NOMEM on allocation failure.
6254
6306
  **
6255
6307
  ** If P and X are both non-NULL, then the destructor X is invoked with
6256
6308
  ** argument P on the first of the following occurrences:
@@ -8927,9 +8979,18 @@ SQLITE_API int sqlite3_status64(
8927
8979
  ** ^The sqlite3_db_status() routine returns SQLITE_OK on success and a
8928
8980
  ** non-zero [error code] on failure.
8929
8981
  **
8982
+ ** ^The sqlite3_db_status64(D,O,C,H,R) routine works exactly the same
8983
+ ** way as sqlite3_db_status(D,O,C,H,R) routine except that the C and H
8984
+ ** parameters are pointer to 64-bit integers (type: sqlite3_int64) instead
8985
+ ** of pointers to 32-bit integers, which allows larger status values
8986
+ ** to be returned. If a status value exceeds 2,147,483,647 then
8987
+ ** sqlite3_db_status() will truncate the value whereas sqlite3_db_status64()
8988
+ ** will return the full value.
8989
+ **
8930
8990
  ** See also: [sqlite3_status()] and [sqlite3_stmt_status()].
8931
8991
  */
8932
8992
  SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);
8993
+ SQLITE_API int sqlite3_db_status64(sqlite3*,int,sqlite3_int64*,sqlite3_int64*,int);
8933
8994
 
8934
8995
  /*
8935
8996
  ** CAPI3REF: Status Parameters for database connections
@@ -9026,6 +9087,10 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
9026
9087
  ** If an IO or other error occurs while writing a page to disk, the effect
9027
9088
  ** on subsequent SQLITE_DBSTATUS_CACHE_WRITE requests is undefined.)^ ^The
9028
9089
  ** highwater mark associated with SQLITE_DBSTATUS_CACHE_WRITE is always 0.
9090
+ ** <p>
9091
+ ** ^(There is overlap between the quantities measured by this parameter
9092
+ ** (SQLITE_DBSTATUS_CACHE_WRITE) and SQLITE_DBSTATUS_TEMPBUF_SPILL.
9093
+ ** Resetting one will reduce the other.)^
9029
9094
  ** </dd>
9030
9095
  **
9031
9096
  ** [[SQLITE_DBSTATUS_CACHE_SPILL]] ^(<dt>SQLITE_DBSTATUS_CACHE_SPILL</dt>
@@ -9041,6 +9106,18 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
9041
9106
  ** <dd>This parameter returns zero for the current value if and only if
9042
9107
  ** all foreign key constraints (deferred or immediate) have been
9043
9108
  ** resolved.)^ ^The highwater mark is always 0.
9109
+ **
9110
+ ** [[SQLITE_DBSTATUS_TEMPBUF_SPILL] ^(<dt>SQLITE_DBSTATUS_TEMPBUF_SPILL</dt>
9111
+ ** <dd>^(This parameter returns the number of bytes written to temporary
9112
+ ** files on disk that could have been kept in memory had sufficient memory
9113
+ ** been available. This value includes writes to intermediate tables that
9114
+ ** are part of complex queries, external sorts that spill to disk, and
9115
+ ** writes to TEMP tables.)^
9116
+ ** ^The highwater mark is always 0.
9117
+ ** <p>
9118
+ ** ^(There is overlap between the quantities measured by this parameter
9119
+ ** (SQLITE_DBSTATUS_TEMPBUF_SPILL) and SQLITE_DBSTATUS_CACHE_WRITE.
9120
+ ** Resetting one will reduce the other.)^
9044
9121
  ** </dd>
9045
9122
  ** </dl>
9046
9123
  */
@@ -9057,7 +9134,8 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
9057
9134
  #define SQLITE_DBSTATUS_DEFERRED_FKS 10
9058
9135
  #define SQLITE_DBSTATUS_CACHE_USED_SHARED 11
9059
9136
  #define SQLITE_DBSTATUS_CACHE_SPILL 12
9060
- #define SQLITE_DBSTATUS_MAX 12 /* Largest defined DBSTATUS */
9137
+ #define SQLITE_DBSTATUS_TEMPBUF_SPILL 13
9138
+ #define SQLITE_DBSTATUS_MAX 13 /* Largest defined DBSTATUS */
9061
9139
 
9062
9140
 
9063
9141
  /*
@@ -9822,7 +9900,7 @@ SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);
9822
9900
  ** is the number of pages currently in the write-ahead log file,
9823
9901
  ** including those that were just committed.
9824
9902
  **
9825
- ** The callback function should normally return [SQLITE_OK]. ^If an error
9903
+ ** ^The callback function should normally return [SQLITE_OK]. ^If an error
9826
9904
  ** code is returned, that error will propagate back up through the
9827
9905
  ** SQLite code base to cause the statement that provoked the callback
9828
9906
  ** to report an error, though the commit will have still occurred. If the
@@ -9830,13 +9908,26 @@ SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);
9830
9908
  ** that does not correspond to any valid SQLite error code, the results
9831
9909
  ** are undefined.
9832
9910
  **
9833
- ** A single database handle may have at most a single write-ahead log callback
9834
- ** registered at one time. ^Calling [sqlite3_wal_hook()] replaces any
9835
- ** previously registered write-ahead log callback. ^The return value is
9836
- ** a copy of the third parameter from the previous call, if any, or 0.
9837
- ** ^Note that the [sqlite3_wal_autocheckpoint()] interface and the
9838
- ** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will
9839
- ** overwrite any prior [sqlite3_wal_hook()] settings.
9911
+ ** ^A single database handle may have at most a single write-ahead log
9912
+ ** callback registered at one time. ^Calling [sqlite3_wal_hook()]
9913
+ ** replaces the default behavior or previously registered write-ahead
9914
+ ** log callback.
9915
+ **
9916
+ ** ^The return value is a copy of the third parameter from the
9917
+ ** previous call, if any, or 0.
9918
+ **
9919
+ ** ^The [sqlite3_wal_autocheckpoint()] interface and the
9920
+ ** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and
9921
+ ** will overwrite any prior [sqlite3_wal_hook()] settings.
9922
+ **
9923
+ ** ^If a write-ahead log callback is set using this function then
9924
+ ** [sqlite3_wal_checkpoint_v2()] or [PRAGMA wal_checkpoint]
9925
+ ** should be invoked periodically to keep the write-ahead log file
9926
+ ** from growing without bound.
9927
+ **
9928
+ ** ^Passing a NULL pointer for the callback disables automatic
9929
+ ** checkpointing entirely. To re-enable the default behavior, call
9930
+ ** sqlite3_wal_autocheckpoint(db,1000) or use [PRAGMA wal_checkpoint].
9840
9931
  */
9841
9932
  SQLITE_API void *sqlite3_wal_hook(
9842
9933
  sqlite3*,
@@ -9853,7 +9944,7 @@ SQLITE_API void *sqlite3_wal_hook(
9853
9944
  ** to automatically [checkpoint]
9854
9945
  ** after committing a transaction if there are N or
9855
9946
  ** more frames in the [write-ahead log] file. ^Passing zero or
9856
- ** a negative value as the nFrame parameter disables automatic
9947
+ ** a negative value as the N parameter disables automatic
9857
9948
  ** checkpoints entirely.
9858
9949
  **
9859
9950
  ** ^The callback registered by this function replaces any existing callback
@@ -9869,9 +9960,10 @@ SQLITE_API void *sqlite3_wal_hook(
9869
9960
  **
9870
9961
  ** ^Every new [database connection] defaults to having the auto-checkpoint
9871
9962
  ** enabled with a threshold of 1000 or [SQLITE_DEFAULT_WAL_AUTOCHECKPOINT]
9872
- ** pages. The use of this interface
9873
- ** is only necessary if the default setting is found to be suboptimal
9874
- ** for a particular application.
9963
+ ** pages.
9964
+ **
9965
+ ** ^The use of this interface is only necessary if the default setting
9966
+ ** is found to be suboptimal for a particular application.
9875
9967
  */
9876
9968
  SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
9877
9969
 
@@ -9936,6 +10028,11 @@ SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);
9936
10028
  ** ^This mode works the same way as SQLITE_CHECKPOINT_RESTART with the
9937
10029
  ** addition that it also truncates the log file to zero bytes just prior
9938
10030
  ** to a successful return.
10031
+ **
10032
+ ** <dt>SQLITE_CHECKPOINT_NOOP<dd>
10033
+ ** ^This mode always checkpoints zero frames. The only reason to invoke
10034
+ ** a NOOP checkpoint is to access the values returned by
10035
+ ** sqlite3_wal_checkpoint_v2() via output parameters *pnLog and *pnCkpt.
9939
10036
  ** </dl>
9940
10037
  **
9941
10038
  ** ^If pnLog is not NULL, then *pnLog is set to the total number of frames in
@@ -10006,6 +10103,7 @@ SQLITE_API int sqlite3_wal_checkpoint_v2(
10006
10103
  ** See the [sqlite3_wal_checkpoint_v2()] documentation for details on the
10007
10104
  ** meaning of each of these checkpoint modes.
10008
10105
  */
10106
+ #define SQLITE_CHECKPOINT_NOOP -1 /* Do no work at all */
10009
10107
  #define SQLITE_CHECKPOINT_PASSIVE 0 /* Do as much as possible w/o blocking */
10010
10108
  #define SQLITE_CHECKPOINT_FULL 1 /* Wait for writers, then checkpoint */
10011
10109
  #define SQLITE_CHECKPOINT_RESTART 2 /* Like FULL but wait for readers */
@@ -10374,7 +10472,7 @@ SQLITE_API int sqlite3_vtab_in(sqlite3_index_info*, int iCons, int bHandle);
10374
10472
  ** &nbsp; ){
10375
10473
  ** &nbsp; // do something with pVal
10376
10474
  ** &nbsp; }
10377
- ** &nbsp; if( rc!=SQLITE_OK ){
10475
+ ** &nbsp; if( rc!=SQLITE_DONE ){
10378
10476
  ** &nbsp; // an error has occurred
10379
10477
  ** &nbsp; }
10380
10478
  ** </pre></blockquote>)^
@@ -10833,7 +10931,7 @@ typedef struct sqlite3_snapshot {
10833
10931
  ** The [sqlite3_snapshot_get()] interface is only available when the
10834
10932
  ** [SQLITE_ENABLE_SNAPSHOT] compile-time option is used.
10835
10933
  */
10836
- SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_get(
10934
+ SQLITE_API int sqlite3_snapshot_get(
10837
10935
  sqlite3 *db,
10838
10936
  const char *zSchema,
10839
10937
  sqlite3_snapshot **ppSnapshot
@@ -10882,7 +10980,7 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_get(
10882
10980
  ** The [sqlite3_snapshot_open()] interface is only available when the
10883
10981
  ** [SQLITE_ENABLE_SNAPSHOT] compile-time option is used.
10884
10982
  */
10885
- SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_open(
10983
+ SQLITE_API int sqlite3_snapshot_open(
10886
10984
  sqlite3 *db,
10887
10985
  const char *zSchema,
10888
10986
  sqlite3_snapshot *pSnapshot
@@ -10899,7 +10997,7 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_open(
10899
10997
  ** The [sqlite3_snapshot_free()] interface is only available when the
10900
10998
  ** [SQLITE_ENABLE_SNAPSHOT] compile-time option is used.
10901
10999
  */
10902
- SQLITE_API SQLITE_EXPERIMENTAL void sqlite3_snapshot_free(sqlite3_snapshot*);
11000
+ SQLITE_API void sqlite3_snapshot_free(sqlite3_snapshot*);
10903
11001
 
10904
11002
  /*
10905
11003
  ** CAPI3REF: Compare the ages of two snapshot handles.
@@ -10926,7 +11024,7 @@ SQLITE_API SQLITE_EXPERIMENTAL void sqlite3_snapshot_free(sqlite3_snapshot*);
10926
11024
  ** This interface is only available if SQLite is compiled with the
10927
11025
  ** [SQLITE_ENABLE_SNAPSHOT] option.
10928
11026
  */
10929
- SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_cmp(
11027
+ SQLITE_API int sqlite3_snapshot_cmp(
10930
11028
  sqlite3_snapshot *p1,
10931
11029
  sqlite3_snapshot *p2
10932
11030
  );
@@ -10954,7 +11052,7 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_cmp(
10954
11052
  ** This interface is only available if SQLite is compiled with the
10955
11053
  ** [SQLITE_ENABLE_SNAPSHOT] option.
10956
11054
  */
10957
- SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const char *zDb);
11055
+ SQLITE_API int sqlite3_snapshot_recover(sqlite3 *db, const char *zDb);
10958
11056
 
10959
11057
  /*
10960
11058
  ** CAPI3REF: Serialize a database
@@ -11028,12 +11126,13 @@ SQLITE_API unsigned char *sqlite3_serialize(
11028
11126
  **
11029
11127
  ** The sqlite3_deserialize(D,S,P,N,M,F) interface causes the
11030
11128
  ** [database connection] D to disconnect from database S and then
11031
- ** reopen S as an in-memory database based on the serialization contained
11032
- ** in P. The serialized database P is N bytes in size. M is the size of
11033
- ** the buffer P, which might be larger than N. If M is larger than N, and
11034
- ** the SQLITE_DESERIALIZE_READONLY bit is not set in F, then SQLite is
11035
- ** permitted to add content to the in-memory database as long as the total
11036
- ** size does not exceed M bytes.
11129
+ ** reopen S as an in-memory database based on the serialization
11130
+ ** contained in P. If S is a NULL pointer, the main database is
11131
+ ** used. The serialized database P is N bytes in size. M is the size
11132
+ ** of the buffer P, which might be larger than N. If M is larger than
11133
+ ** N, and the SQLITE_DESERIALIZE_READONLY bit is not set in F, then
11134
+ ** SQLite is permitted to add content to the in-memory database as
11135
+ ** long as the total size does not exceed M bytes.
11037
11136
  **
11038
11137
  ** If the SQLITE_DESERIALIZE_FREEONCLOSE bit is set in F, then SQLite will
11039
11138
  ** invoke sqlite3_free() on the serialization buffer when the database
@@ -11100,6 +11199,54 @@ SQLITE_API int sqlite3_deserialize(
11100
11199
  #define SQLITE_DESERIALIZE_RESIZEABLE 2 /* Resize using sqlite3_realloc64() */
11101
11200
  #define SQLITE_DESERIALIZE_READONLY 4 /* Database is read-only */
11102
11201
 
11202
+ /*
11203
+ ** CAPI3REF: Bind array values to the CARRAY table-valued function
11204
+ **
11205
+ ** The sqlite3_carray_bind(S,I,P,N,F,X) interface binds an array value to
11206
+ ** one of the first argument of the [carray() table-valued function]. The
11207
+ ** S parameter is a pointer to the [prepared statement] that uses the carray()
11208
+ ** functions. I is the parameter index to be bound. P is a pointer to the
11209
+ ** array to be bound, and N is the number of eements in the array. The
11210
+ ** F argument is one of constants [SQLITE_CARRAY_INT32], [SQLITE_CARRAY_INT64],
11211
+ ** [SQLITE_CARRAY_DOUBLE], [SQLITE_CARRAY_TEXT], or [SQLITE_CARRAY_BLOB] to
11212
+ ** indicate the datatype of the array being bound. The X argument is not a
11213
+ ** NULL pointer, then SQLite will invoke the function X on the P parameter
11214
+ ** after it has finished using P, even if the call to
11215
+ ** sqlite3_carray_bind() fails. The special-case finalizer
11216
+ ** SQLITE_TRANSIENT has no effect here.
11217
+ */
11218
+ SQLITE_API int sqlite3_carray_bind(
11219
+ sqlite3_stmt *pStmt, /* Statement to be bound */
11220
+ int i, /* Parameter index */
11221
+ void *aData, /* Pointer to array data */
11222
+ int nData, /* Number of data elements */
11223
+ int mFlags, /* CARRAY flags */
11224
+ void (*xDel)(void*) /* Destructor for aData */
11225
+ );
11226
+
11227
+ /*
11228
+ ** CAPI3REF: Datatypes for the CARRAY table-valued function
11229
+ **
11230
+ ** The fifth argument to the [sqlite3_carray_bind()] interface musts be
11231
+ ** one of the following constants, to specify the datatype of the array
11232
+ ** that is being bound into the [carray table-valued function].
11233
+ */
11234
+ #define SQLITE_CARRAY_INT32 0 /* Data is 32-bit signed integers */
11235
+ #define SQLITE_CARRAY_INT64 1 /* Data is 64-bit signed integers */
11236
+ #define SQLITE_CARRAY_DOUBLE 2 /* Data is doubles */
11237
+ #define SQLITE_CARRAY_TEXT 3 /* Data is char* */
11238
+ #define SQLITE_CARRAY_BLOB 4 /* Data is struct iovec */
11239
+
11240
+ /*
11241
+ ** Versions of the above #defines that omit the initial SQLITE_, for
11242
+ ** legacy compatibility.
11243
+ */
11244
+ #define CARRAY_INT32 0 /* Data is 32-bit signed integers */
11245
+ #define CARRAY_INT64 1 /* Data is 64-bit signed integers */
11246
+ #define CARRAY_DOUBLE 2 /* Data is doubles */
11247
+ #define CARRAY_TEXT 3 /* Data is char* */
11248
+ #define CARRAY_BLOB 4 /* Data is struct iovec */
11249
+
11103
11250
  /*
11104
11251
  ** Undo the hack that converts floating point types to integer for
11105
11252
  ** builds on processors without floating point support.
@@ -12359,14 +12506,32 @@ SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup*);
12359
12506
  ** update the "main" database attached to handle db with the changes found in
12360
12507
  ** the changeset passed via the second and third arguments.
12361
12508
  **
12509
+ ** All changes made by these functions are enclosed in a savepoint transaction.
12510
+ ** If any other error (aside from a constraint failure when attempting to
12511
+ ** write to the target database) occurs, then the savepoint transaction is
12512
+ ** rolled back, restoring the target database to its original state, and an
12513
+ ** SQLite error code returned. Additionally, starting with version 3.51.0,
12514
+ ** an error code and error message that may be accessed using the
12515
+ ** [sqlite3_errcode()] and [sqlite3_errmsg()] APIs are left in the database
12516
+ ** handle.
12517
+ **
12362
12518
  ** The fourth argument (xFilter) passed to these functions is the "filter
12363
- ** callback". If it is not NULL, then for each table affected by at least one
12364
- ** change in the changeset, the filter callback is invoked with
12365
- ** the table name as the second argument, and a copy of the context pointer
12366
- ** passed as the sixth argument as the first. If the "filter callback"
12367
- ** returns zero, then no attempt is made to apply any changes to the table.
12368
- ** Otherwise, if the return value is non-zero or the xFilter argument to
12369
- ** is NULL, all changes related to the table are attempted.
12519
+ ** callback". This may be passed NULL, in which case all changes in the
12520
+ ** changeset are applied to the database. For sqlite3changeset_apply() and
12521
+ ** sqlite3_changeset_apply_v2(), if it is not NULL, then it is invoked once
12522
+ ** for each table affected by at least one change in the changeset. In this
12523
+ ** case the table name is passed as the second argument, and a copy of
12524
+ ** the context pointer passed as the sixth argument to apply() or apply_v2()
12525
+ ** as the first. If the "filter callback" returns zero, then no attempt is
12526
+ ** made to apply any changes to the table. Otherwise, if the return value is
12527
+ ** non-zero, all changes related to the table are attempted.
12528
+ **
12529
+ ** For sqlite3_changeset_apply_v3(), the xFilter callback is invoked once
12530
+ ** per change. The second argument in this case is an sqlite3_changeset_iter
12531
+ ** that may be queried using the usual APIs for the details of the current
12532
+ ** change. If the "filter callback" returns zero in this case, then no attempt
12533
+ ** is made to apply the current change. If it returns non-zero, the change
12534
+ ** is applied.
12370
12535
  **
12371
12536
  ** For each table that is not excluded by the filter callback, this function
12372
12537
  ** tests that the target database contains a compatible table. A table is
@@ -12387,11 +12552,11 @@ SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup*);
12387
12552
  ** one such warning is issued for each table in the changeset.
12388
12553
  **
12389
12554
  ** For each change for which there is a compatible table, an attempt is made
12390
- ** to modify the table contents according to the UPDATE, INSERT or DELETE
12391
- ** change. If a change cannot be applied cleanly, the conflict handler
12392
- ** function passed as the fifth argument to sqlite3changeset_apply() may be
12393
- ** invoked. A description of exactly when the conflict handler is invoked for
12394
- ** each type of change is below.
12555
+ ** to modify the table contents according to each UPDATE, INSERT or DELETE
12556
+ ** change that is not excluded by a filter callback. If a change cannot be
12557
+ ** applied cleanly, the conflict handler function passed as the fifth argument
12558
+ ** to sqlite3changeset_apply() may be invoked. A description of exactly when
12559
+ ** the conflict handler is invoked for each type of change is below.
12395
12560
  **
12396
12561
  ** Unlike the xFilter argument, xConflict may not be passed NULL. The results
12397
12562
  ** of passing anything other than a valid function pointer as the xConflict
@@ -12487,12 +12652,6 @@ SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup*);
12487
12652
  ** This can be used to further customize the application's conflict
12488
12653
  ** resolution strategy.
12489
12654
  **
12490
- ** All changes made by these functions are enclosed in a savepoint transaction.
12491
- ** If any other error (aside from a constraint failure when attempting to
12492
- ** write to the target database) occurs, then the savepoint transaction is
12493
- ** rolled back, restoring the target database to its original state, and an
12494
- ** SQLite error code returned.
12495
- **
12496
12655
  ** If the output parameters (ppRebase) and (pnRebase) are non-NULL and
12497
12656
  ** the input is a changeset (not a patchset), then sqlite3changeset_apply_v2()
12498
12657
  ** may set (*ppRebase) to point to a "rebase" that may be used with the
@@ -12542,6 +12701,23 @@ SQLITE_API int sqlite3changeset_apply_v2(
12542
12701
  void **ppRebase, int *pnRebase, /* OUT: Rebase data */
12543
12702
  int flags /* SESSION_CHANGESETAPPLY_* flags */
12544
12703
  );
12704
+ SQLITE_API int sqlite3changeset_apply_v3(
12705
+ sqlite3 *db, /* Apply change to "main" db of this handle */
12706
+ int nChangeset, /* Size of changeset in bytes */
12707
+ void *pChangeset, /* Changeset blob */
12708
+ int(*xFilter)(
12709
+ void *pCtx, /* Copy of sixth arg to _apply() */
12710
+ sqlite3_changeset_iter *p /* Handle describing change */
12711
+ ),
12712
+ int(*xConflict)(
12713
+ void *pCtx, /* Copy of sixth arg to _apply() */
12714
+ int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */
12715
+ sqlite3_changeset_iter *p /* Handle describing change and conflict */
12716
+ ),
12717
+ void *pCtx, /* First argument passed to xConflict */
12718
+ void **ppRebase, int *pnRebase, /* OUT: Rebase data */
12719
+ int flags /* SESSION_CHANGESETAPPLY_* flags */
12720
+ );
12545
12721
 
12546
12722
  /*
12547
12723
  ** CAPI3REF: Flags for sqlite3changeset_apply_v2
@@ -12961,6 +13137,23 @@ SQLITE_API int sqlite3changeset_apply_v2_strm(
12961
13137
  void **ppRebase, int *pnRebase,
12962
13138
  int flags
12963
13139
  );
13140
+ SQLITE_API int sqlite3changeset_apply_v3_strm(
13141
+ sqlite3 *db, /* Apply change to "main" db of this handle */
13142
+ int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */
13143
+ void *pIn, /* First arg for xInput */
13144
+ int(*xFilter)(
13145
+ void *pCtx, /* Copy of sixth arg to _apply() */
13146
+ sqlite3_changeset_iter *p
13147
+ ),
13148
+ int(*xConflict)(
13149
+ void *pCtx, /* Copy of sixth arg to _apply() */
13150
+ int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */
13151
+ sqlite3_changeset_iter *p /* Handle describing change and conflict */
13152
+ ),
13153
+ void *pCtx, /* First argument passed to xConflict */
13154
+ void **ppRebase, int *pnRebase,
13155
+ int flags
13156
+ );
12964
13157
  SQLITE_API int sqlite3changeset_concat_strm(
12965
13158
  int (*xInputA)(void *pIn, void *pData, int *pnData),
12966
13159
  void *pInA,