better-sqlite3-multiple-ciphers 12.8.0 → 12.9.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.
@@ -3,7 +3,7 @@
3
3
  ** Purpose: Header file for SQLite3 Multiple Ciphers support
4
4
  ** Author: Ulrich Telle
5
5
  ** Created: 2020-03-01
6
- ** Copyright: (c) 2019-2024 Ulrich Telle
6
+ ** Copyright: (c) 2019-2026 Ulrich Telle
7
7
  ** License: MIT
8
8
  */
9
9
 
@@ -31,9 +31,9 @@
31
31
 
32
32
  #define SQLITE3MC_VERSION_MAJOR 2
33
33
  #define SQLITE3MC_VERSION_MINOR 3
34
- #define SQLITE3MC_VERSION_RELEASE 1
34
+ #define SQLITE3MC_VERSION_RELEASE 3
35
35
  #define SQLITE3MC_VERSION_SUBRELEASE 0
36
- #define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 2.3.1"
36
+ #define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 2.3.3"
37
37
 
38
38
  #endif /* SQLITE3MC_VERSION_H_ */
39
39
  /*** End of #include "sqlite3mc_version.h" ***/
@@ -192,12 +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.51.3"
196
- #define SQLITE_VERSION_NUMBER 3051003
197
- #define SQLITE_SOURCE_ID "2026-03-13 10:38:09 737ae4a34738ffa0c3ff7f9bb18df914dd1cad163f28fd6b6e114a344fe6d618"
198
- #define SQLITE_SCM_BRANCH "branch-3.51"
199
- #define SQLITE_SCM_TAGS "release version-3.51.3"
200
- #define SQLITE_SCM_DATETIME "2026-03-13T10:38:09.694Z"
195
+ #define SQLITE_VERSION "3.53.0"
196
+ #define SQLITE_VERSION_NUMBER 3053000
197
+ #define SQLITE_SOURCE_ID "2026-04-09 11:41:38 4525003a53a7fc63ca75c59b22c79608659ca12f0131f52c18637f829977f20b"
198
+ #define SQLITE_SCM_BRANCH "trunk"
199
+ #define SQLITE_SCM_TAGS "release major-release version-3.53.0"
200
+ #define SQLITE_SCM_DATETIME "2026-04-09T11:41:38.498Z"
201
201
 
202
202
  /*
203
203
  ** CAPI3REF: Run-Time Library Version Numbers
@@ -624,7 +624,7 @@ SQLITE_API int sqlite3_exec(
624
624
  #define SQLITE_WARNING_AUTOINDEX (SQLITE_WARNING | (1<<8))
625
625
  #define SQLITE_AUTH_USER (SQLITE_AUTH | (1<<8))
626
626
  #define SQLITE_OK_LOAD_PERMANENTLY (SQLITE_OK | (1<<8))
627
- #define SQLITE_OK_SYMLINK (SQLITE_OK | (2<<8)) /* internal use only */
627
+ #define SQLITE_OK_SYMLINK (SQLITE_OK | (2<<8)) /* internal only */
628
628
 
629
629
  /*
630
630
  ** CAPI3REF: Flags For File Open Operations
@@ -1336,6 +1336,12 @@ struct sqlite3_io_methods {
1336
1336
  #define SQLITE_SET_LOCKPROXYFILE SQLITE_FCNTL_SET_LOCKPROXYFILE
1337
1337
  #define SQLITE_LAST_ERRNO SQLITE_FCNTL_LAST_ERRNO
1338
1338
 
1339
+ /* reserved file-control numbers:
1340
+ ** 101
1341
+ ** 102
1342
+ ** 103
1343
+ */
1344
+
1339
1345
 
1340
1346
  /*
1341
1347
  ** CAPI3REF: Mutex Handle
@@ -1536,7 +1542,7 @@ typedef const char *sqlite3_filename;
1536
1542
  ** greater and the function pointer is not NULL) and will fall back
1537
1543
  ** to xCurrentTime() if xCurrentTimeInt64() is unavailable.
1538
1544
  **
1539
- ** ^The xSetSystemCall(), xGetSystemCall(), and xNestSystemCall() interfaces
1545
+ ** ^The xSetSystemCall(), xGetSystemCall(), and xNextSystemCall() interfaces
1540
1546
  ** are not used by the SQLite core. These optional interfaces are provided
1541
1547
  ** by some VFSes to facilitate testing of the VFS code. By overriding
1542
1548
  ** system calls with functions under its control, a test program can
@@ -1757,7 +1763,8 @@ SQLITE_API int sqlite3_os_end(void);
1757
1763
  ** are called "anytime configuration options".
1758
1764
  ** ^If sqlite3_config() is called after [sqlite3_initialize()] and before
1759
1765
  ** [sqlite3_shutdown()] with a first argument that is not an anytime
1760
- ** configuration option, then the sqlite3_config() call will return SQLITE_MISUSE.
1766
+ ** configuration option, then the sqlite3_config() call will
1767
+ ** return SQLITE_MISUSE.
1761
1768
  ** Note, however, that ^sqlite3_config() can be called as part of the
1762
1769
  ** implementation of an application-defined [sqlite3_os_init()].
1763
1770
  **
@@ -2323,9 +2330,10 @@ struct sqlite3_mem_methods {
2323
2330
  ** is less than 8. The "sz" argument should be a multiple of 8 less than
2324
2331
  ** 65536. If "sz" does not meet this constraint, it is reduced in size until
2325
2332
  ** it does.
2326
- ** <li><p>The third argument ("cnt") is the number of slots. Lookaside is disabled
2327
- ** if "cnt"is less than 1. The "cnt" value will be reduced, if necessary, so
2328
- ** that the product of "sz" and "cnt" does not exceed 2,147,418,112. The "cnt"
2333
+ ** <li><p>The third argument ("cnt") is the number of slots.
2334
+ ** Lookaside is disabled if "cnt"is less than 1.
2335
+ * The "cnt" value will be reduced, if necessary, so
2336
+ ** that the product of "sz" and "cnt" does not exceed 2,147,418,112. The "cnt"
2329
2337
  ** parameter is usually chosen so that the product of "sz" and "cnt" is less
2330
2338
  ** than 1,000,000.
2331
2339
  ** </ol>
@@ -2613,12 +2621,15 @@ struct sqlite3_mem_methods {
2613
2621
  ** [[SQLITE_DBCONFIG_STMT_SCANSTATUS]]
2614
2622
  ** <dt>SQLITE_DBCONFIG_STMT_SCANSTATUS</dt>
2615
2623
  ** <dd>The SQLITE_DBCONFIG_STMT_SCANSTATUS option is only useful in
2616
- ** SQLITE_ENABLE_STMT_SCANSTATUS builds. In this case, it sets or clears
2617
- ** a flag that enables collection of the sqlite3_stmt_scanstatus_v2()
2618
- ** statistics. For statistics to be collected, the flag must be set on
2619
- ** the database handle both when the SQL statement is prepared and when it
2620
- ** is stepped. The flag is set (collection of statistics is enabled)
2621
- ** by default. <p>This option takes two arguments: an integer and a pointer to
2624
+ ** [SQLITE_ENABLE_STMT_SCANSTATUS] builds. In this case, it sets or clears
2625
+ ** a flag that enables collection of run-time performance statistics
2626
+ ** used by [sqlite3_stmt_scanstatus_v2()] and the [nexec and ncycle]
2627
+ ** columns of the [bytecode virtual table].
2628
+ ** For statistics to be collected, the flag must be set on
2629
+ ** the database handle both when the SQL statement is
2630
+ ** [sqlite3_prepare|prepared] and when it is [sqlite3_step|stepped].
2631
+ ** The flag is set (collection of statistics is enabled) by default.
2632
+ ** <p>This option takes two arguments: an integer and a pointer to
2622
2633
  ** an integer. The first argument is 1, 0, or -1 to enable, disable, or
2623
2634
  ** leave unchanged the statement scanstatus option. If the second argument
2624
2635
  ** is not NULL, then the value of the statement scanstatus setting after
@@ -2691,16 +2702,34 @@ struct sqlite3_mem_methods {
2691
2702
  ** comments are allowed in SQL text after processing the first argument.
2692
2703
  ** </dd>
2693
2704
  **
2705
+ ** [[SQLITE_DBCONFIG_FP_DIGITS]]
2706
+ ** <dt>SQLITE_DBCONFIG_FP_DIGITS</dt>
2707
+ ** <dd>The SQLITE_DBCONFIG_FP_DIGITS setting is a small integer that determines
2708
+ ** the number of significant digits that SQLite will attempt to preserve when
2709
+ ** converting floating point numbers (IEEE 754 "doubles") into text. The
2710
+ ** default value 17, as of SQLite version 3.52.0. The value was 15 in all
2711
+ ** prior versions.<p>
2712
+ ** This option takes two arguments which are an integer and a pointer
2713
+ ** to an integer. The first argument is a small integer, between 3 and 23, or
2714
+ ** zero. The FP_DIGITS setting is changed to that small integer, or left
2715
+ ** unaltered if the first argument is zero or out of range. The second argument
2716
+ ** is a pointer to an integer. If the pointer is not NULL, then the value of
2717
+ ** the FP_DIGITS setting, after possibly being modified by the first
2718
+ ** arguments, is written into the integer to which the second argument points.
2719
+ ** </dd>
2720
+ **
2694
2721
  ** </dl>
2695
2722
  **
2696
2723
  ** [[DBCONFIG arguments]] <h3>Arguments To SQLITE_DBCONFIG Options</h3>
2697
2724
  **
2698
2725
  ** <p>Most of the SQLITE_DBCONFIG options take two arguments, so that the
2699
2726
  ** overall call to [sqlite3_db_config()] has a total of four parameters.
2700
- ** The first argument (the third parameter to sqlite3_db_config()) is an integer.
2701
- ** The second argument is a pointer to an integer. If the first argument is 1,
2702
- ** then the option becomes enabled. If the first integer argument is 0, then the
2703
- ** option is disabled. If the first argument is -1, then the option setting
2727
+ ** The first argument (the third parameter to sqlite3_db_config()) is
2728
+ ** an integer.
2729
+ ** The second argument is a pointer to an integer. If the first argument is 1,
2730
+ ** then the option becomes enabled. If the first integer argument is 0,
2731
+ ** then the option is disabled.
2732
+ ** If the first argument is -1, then the option setting
2704
2733
  ** is unchanged. The second argument, the pointer to an integer, may be NULL.
2705
2734
  ** If the second argument is not NULL, then a value of 0 or 1 is written into
2706
2735
  ** the integer to which the second argument points, depending on whether the
@@ -2708,9 +2737,10 @@ struct sqlite3_mem_methods {
2708
2737
  ** the first argument.
2709
2738
  **
2710
2739
  ** <p>While most SQLITE_DBCONFIG options use the argument format
2711
- ** described in the previous paragraph, the [SQLITE_DBCONFIG_MAINDBNAME]
2712
- ** and [SQLITE_DBCONFIG_LOOKASIDE] options are different. See the
2713
- ** documentation of those exceptional options for details.
2740
+ ** described in the previous paragraph, the [SQLITE_DBCONFIG_MAINDBNAME],
2741
+ ** [SQLITE_DBCONFIG_LOOKASIDE], and [SQLITE_DBCONFIG_FP_DIGITS] options
2742
+ ** are different. See the documentation of those exceptional options for
2743
+ ** details.
2714
2744
  */
2715
2745
  #define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */
2716
2746
  #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */
@@ -2735,7 +2765,8 @@ struct sqlite3_mem_methods {
2735
2765
  #define SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE 1020 /* int int* */
2736
2766
  #define SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE 1021 /* int int* */
2737
2767
  #define SQLITE_DBCONFIG_ENABLE_COMMENTS 1022 /* int int* */
2738
- #define SQLITE_DBCONFIG_MAX 1022 /* Largest DBCONFIG */
2768
+ #define SQLITE_DBCONFIG_FP_DIGITS 1023 /* int int* */
2769
+ #define SQLITE_DBCONFIG_MAX 1023 /* Largest DBCONFIG */
2739
2770
 
2740
2771
  /*
2741
2772
  ** CAPI3REF: Enable Or Disable Extended Result Codes
@@ -4217,6 +4248,7 @@ SQLITE_API void sqlite3_free_filename(sqlite3_filename);
4217
4248
  ** <li> sqlite3_errmsg()
4218
4249
  ** <li> sqlite3_errmsg16()
4219
4250
  ** <li> sqlite3_error_offset()
4251
+ ** <li> sqlite3_db_handle()
4220
4252
  ** </ul>
4221
4253
  **
4222
4254
  ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
@@ -4263,7 +4295,7 @@ SQLITE_API const char *sqlite3_errstr(int);
4263
4295
  SQLITE_API int sqlite3_error_offset(sqlite3 *db);
4264
4296
 
4265
4297
  /*
4266
- ** CAPI3REF: Set Error Codes And Message
4298
+ ** CAPI3REF: Set Error Code And Message
4267
4299
  ** METHOD: sqlite3
4268
4300
  **
4269
4301
  ** Set the error code of the database handle passed as the first argument
@@ -4382,6 +4414,10 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
4382
4414
  ** [[SQLITE_LIMIT_EXPR_DEPTH]] ^(<dt>SQLITE_LIMIT_EXPR_DEPTH</dt>
4383
4415
  ** <dd>The maximum depth of the parse tree on any expression.</dd>)^
4384
4416
  **
4417
+ ** [[SQLITE_LIMIT_PARSER_DEPTH]] ^(<dt>SQLITE_LIMIT_PARSER_DEPTH</dt>
4418
+ ** <dd>The maximum depth of the LALR(1) parser stack used to analyze
4419
+ ** input SQL statements.</dd>)^
4420
+ **
4385
4421
  ** [[SQLITE_LIMIT_COMPOUND_SELECT]] ^(<dt>SQLITE_LIMIT_COMPOUND_SELECT</dt>
4386
4422
  ** <dd>The maximum number of terms in a compound SELECT statement.</dd>)^
4387
4423
  **
@@ -4426,6 +4462,7 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
4426
4462
  #define SQLITE_LIMIT_VARIABLE_NUMBER 9
4427
4463
  #define SQLITE_LIMIT_TRIGGER_DEPTH 10
4428
4464
  #define SQLITE_LIMIT_WORKER_THREADS 11
4465
+ #define SQLITE_LIMIT_PARSER_DEPTH 12
4429
4466
 
4430
4467
  /*
4431
4468
  ** CAPI3REF: Prepare Flags
@@ -4470,12 +4507,29 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
4470
4507
  ** fails, the sqlite3_prepare_v3() call returns the same error indications
4471
4508
  ** with or without this flag; it just omits the call to [sqlite3_log()] that
4472
4509
  ** logs the error.
4510
+ **
4511
+ ** [[SQLITE_PREPARE_FROM_DDL]] <dt>SQLITE_PREPARE_FROM_DDL</dt>
4512
+ ** <dd>The SQLITE_PREPARE_FROM_DDL flag causes the SQL compiler to enforce
4513
+ ** security constraints that would otherwise only be enforced when parsing
4514
+ ** the database schema. In other words, the SQLITE_PREPARE_FROM_DDL flag
4515
+ ** causes the SQL compiler to treat the SQL statement being prepared as if
4516
+ ** it had come from an attacker. When SQLITE_PREPARE_FROM_DDL is used and
4517
+ ** [SQLITE_DBCONFIG_TRUSTED_SCHEMA] is off, SQL functions may only be called
4518
+ ** if they are tagged with [SQLITE_INNOCUOUS] and virtual tables may only
4519
+ ** be used if they are tagged with [SQLITE_VTAB_INNOCUOUS]. Best practice
4520
+ ** is to use the SQLITE_PREPARE_FROM_DDL option when preparing any SQL that
4521
+ ** is derived from parts of the database schema. In particular, virtual
4522
+ ** table implementations that run SQL statements that are derived from
4523
+ ** arguments to their CREATE VIRTUAL TABLE statement should always use
4524
+ ** [sqlite3_prepare_v3()] and set the SQLITE_PREPARE_FROM_DDL flag to
4525
+ ** prevent bypass of the [SQLITE_DBCONFIG_TRUSTED_SCHEMA] security checks.
4473
4526
  ** </dl>
4474
4527
  */
4475
4528
  #define SQLITE_PREPARE_PERSISTENT 0x01
4476
4529
  #define SQLITE_PREPARE_NORMALIZE 0x02
4477
4530
  #define SQLITE_PREPARE_NO_VTAB 0x04
4478
4531
  #define SQLITE_PREPARE_DONT_LOG 0x10
4532
+ #define SQLITE_PREPARE_FROM_DDL 0x20
4479
4533
 
4480
4534
  /*
4481
4535
  ** CAPI3REF: Compiling An SQL Statement
@@ -4489,8 +4543,9 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
4489
4543
  **
4490
4544
  ** The preferred routine to use is [sqlite3_prepare_v2()]. The
4491
4545
  ** [sqlite3_prepare()] interface is legacy and should be avoided.
4492
- ** [sqlite3_prepare_v3()] has an extra "prepFlags" option that is used
4493
- ** for special purposes.
4546
+ ** [sqlite3_prepare_v3()] has an extra
4547
+ ** [SQLITE_PREPARE_FROM_DDL|"prepFlags" option] that is sometimes
4548
+ ** needed for special purpose or to pass along security restrictions.
4494
4549
  **
4495
4550
  ** The use of the UTF-8 interfaces is preferred, as SQLite currently
4496
4551
  ** does all parsing using UTF-8. The UTF-16 interfaces are provided
@@ -4895,8 +4950,8 @@ typedef struct sqlite3_context sqlite3_context;
4895
4950
  ** it should be a pointer to well-formed UTF16 text.
4896
4951
  ** ^If the third parameter to sqlite3_bind_text64() is not NULL, then
4897
4952
  ** it should be a pointer to a well-formed unicode string that is
4898
- ** either UTF8 if the sixth parameter is SQLITE_UTF8, or UTF16
4899
- ** otherwise.
4953
+ ** either UTF8 if the sixth parameter is SQLITE_UTF8 or SQLITE_UTF8_ZT,
4954
+ ** or UTF16 otherwise.
4900
4955
  **
4901
4956
  ** [[byte-order determination rules]] ^The byte-order of
4902
4957
  ** UTF16 input text is determined by the byte-order mark (BOM, U+FEFF)
@@ -4942,10 +4997,15 @@ typedef struct sqlite3_context sqlite3_context;
4942
4997
  ** object and pointer to it must remain valid until then. ^SQLite will then
4943
4998
  ** manage the lifetime of its private copy.
4944
4999
  **
4945
- ** ^The sixth argument to sqlite3_bind_text64() must be one of
4946
- ** [SQLITE_UTF8], [SQLITE_UTF16], [SQLITE_UTF16BE], or [SQLITE_UTF16LE]
4947
- ** to specify the encoding of the text in the third parameter. If
4948
- ** the sixth argument to sqlite3_bind_text64() is not one of the
5000
+ ** ^The sixth argument (the E argument)
5001
+ ** to sqlite3_bind_text64(S,K,Z,N,D,E) must be one of
5002
+ ** [SQLITE_UTF8], [SQLITE_UTF8_ZT], [SQLITE_UTF16], [SQLITE_UTF16BE],
5003
+ ** or [SQLITE_UTF16LE] to specify the encoding of the text in the
5004
+ ** third parameter, Z. The special value [SQLITE_UTF8_ZT] means that the
5005
+ ** string argument is both UTF-8 encoded and is zero-terminated. In other
5006
+ ** words, SQLITE_UTF8_ZT means that the Z array is allocated to hold at
5007
+ ** least N+1 bytes and that the Z&#91;N&#93; byte is zero. If
5008
+ ** the E argument to sqlite3_bind_text64(S,K,Z,N,D,E) is not one of the
4949
5009
  ** allowed values shown above, or if the text encoding is different
4950
5010
  ** from the encoding specified by the sixth parameter, then the behavior
4951
5011
  ** is undefined.
@@ -5812,6 +5872,52 @@ SQLITE_API int sqlite3_create_window_function(
5812
5872
  **
5813
5873
  ** These constants define integer codes that represent the various
5814
5874
  ** text encodings supported by SQLite.
5875
+ **
5876
+ ** <dl>
5877
+ ** [[SQLITE_UTF8]] <dt>SQLITE_UTF8</dt><dd>Text is encoding as UTF-8</dd>
5878
+ **
5879
+ ** [[SQLITE_UTF16LE]] <dt>SQLITE_UTF16LE</dt><dd>Text is encoding as UTF-16
5880
+ ** with each code point being expressed "little endian" - the least significant
5881
+ ** byte first. This is the usual encoding, for example on Windows.</dd>
5882
+ **
5883
+ ** [[SQLITE_UTF16BE]] <dt>SQLITE_UTF16BE</dt><dd>Text is encoding as UTF-16
5884
+ ** with each code point being expressed "big endian" - the most significant
5885
+ ** byte first. This encoding is less common, but is still sometimes seen,
5886
+ ** specially on older systems.
5887
+ **
5888
+ ** [[SQLITE_UTF16]] <dt>SQLITE_UTF16</dt><dd>Text is encoding as UTF-16
5889
+ ** with each code point being expressed either little endian or as big
5890
+ ** endian, according to the native endianness of the host computer.
5891
+ **
5892
+ ** [[SQLITE_ANY]] <dt>SQLITE_ANY</dt><dd>This encoding value may only be used
5893
+ ** to declare the preferred text for [application-defined SQL functions]
5894
+ ** created using [sqlite3_create_function()] and similar. If the preferred
5895
+ ** encoding (the 4th parameter to sqlite3_create_function() - the eTextRep
5896
+ ** parameter) is SQLITE_ANY, that indicates that the function does not have
5897
+ ** a preference regarding the text encoding of its parameters and can take
5898
+ ** any text encoding that the SQLite core find convenient to supply. This
5899
+ ** option is deprecated. Please do not use it in new applications.
5900
+ **
5901
+ ** [[SQLITE_UTF16_ALIGNED]] <dt>SQLITE_UTF16_ALIGNED</dt><dd>This encoding
5902
+ ** value may be used as the 3rd parameter (the eTextRep parameter) to
5903
+ ** [sqlite3_create_collation()] and similar. This encoding value means
5904
+ ** that the application-defined collating sequence created expects its
5905
+ ** input strings to be in UTF16 in native byte order, and that the start
5906
+ ** of the strings must be aligned to a 2-byte boundary.
5907
+ **
5908
+ ** [[SQLITE_UTF8_ZT]] <dt>SQLITE_UTF8_ZT</dt><dd>This option can only be
5909
+ ** used to specify the text encoding to strings input to
5910
+ ** [sqlite3_result_text64()] and [sqlite3_bind_text64()].
5911
+ ** The SQLITE_UTF8_ZT encoding means that the input string (call it "z")
5912
+ ** is UTF-8 encoded and that it is zero-terminated. If the length parameter
5913
+ ** (call it "n") is non-negative, this encoding option means that the caller
5914
+ ** guarantees that z array contains at least n+1 bytes and that the z&#91;n&#93;
5915
+ ** byte has a value of zero.
5916
+ ** This option gives the same output as SQLITE_UTF8, but can be more efficient
5917
+ ** by avoiding the need to make a copy of the input string, in some cases.
5918
+ ** However, if z is allocated to hold fewer than n+1 bytes or if the
5919
+ ** z&#91;n&#93; byte is not zero, undefined behavior may result.
5920
+ ** </dl>
5815
5921
  */
5816
5922
  #define SQLITE_UTF8 1 /* IMP: R-37514-35566 */
5817
5923
  #define SQLITE_UTF16LE 2 /* IMP: R-03371-37637 */
@@ -5819,6 +5925,7 @@ SQLITE_API int sqlite3_create_window_function(
5819
5925
  #define SQLITE_UTF16 4 /* Use native byte order */
5820
5926
  #define SQLITE_ANY 5 /* Deprecated */
5821
5927
  #define SQLITE_UTF16_ALIGNED 8 /* sqlite3_create_collation only */
5928
+ #define SQLITE_UTF8_ZT 16 /* Zero-terminated UTF8 */
5822
5929
 
5823
5930
  /*
5824
5931
  ** CAPI3REF: Function Flags
@@ -6053,26 +6160,22 @@ SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int6
6053
6160
  ** the SQL function that supplied the [sqlite3_value*] parameters.
6054
6161
  **
6055
6162
  ** As long as the input parameter is correct, these routines can only
6056
- ** fail if an out-of-memory error occurs during a format conversion.
6057
- ** Only the following subset of interfaces are subject to out-of-memory
6058
- ** errors:
6059
- **
6060
- ** <ul>
6061
- ** <li> sqlite3_value_blob()
6062
- ** <li> sqlite3_value_text()
6063
- ** <li> sqlite3_value_text16()
6064
- ** <li> sqlite3_value_text16le()
6065
- ** <li> sqlite3_value_text16be()
6066
- ** <li> sqlite3_value_bytes()
6067
- ** <li> sqlite3_value_bytes16()
6068
- ** </ul>
6069
- **
6163
+ ** fail if an out-of-memory error occurs while trying to do a
6164
+ ** UTF8&rarr;UTF16 or UTF16&rarr;UTF8 conversion.
6070
6165
  ** If an out-of-memory error occurs, then the return value from these
6071
6166
  ** routines is the same as if the column had contained an SQL NULL value.
6072
- ** Valid SQL NULL returns can be distinguished from out-of-memory errors
6073
- ** by invoking the [sqlite3_errcode()] immediately after the suspect
6167
+ ** If the input sqlite3_value was not obtained from [sqlite3_value_dup()],
6168
+ ** then valid SQL NULL returns can also be distinguished from
6169
+ ** out-of-memory errors after extracting the value
6170
+ ** by invoking the [sqlite3_errcode()] immediately after the suspicious
6074
6171
  ** return value is obtained and before any
6075
6172
  ** other SQLite interface is called on the same [database connection].
6173
+ ** If the input sqlite3_value was obtained from sqlite3_value_dup() then
6174
+ ** it is disconnected from the database connection and so sqlite3_errcode()
6175
+ ** will not work.
6176
+ ** In that case, the only way to distinguish an out-of-memory
6177
+ ** condition from a true SQL NULL is to invoke sqlite3_value_type() on the
6178
+ ** input to see if it is NULL prior to trying to extract the value.
6076
6179
  */
6077
6180
  SQLITE_API const void *sqlite3_value_blob(sqlite3_value*);
6078
6181
  SQLITE_API double sqlite3_value_double(sqlite3_value*);
@@ -6099,7 +6202,8 @@ SQLITE_API int sqlite3_value_frombind(sqlite3_value*);
6099
6202
  ** of the value X, assuming that X has type TEXT.)^ If sqlite3_value_type(X)
6100
6203
  ** returns something other than SQLITE_TEXT, then the return value from
6101
6204
  ** sqlite3_value_encoding(X) is meaningless. ^Calls to
6102
- ** [sqlite3_value_text(X)], [sqlite3_value_text16(X)], [sqlite3_value_text16be(X)],
6205
+ ** [sqlite3_value_text(X)], [sqlite3_value_text16(X)],
6206
+ ** [sqlite3_value_text16be(X)],
6103
6207
  ** [sqlite3_value_text16le(X)], [sqlite3_value_bytes(X)], or
6104
6208
  ** [sqlite3_value_bytes16(X)] might change the encoding of the value X and
6105
6209
  ** thus change the return from subsequent calls to sqlite3_value_encoding(X).
@@ -6230,17 +6334,17 @@ SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*);
6230
6334
  ** query execution, under some circumstances the associated auxiliary data
6231
6335
  ** might be preserved. An example of where this might be useful is in a
6232
6336
  ** regular-expression matching function. The compiled version of the regular
6233
- ** expression can be stored as auxiliary data associated with the pattern string.
6234
- ** Then as long as the pattern string remains the same,
6337
+ ** expression can be stored as auxiliary data associated with the pattern
6338
+ ** string. Then as long as the pattern string remains the same,
6235
6339
  ** the compiled regular expression can be reused on multiple
6236
6340
  ** invocations of the same function.
6237
6341
  **
6238
- ** ^The sqlite3_get_auxdata(C,N) interface returns a pointer to the auxiliary data
6239
- ** associated by the sqlite3_set_auxdata(C,N,P,X) function with the Nth argument
6240
- ** value to the application-defined function. ^N is zero for the left-most
6241
- ** function argument. ^If there is no auxiliary data
6242
- ** associated with the function argument, the sqlite3_get_auxdata(C,N) interface
6243
- ** returns a NULL pointer.
6342
+ ** ^The sqlite3_get_auxdata(C,N) interface returns a pointer to the auxiliary
6343
+ ** data associated by the sqlite3_set_auxdata(C,N,P,X) function with the
6344
+ ** Nth argument value to the application-defined function. ^N is zero
6345
+ ** for the left-most function argument. ^If there is no auxiliary data
6346
+ ** associated with the function argument, the sqlite3_get_auxdata(C,N)
6347
+ ** interface returns a NULL pointer.
6244
6348
  **
6245
6349
  ** ^The sqlite3_set_auxdata(C,N,P,X) interface saves P as auxiliary data for the
6246
6350
  ** N-th argument of the application-defined function. ^Subsequent
@@ -6324,10 +6428,14 @@ SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(voi
6324
6428
  **
6325
6429
  ** There is no limit (other than available memory) on the number of different
6326
6430
  ** client data pointers (with different names) that can be attached to a
6327
- ** single database connection. However, the implementation is optimized
6328
- ** for the case of having only one or two different client data names.
6329
- ** Applications and wrapper libraries are discouraged from using more than
6330
- ** one client data name each.
6431
+ ** single database connection. However, the current implementation stores
6432
+ ** the content on a linked list. Insert and retrieval performance will
6433
+ ** be proportional to the number of entries. The design use case, and
6434
+ ** the use case for which the implementation is optimized, is
6435
+ ** that an application will store only small number of client data names,
6436
+ ** typically just one or two. This interface is not intended to be a
6437
+ ** generalized key/value store for thousands or millions of keys. It
6438
+ ** will work for that, but performance might be disappointing.
6331
6439
  **
6332
6440
  ** There is no way to enumerate the client data pointers
6333
6441
  ** associated with a database connection. The N parameter can be thought
@@ -6435,10 +6543,14 @@ typedef void (*sqlite3_destructor_type)(void*);
6435
6543
  ** set the return value of the application-defined function to be
6436
6544
  ** a text string which is represented as UTF-8, UTF-16 native byte order,
6437
6545
  ** UTF-16 little endian, or UTF-16 big endian, respectively.
6438
- ** ^The sqlite3_result_text64() interface sets the return value of an
6546
+ ** ^The sqlite3_result_text64(C,Z,N,D,E) interface sets the return value of an
6439
6547
  ** application-defined function to be a text string in an encoding
6440
- ** specified by the fifth (and last) parameter, which must be one
6441
- ** of [SQLITE_UTF8], [SQLITE_UTF16], [SQLITE_UTF16BE], or [SQLITE_UTF16LE].
6548
+ ** specified the E parameter, which must be one
6549
+ ** of [SQLITE_UTF8], [SQLITE_UTF8_ZT], [SQLITE_UTF16], [SQLITE_UTF16BE],
6550
+ ** or [SQLITE_UTF16LE]. ^The special value [SQLITE_UTF8_ZT] means that
6551
+ ** the result text is both UTF-8 and zero-terminated. In other words,
6552
+ ** SQLITE_UTF8_ZT means that the Z array holds at least N+1 bytes and that
6553
+ ** the Z&#91;N&#93; is zero.
6442
6554
  ** ^SQLite takes the text result from the application from
6443
6555
  ** the 2nd parameter of the sqlite3_result_text* interfaces.
6444
6556
  ** ^If the 3rd parameter to any of the sqlite3_result_text* interfaces
@@ -6525,7 +6637,7 @@ SQLITE_API void sqlite3_result_int(sqlite3_context*, int);
6525
6637
  SQLITE_API void sqlite3_result_int64(sqlite3_context*, sqlite3_int64);
6526
6638
  SQLITE_API void sqlite3_result_null(sqlite3_context*);
6527
6639
  SQLITE_API void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*));
6528
- SQLITE_API void sqlite3_result_text64(sqlite3_context*, const char*,sqlite3_uint64,
6640
+ SQLITE_API void sqlite3_result_text64(sqlite3_context*, const char *z, sqlite3_uint64 n,
6529
6641
  void(*)(void*), unsigned char encoding);
6530
6642
  SQLITE_API void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*));
6531
6643
  SQLITE_API void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));
@@ -7464,7 +7576,7 @@ SQLITE_API int sqlite3_table_column_metadata(
7464
7576
  ** ^The sqlite3_load_extension() interface attempts to load an
7465
7577
  ** [SQLite extension] library contained in the file zFile. If
7466
7578
  ** the file cannot be loaded directly, attempts are made to load
7467
- ** with various operating-system specific extensions added.
7579
+ ** with various operating-system specific filename extensions added.
7468
7580
  ** So for example, if "samplelib" cannot be loaded, then names like
7469
7581
  ** "samplelib.so" or "samplelib.dylib" or "samplelib.dll" might
7470
7582
  ** be tried also.
@@ -7472,10 +7584,10 @@ SQLITE_API int sqlite3_table_column_metadata(
7472
7584
  ** ^The entry point is zProc.
7473
7585
  ** ^(zProc may be 0, in which case SQLite will try to come up with an
7474
7586
  ** entry point name on its own. It first tries "sqlite3_extension_init".
7475
- ** If that does not work, it constructs a name "sqlite3_X_init" where
7476
- ** X consists of the lower-case equivalent of all ASCII alphabetic
7477
- ** characters in the filename from the last "/" to the first following
7478
- ** "." and omitting any initial "lib".)^
7587
+ ** If that does not work, it tries names of the form "sqlite3_X_init"
7588
+ ** where X consists of the lower-case equivalent of all ASCII alphabetic
7589
+ ** characters or all ASCII alphanumeric characters in the filename from
7590
+ ** the last "/" to the first following "." and omitting any initial "lib".)^
7479
7591
  ** ^The sqlite3_load_extension() interface returns
7480
7592
  ** [SQLITE_OK] on success and [SQLITE_ERROR] if something goes wrong.
7481
7593
  ** ^If an error occurs and pzErrMsg is not 0, then the
@@ -7549,7 +7661,7 @@ SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff);
7549
7661
  ** <blockquote><pre>
7550
7662
  ** &nbsp; int xEntryPoint(
7551
7663
  ** &nbsp; sqlite3 *db,
7552
- ** &nbsp; const char **pzErrMsg,
7664
+ ** &nbsp; char **pzErrMsg,
7553
7665
  ** &nbsp; const struct sqlite3_api_routines *pThunk
7554
7666
  ** &nbsp; );
7555
7667
  ** </pre></blockquote>)^
@@ -8299,13 +8411,6 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
8299
8411
  ** SQLITE_MUTEX_W32 implementations are appropriate for use on Unix
8300
8412
  ** and Windows.
8301
8413
  **
8302
- ** If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor
8303
- ** macro defined (with "-DSQLITE_MUTEX_APPDEF=1"), then no mutex
8304
- ** implementation is included with the library. In this case the
8305
- ** application must supply a custom mutex implementation using the
8306
- ** [SQLITE_CONFIG_MUTEX] option of the sqlite3_config() function
8307
- ** before calling sqlite3_initialize() or any other public sqlite3_
8308
- ** function that calls sqlite3_initialize().
8309
8414
  **
8310
8415
  ** ^The sqlite3_mutex_alloc() routine allocates a new
8311
8416
  ** mutex and returns a pointer to it. ^The sqlite3_mutex_alloc()
@@ -8660,6 +8765,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
8660
8765
  #define SQLITE_TESTCTRL_TUNE 32
8661
8766
  #define SQLITE_TESTCTRL_LOGEST 33
8662
8767
  #define SQLITE_TESTCTRL_USELONGDOUBLE 34 /* NOT USED */
8768
+ #define SQLITE_TESTCTRL_ATOF 34
8663
8769
  #define SQLITE_TESTCTRL_LAST 34 /* Largest TESTCTRL */
8664
8770
 
8665
8771
  /*
@@ -8768,17 +8874,22 @@ SQLITE_API sqlite3_str *sqlite3_str_new(sqlite3*);
8768
8874
  ** pass the returned value to [sqlite3_free()] to avoid a memory leak.
8769
8875
  ** ^The [sqlite3_str_finish(X)] interface may return a NULL pointer if any
8770
8876
  ** errors were encountered during construction of the string. ^The
8771
- ** [sqlite3_str_finish(X)] interface will also return a NULL pointer if the
8877
+ ** [sqlite3_str_finish(X)] interface might also return a NULL pointer if the
8772
8878
  ** string in [sqlite3_str] object X is zero bytes long.
8879
+ **
8880
+ ** ^The [sqlite3_str_free(X)] interface destroys both the sqlite3_str object
8881
+ ** X and the string content it contains. Calling sqlite3_str_free(X) is
8882
+ ** the equivalent of calling [sqlite3_free](sqlite3_str_finish(X)).
8773
8883
  */
8774
8884
  SQLITE_API char *sqlite3_str_finish(sqlite3_str*);
8885
+ SQLITE_API void sqlite3_str_free(sqlite3_str*);
8775
8886
 
8776
8887
  /*
8777
8888
  ** CAPI3REF: Add Content To A Dynamic String
8778
8889
  ** METHOD: sqlite3_str
8779
8890
  **
8780
- ** These interfaces add content to an sqlite3_str object previously obtained
8781
- ** from [sqlite3_str_new()].
8891
+ ** These interfaces add or remove content to an sqlite3_str object
8892
+ ** previously obtained from [sqlite3_str_new()].
8782
8893
  **
8783
8894
  ** ^The [sqlite3_str_appendf(X,F,...)] and
8784
8895
  ** [sqlite3_str_vappendf(X,F,V)] interfaces uses the [built-in printf]
@@ -8801,6 +8912,10 @@ SQLITE_API char *sqlite3_str_finish(sqlite3_str*);
8801
8912
  ** ^The [sqlite3_str_reset(X)] method resets the string under construction
8802
8913
  ** inside [sqlite3_str] object X back to zero bytes in length.
8803
8914
  **
8915
+ ** ^The [sqlite3_str_truncate(X,N)] method changes the length of the string
8916
+ ** under construction to be N bytes or less. This routine is a no-op if
8917
+ ** N is negative or if the string is already N bytes or smaller in size.
8918
+ **
8804
8919
  ** These methods do not return a result code. ^If an error occurs, that fact
8805
8920
  ** is recorded in the [sqlite3_str] object and can be recovered by a
8806
8921
  ** subsequent call to [sqlite3_str_errcode(X)].
@@ -8811,6 +8926,7 @@ SQLITE_API void sqlite3_str_append(sqlite3_str*, const char *zIn, int N);
8811
8926
  SQLITE_API void sqlite3_str_appendall(sqlite3_str*, const char *zIn);
8812
8927
  SQLITE_API void sqlite3_str_appendchar(sqlite3_str*, int N, char C);
8813
8928
  SQLITE_API void sqlite3_str_reset(sqlite3_str*);
8929
+ SQLITE_API void sqlite3_str_truncate(sqlite3_str*,int N);
8814
8930
 
8815
8931
  /*
8816
8932
  ** CAPI3REF: Status Of A Dynamic String
@@ -10341,7 +10457,8 @@ SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
10341
10457
  ** <tr>
10342
10458
  ** <td valign="top">sqlite3_vtab_distinct() return value
10343
10459
  ** <td valign="top">Rows are returned in aOrderBy order
10344
- ** <td valign="top">Rows with the same value in all aOrderBy columns are adjacent
10460
+ ** <td valign="top">Rows with the same value in all aOrderBy columns are
10461
+ ** adjacent
10345
10462
  ** <td valign="top">Duplicates over all colUsed columns may be omitted
10346
10463
  ** <tr><td>0<td>yes<td>yes<td>no
10347
10464
  ** <tr><td>1<td>no<td>yes<td>no
@@ -10350,8 +10467,8 @@ SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
10350
10467
  ** </table>
10351
10468
  **
10352
10469
  ** ^For the purposes of comparing virtual table output values to see if the
10353
- ** values are the same value for sorting purposes, two NULL values are considered
10354
- ** to be the same. In other words, the comparison operator is "IS"
10470
+ ** values are the same value for sorting purposes, two NULL values are
10471
+ ** considered to be the same. In other words, the comparison operator is "IS"
10355
10472
  ** (or "IS NOT DISTINCT FROM") and not "==".
10356
10473
  **
10357
10474
  ** If a virtual table implementation is unable to meet the requirements
@@ -10644,9 +10761,9 @@ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **
10644
10761
  ** a variable pointed to by the "pOut" parameter.
10645
10762
  **
10646
10763
  ** The "flags" parameter must be passed a mask of flags. At present only
10647
- ** one flag is defined - SQLITE_SCANSTAT_COMPLEX. If SQLITE_SCANSTAT_COMPLEX
10764
+ ** one flag is defined - [SQLITE_SCANSTAT_COMPLEX]. If SQLITE_SCANSTAT_COMPLEX
10648
10765
  ** is specified, then status information is available for all elements
10649
- ** of a query plan that are reported by "EXPLAIN QUERY PLAN" output. If
10766
+ ** of a query plan that are reported by "[EXPLAIN QUERY PLAN]" output. If
10650
10767
  ** SQLITE_SCANSTAT_COMPLEX is not specified, then only query plan elements
10651
10768
  ** that correspond to query loops (the "SCAN..." and "SEARCH..." elements of
10652
10769
  ** the EXPLAIN QUERY PLAN output) are available. Invoking API
@@ -10660,7 +10777,8 @@ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **
10660
10777
  ** elements used to implement the statement - a non-zero value is returned and
10661
10778
  ** the variable that pOut points to is unchanged.
10662
10779
  **
10663
- ** See also: [sqlite3_stmt_scanstatus_reset()]
10780
+ ** See also: [sqlite3_stmt_scanstatus_reset()] and the
10781
+ ** [nexec and ncycle] columns of the [bytecode virtual table].
10664
10782
  */
10665
10783
  SQLITE_API int sqlite3_stmt_scanstatus(
10666
10784
  sqlite3_stmt *pStmt, /* Prepared statement for which info desired */
@@ -11202,19 +11320,42 @@ SQLITE_API int sqlite3_deserialize(
11202
11320
  /*
11203
11321
  ** CAPI3REF: Bind array values to the CARRAY table-valued function
11204
11322
  **
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
- */
11323
+ ** The sqlite3_carray_bind_v2(S,I,P,N,F,X,D) interface binds an array value to
11324
+ ** parameter that is the first argument of the [carray() table-valued function].
11325
+ ** The S parameter is a pointer to the [prepared statement] that uses the
11326
+ ** carray() functions. I is the parameter index to be bound. I must be the
11327
+ ** index of the parameter that is the first argument to the carray()
11328
+ ** table-valued function. P is a pointer to the array to be bound, and N
11329
+ ** is the number of elements in the array. The F argument is one of
11330
+ ** constants [SQLITE_CARRAY_INT32], [SQLITE_CARRAY_INT64],
11331
+ ** [SQLITE_CARRAY_DOUBLE], [SQLITE_CARRAY_TEXT],
11332
+ ** or [SQLITE_CARRAY_BLOB] to indicate the datatype of the array P.
11333
+ **
11334
+ ** If the X argument is not a NULL pointer or one of the special
11335
+ ** values [SQLITE_STATIC] or [SQLITE_TRANSIENT], then SQLite will invoke
11336
+ ** the function X with argument D when it is finished using the data in P.
11337
+ ** The call to X(D) is a destructor for the array P. The destructor X(D)
11338
+ ** is invoked even if the call to sqlite3_carray_bind_v2() fails. If the X
11339
+ ** parameter is the special-case value [SQLITE_STATIC], then SQLite assumes
11340
+ ** that the data static and the destructor is never invoked. If the X
11341
+ ** parameter is the special-case value [SQLITE_TRANSIENT], then
11342
+ ** sqlite3_carray_bind_v2() makes its own private copy of the data prior
11343
+ ** to returning and never invokes the destructor X.
11344
+ **
11345
+ ** The sqlite3_carray_bind() function works the same as sqlite3_carray_bind_v2()
11346
+ ** with a D parameter set to P. In other words,
11347
+ ** sqlite3_carray_bind(S,I,P,N,F,X) is same as
11348
+ ** sqlite3_carray_bind_v2(S,I,P,N,F,X,P).
11349
+ */
11350
+ SQLITE_API int sqlite3_carray_bind_v2(
11351
+ sqlite3_stmt *pStmt, /* Statement to be bound */
11352
+ int i, /* Parameter index */
11353
+ void *aData, /* Pointer to array data */
11354
+ int nData, /* Number of data elements */
11355
+ int mFlags, /* CARRAY flags */
11356
+ void (*xDel)(void*), /* Destructor for aData */
11357
+ void *pDel /* Optional argument to xDel() */
11358
+ );
11218
11359
  SQLITE_API int sqlite3_carray_bind(
11219
11360
  sqlite3_stmt *pStmt, /* Statement to be bound */
11220
11361
  int i, /* Parameter index */
@@ -13245,6 +13386,232 @@ SQLITE_API int sqlite3session_config(int op, void *pArg);
13245
13386
  */
13246
13387
  #define SQLITE_SESSION_CONFIG_STRMSIZE 1
13247
13388
 
13389
+ /*
13390
+ ** CAPI3REF: Configure a changegroup object
13391
+ **
13392
+ ** Configure the changegroup object passed as the first argument.
13393
+ ** At present the only valid value for the second parameter is
13394
+ ** [SQLITE_CHANGEGROUP_CONFIG_PATCHSET].
13395
+ */
13396
+ SQLITE_API int sqlite3changegroup_config(sqlite3_changegroup*, int, void *pArg);
13397
+
13398
+ /*
13399
+ ** CAPI3REF: Options for sqlite3changegroup_config().
13400
+ **
13401
+ ** The following values may be passed as the 2nd parameter to
13402
+ ** sqlite3changegroup_config().
13403
+ **
13404
+ ** <dt>SQLITE_CHANGEGROUP_CONFIG_PATCHSET <dd>
13405
+ ** A changegroup object generates either a changeset or patchset. Usually,
13406
+ ** this is determined by whether the first call to sqlite3changegroup_add()
13407
+ ** is passed a changeset or a patchset. Or, if the first changes are added
13408
+ ** to the changegroup object using the sqlite3changegroup_change_xxx()
13409
+ ** APIs, then this option may be used to configure whether the changegroup
13410
+ ** object generates a changeset or patchset.
13411
+ **
13412
+ ** When this option is invoked, parameter pArg must point to a value of
13413
+ ** type int. If the changegroup currently contains zero changes, and the
13414
+ ** value of the int variable is zero or greater than zero, then the
13415
+ ** changegroup is configured to generate a changeset or patchset,
13416
+ ** respectively. It is a no-op, not an error, if the changegroup is not
13417
+ ** configured because it has already started accumulating changes.
13418
+ **
13419
+ ** Before returning, the int variable is set to 0 if the changegroup is
13420
+ ** configured to generate a changeset, or 1 if it is configured to generate
13421
+ ** a patchset.
13422
+ */
13423
+ #define SQLITE_CHANGEGROUP_CONFIG_PATCHSET 1
13424
+
13425
+
13426
+ /*
13427
+ ** CAPI3REF: Begin adding a change to a changegroup
13428
+ **
13429
+ ** This API is used, in concert with other sqlite3changegroup_change_xxx()
13430
+ ** APIs, to add changes to a changegroup object one at a time. To add a
13431
+ ** single change, the caller must:
13432
+ **
13433
+ ** 1. Invoke sqlite3changegroup_change_begin() to indicate the type of
13434
+ ** change (INSERT, UPDATE or DELETE), the affected table and whether
13435
+ ** or not the change should be marked as indirect.
13436
+ **
13437
+ ** 2. Invoke sqlite3changegroup_change_int64() or one of the other four
13438
+ ** value functions - _null(), _double(), _text() or _blob() - one or
13439
+ ** more times to specify old.* and new.* values for the change being
13440
+ ** constructed.
13441
+ **
13442
+ ** 3. Invoke sqlite3changegroup_change_finish() to either finish adding
13443
+ ** the change to the group, or to discard the change altogether.
13444
+ **
13445
+ ** The first argument to this function must be a pointer to the existing
13446
+ ** changegroup object that the change will be added to. The second argument
13447
+ ** must be SQLITE_INSERT, SQLITE_UPDATE or SQLITE_DELETE. The third is the
13448
+ ** name of the table that the change affects, and the fourth is a boolean
13449
+ ** flag specifying whether the change should be marked as "indirect" (if
13450
+ ** bIndirect is non-zero) or not indirect (if bIndirect is zero).
13451
+ **
13452
+ ** Following a successful call to this function, this function may not be
13453
+ ** called again on the same changegroup object until after
13454
+ ** sqlite3changegroup_change_finish() has been called. Doing so is an
13455
+ ** SQLITE_MISUSE error.
13456
+ **
13457
+ ** The changegroup object passed as the first argument must be already
13458
+ ** configured with schema data for the specified table. It may be configured
13459
+ ** either by calling sqlite3changegroup_schema() with a database that contains
13460
+ ** the table, or sqlite3changegroup_add() with a changeset that contains the
13461
+ ** table. If the changegroup object has not been configured with a schema for
13462
+ ** the specified table when this function is called, SQLITE_ERROR is returned.
13463
+ **
13464
+ ** If successful, SQLITE_OK is returned. Otherwise, if an error occurs, an
13465
+ ** SQLite error code is returned. In this case, if argument pzErr is non-NULL,
13466
+ ** then (*pzErr) may be set to point to a buffer containing a utf-8 formated,
13467
+ ** nul-terminated, English language error message. It is the responsibility
13468
+ ** of the caller to eventually free this buffer using sqlite3_free().
13469
+ */
13470
+ SQLITE_API int sqlite3changegroup_change_begin(
13471
+ sqlite3_changegroup*,
13472
+ int eOp,
13473
+ const char *zTab,
13474
+ int bIndirect,
13475
+ char **pzErr
13476
+ );
13477
+
13478
+ /*
13479
+ ** CAPI3REF: Add a 64-bit integer to a changegroup
13480
+ **
13481
+ ** This function may only be called between a successful call to
13482
+ ** sqlite3changegroup_change_begin() and its matching
13483
+ ** sqlite3changegroup_change_finish() call. If it is called at any
13484
+ ** other time, it is an SQLITE_MISUSE error. Calling this function
13485
+ ** specifies a 64-bit integer value to be used in the change currently being
13486
+ ** added to the changegroup object passed as the first argument.
13487
+ **
13488
+ ** The second parameter, bNew, specifies whether the value is to be part of
13489
+ ** the new.* (if bNew is non-zero) or old.* (if bNew is zero) record of
13490
+ ** the change under construction. If this does not match the type of change
13491
+ ** specified by the preceding call to sqlite3changegroup_change_begin() (i.e.
13492
+ ** an old.* value for an SQLITE_INSERT change, or a new.* value for an
13493
+ ** SQLITE_DELETE), then SQLITE_ERROR is returned.
13494
+ **
13495
+ ** The third parameter specifies the column of the old.* or new.* record that
13496
+ ** the value will be a part of. If the specified table has an explicit primary
13497
+ ** key, then this is the index of the table column, numbered from 0 in the order
13498
+ ** specified within the CREATE TABLE statement. Or, if the table uses an
13499
+ ** implicit rowid key, then the column 0 is the rowid and the explicit columns
13500
+ ** are numbered starting from 1. If the iCol parameter is less than 0 or greater
13501
+ ** than the index of the last column in the table, SQLITE_RANGE is returned.
13502
+ **
13503
+ ** The fourth parameter is the integer value to use as part of the old.* or
13504
+ ** new.* record.
13505
+ **
13506
+ ** If this call is successful, SQLITE_OK is returned. Otherwise, if an
13507
+ ** error occurs, an SQLite error code is returned.
13508
+ */
13509
+ SQLITE_API int sqlite3changegroup_change_int64(
13510
+ sqlite3_changegroup*,
13511
+ int bNew,
13512
+ int iCol,
13513
+ sqlite3_int64 iVal
13514
+ );
13515
+
13516
+ /*
13517
+ ** CAPI3REF: Add a NULL to a changegroup
13518
+ **
13519
+ ** This function is similar to sqlite3changegroup_change_int64(). Except that
13520
+ ** it configures the change currently under construction with a NULL value
13521
+ ** instead of a 64-bit integer.
13522
+ */
13523
+ SQLITE_API int sqlite3changegroup_change_null(sqlite3_changegroup*, int, int);
13524
+
13525
+ /*
13526
+ ** CAPI3REF: Add an double to a changegroup
13527
+ **
13528
+ ** This function is similar to sqlite3changegroup_change_int64(). Except that
13529
+ ** it configures the change currently being constructed with a real value
13530
+ ** instead of a 64-bit integer.
13531
+ */
13532
+ SQLITE_API int sqlite3changegroup_change_double(sqlite3_changegroup*, int, int, double);
13533
+
13534
+ /*
13535
+ ** CAPI3REF: Add a text value to a changegroup
13536
+ **
13537
+ ** This function is similar to sqlite3changegroup_change_int64(). It configures
13538
+ ** the currently accumulated change with a text value instead of a 64-bit
13539
+ ** integer. Parameter pVal points to a buffer containing the text encoded using
13540
+ ** utf-8. Parameter nVal may either be the size of the text value in bytes, or
13541
+ ** else a negative value, in which case the buffer pVal points to is assumed to
13542
+ ** be nul-terminated.
13543
+ */
13544
+ SQLITE_API int sqlite3changegroup_change_text(
13545
+ sqlite3_changegroup*, int, int, const char *pVal, int nVal
13546
+ );
13547
+
13548
+ /*
13549
+ ** CAPI3REF: Add a blob to a changegroup
13550
+ **
13551
+ ** This function is similar to sqlite3changegroup_change_int64(). It configures
13552
+ ** the currently accumulated change with a blob value instead of a 64-bit
13553
+ ** integer. Parameter pVal points to a buffer containing the blob. Parameter
13554
+ ** nVal is the size of the blob in bytes.
13555
+ */
13556
+ SQLITE_API int sqlite3changegroup_change_blob(
13557
+ sqlite3_changegroup*, int, int, const void *pVal, int nVal
13558
+ );
13559
+
13560
+ /*
13561
+ ** CAPI3REF: Finish adding one-at-at-time changes to a changegroup
13562
+ **
13563
+ ** This function may only be called following a successful call to
13564
+ ** sqlite3changegroup_change_begin(). Otherwise, it is an SQLITE_MISUSE error.
13565
+ **
13566
+ ** If parameter bDiscard is non-zero, then the current change is simply
13567
+ ** discarded. In this case this function is always successful and SQLITE_OK
13568
+ ** returned.
13569
+ **
13570
+ ** If parameter bDiscard is zero, then an attempt is made to add the current
13571
+ ** change to the changegroup. Assuming the changegroup is configured to
13572
+ ** produce a changeset (not a patchset), this requires that:
13573
+ **
13574
+ ** * If the change is an INSERT or DELETE, then a value must be specified
13575
+ ** for all columns of the new.* or old.* record, respectively.
13576
+ **
13577
+ ** * If the change is an UPDATE record, then values must be provided for
13578
+ ** the PRIMARY KEY columns of the old.* record, but must not be provided
13579
+ ** for PRIMARY KEY columns of the new.* record.
13580
+ **
13581
+ ** * If the change is an UPDATE record, then for each non-PRIMARY KEY
13582
+ ** column in the old.* record for which a value has been provided, a
13583
+ ** value must also be provided for the same column in the new.* record.
13584
+ ** Similarly, for each non-PK column in the old.* record for which
13585
+ ** a value is not provided, a value must not be provided for the same
13586
+ ** column in the new.* record.
13587
+ **
13588
+ ** * All values specified for PRIMARY KEY columns must be non-NULL.
13589
+ **
13590
+ ** Otherwise, it is an error.
13591
+ **
13592
+ ** If the changegroup already contains a change for the same row (identified
13593
+ ** by PRIMARY KEY columns), then the current change is combined with the
13594
+ ** existing change in the same way as for sqlite3changegroup_add().
13595
+ **
13596
+ ** For a patchset, all of the above rules apply except that it doesn't matter
13597
+ ** whether or not values are provided for the non-PK old.* record columns
13598
+ ** for an UPDATE or DELETE change. This means that code used to produce
13599
+ ** a changeset using the sqlite3changegroup_change_xxx() APIs may also
13600
+ ** be used to produce patchsets.
13601
+ **
13602
+ ** If the call is successful, SQLITE_OK is returned. Otherwise, if an error
13603
+ ** occurs, an SQLite error code is returned. If an error is returned and
13604
+ ** parameter pzErr is not NULL, then (*pzErr) may be set to point to a buffer
13605
+ ** containing a nul-terminated, utf-8 encoded, English language error message.
13606
+ ** It is the responsibility of the caller to eventually free any such error
13607
+ ** message buffer using sqlite3_free().
13608
+ */
13609
+ SQLITE_API int sqlite3changegroup_change_finish(
13610
+ sqlite3_changegroup*,
13611
+ int bDiscard,
13612
+ char **pzErr
13613
+ );
13614
+
13248
13615
  /*
13249
13616
  ** Make sure we can call this stuff from C++.
13250
13617
  */
@@ -14102,6 +14469,7 @@ SQLITE_API void sqlite3_activate_see(const char* zPassPhrase);
14102
14469
  SQLITE_API int sqlite3mc_cipher_count();
14103
14470
  SQLITE_API int sqlite3mc_cipher_index(const char* cipherName);
14104
14471
  SQLITE_API const char* sqlite3mc_cipher_name(int cipherIndex);
14472
+ SQLITE_API int sqlite3mc_cipher_name_copy(int cipherIndex, char* cipherName, int maxCipherNameSize);
14105
14473
  SQLITE_API int sqlite3mc_config(sqlite3* db, const char* paramName, int newValue);
14106
14474
  SQLITE_API int sqlite3mc_config_cipher(sqlite3* db, const char* cipherName, const char* paramName, int newValue);
14107
14475
  SQLITE_API unsigned char* sqlite3mc_codec_data(sqlite3* db, const char* zDbName, const char* paramName);