amalgalite 1.9.0-x64-mingw32 → 1.9.4-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -146,9 +146,9 @@ extern "C" {
146
146
  ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147
147
  ** [sqlite_version()] and [sqlite_source_id()].
148
148
  */
149
- #define SQLITE_VERSION "3.41.2"
150
- #define SQLITE_VERSION_NUMBER 3041002
151
- #define SQLITE_SOURCE_ID "2023-03-22 11:56:21 0d1fc92f94cb6b76bffe3ec34d69cffde2924203304e8ffc4155597af0c191da"
149
+ #define SQLITE_VERSION "3.45.1"
150
+ #define SQLITE_VERSION_NUMBER 3045001
151
+ #define SQLITE_SOURCE_ID "2024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257cc467a"
152
152
 
153
153
  /*
154
154
  ** CAPI3REF: Run-Time Library Version Numbers
@@ -528,6 +528,7 @@ SQLITE_API int sqlite3_exec(
528
528
  #define SQLITE_IOERR_ROLLBACK_ATOMIC (SQLITE_IOERR | (31<<8))
529
529
  #define SQLITE_IOERR_DATA (SQLITE_IOERR | (32<<8))
530
530
  #define SQLITE_IOERR_CORRUPTFS (SQLITE_IOERR | (33<<8))
531
+ #define SQLITE_IOERR_IN_PAGE (SQLITE_IOERR | (34<<8))
531
532
  #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8))
532
533
  #define SQLITE_LOCKED_VTAB (SQLITE_LOCKED | (2<<8))
533
534
  #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8))
@@ -1190,7 +1191,7 @@ struct sqlite3_io_methods {
1190
1191
  ** by clients within the current process, only within other processes.
1191
1192
  **
1192
1193
  ** <li>[[SQLITE_FCNTL_CKSM_FILE]]
1193
- ** The [SQLITE_FCNTL_CKSM_FILE] opcode is for use interally by the
1194
+ ** The [SQLITE_FCNTL_CKSM_FILE] opcode is for use internally by the
1194
1195
  ** [checksum VFS shim] only.
1195
1196
  **
1196
1197
  ** <li>[[SQLITE_FCNTL_RESET_CACHE]]
@@ -1655,20 +1656,23 @@ SQLITE_API int sqlite3_os_end(void);
1655
1656
  ** must ensure that no other SQLite interfaces are invoked by other
1656
1657
  ** threads while sqlite3_config() is running.</b>
1657
1658
  **
1658
- ** The sqlite3_config() interface
1659
- ** may only be invoked prior to library initialization using
1660
- ** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].
1661
- ** ^If sqlite3_config() is called after [sqlite3_initialize()] and before
1662
- ** [sqlite3_shutdown()] then it will return SQLITE_MISUSE.
1663
- ** Note, however, that ^sqlite3_config() can be called as part of the
1664
- ** implementation of an application-defined [sqlite3_os_init()].
1665
- **
1666
1659
  ** The first argument to sqlite3_config() is an integer
1667
1660
  ** [configuration option] that determines
1668
1661
  ** what property of SQLite is to be configured. Subsequent arguments
1669
1662
  ** vary depending on the [configuration option]
1670
1663
  ** in the first argument.
1671
1664
  **
1665
+ ** For most configuration options, the sqlite3_config() interface
1666
+ ** may only be invoked prior to library initialization using
1667
+ ** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].
1668
+ ** The exceptional configuration options that may be invoked at any time
1669
+ ** are called "anytime configuration options".
1670
+ ** ^If sqlite3_config() is called after [sqlite3_initialize()] and before
1671
+ ** [sqlite3_shutdown()] with a first argument that is not an anytime
1672
+ ** configuration option, then the sqlite3_config() call will return SQLITE_MISUSE.
1673
+ ** Note, however, that ^sqlite3_config() can be called as part of the
1674
+ ** implementation of an application-defined [sqlite3_os_init()].
1675
+ **
1672
1676
  ** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK].
1673
1677
  ** ^If the option is unknown or SQLite is unable to set the option
1674
1678
  ** then this routine returns a non-zero [error code].
@@ -1776,6 +1780,23 @@ struct sqlite3_mem_methods {
1776
1780
  ** These constants are the available integer configuration options that
1777
1781
  ** can be passed as the first argument to the [sqlite3_config()] interface.
1778
1782
  **
1783
+ ** Most of the configuration options for sqlite3_config()
1784
+ ** will only work if invoked prior to [sqlite3_initialize()] or after
1785
+ ** [sqlite3_shutdown()]. The few exceptions to this rule are called
1786
+ ** "anytime configuration options".
1787
+ ** ^Calling [sqlite3_config()] with a first argument that is not an
1788
+ ** anytime configuration option in between calls to [sqlite3_initialize()] and
1789
+ ** [sqlite3_shutdown()] is a no-op that returns SQLITE_MISUSE.
1790
+ **
1791
+ ** The set of anytime configuration options can change (by insertions
1792
+ ** and/or deletions) from one release of SQLite to the next.
1793
+ ** As of SQLite version 3.42.0, the complete set of anytime configuration
1794
+ ** options is:
1795
+ ** <ul>
1796
+ ** <li> SQLITE_CONFIG_LOG
1797
+ ** <li> SQLITE_CONFIG_PCACHE_HDRSZ
1798
+ ** </ul>
1799
+ **
1779
1800
  ** New configuration options may be added in future releases of SQLite.
1780
1801
  ** Existing configuration options might be discontinued. Applications
1781
1802
  ** should check the return code from [sqlite3_config()] to make sure that
@@ -2106,7 +2127,7 @@ struct sqlite3_mem_methods {
2106
2127
  ** is stored in each sorted record and the required column values loaded
2107
2128
  ** from the database as records are returned in sorted order. The default
2108
2129
  ** value for this option is to never use this optimization. Specifying a
2109
- ** negative value for this option restores the default behaviour.
2130
+ ** negative value for this option restores the default behavior.
2110
2131
  ** This option is only available if SQLite is compiled with the
2111
2132
  ** [SQLITE_ENABLE_SORTER_REFERENCES] compile-time option.
2112
2133
  **
@@ -2122,28 +2143,28 @@ struct sqlite3_mem_methods {
2122
2143
  ** compile-time option is not set, then the default maximum is 1073741824.
2123
2144
  ** </dl>
2124
2145
  */
2125
- #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
2126
- #define SQLITE_CONFIG_MULTITHREAD 2 /* nil */
2127
- #define SQLITE_CONFIG_SERIALIZED 3 /* nil */
2128
- #define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */
2129
- #define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */
2130
- #define SQLITE_CONFIG_SCRATCH 6 /* No longer used */
2131
- #define SQLITE_CONFIG_PAGECACHE 7 /* void*, int sz, int N */
2132
- #define SQLITE_CONFIG_HEAP 8 /* void*, int nByte, int min */
2133
- #define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */
2134
- #define SQLITE_CONFIG_MUTEX 10 /* sqlite3_mutex_methods* */
2135
- #define SQLITE_CONFIG_GETMUTEX 11 /* sqlite3_mutex_methods* */
2136
- /* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */
2137
- #define SQLITE_CONFIG_LOOKASIDE 13 /* int int */
2138
- #define SQLITE_CONFIG_PCACHE 14 /* no-op */
2139
- #define SQLITE_CONFIG_GETPCACHE 15 /* no-op */
2140
- #define SQLITE_CONFIG_LOG 16 /* xFunc, void* */
2141
- #define SQLITE_CONFIG_URI 17 /* int */
2142
- #define SQLITE_CONFIG_PCACHE2 18 /* sqlite3_pcache_methods2* */
2143
- #define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */
2146
+ #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
2147
+ #define SQLITE_CONFIG_MULTITHREAD 2 /* nil */
2148
+ #define SQLITE_CONFIG_SERIALIZED 3 /* nil */
2149
+ #define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */
2150
+ #define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */
2151
+ #define SQLITE_CONFIG_SCRATCH 6 /* No longer used */
2152
+ #define SQLITE_CONFIG_PAGECACHE 7 /* void*, int sz, int N */
2153
+ #define SQLITE_CONFIG_HEAP 8 /* void*, int nByte, int min */
2154
+ #define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */
2155
+ #define SQLITE_CONFIG_MUTEX 10 /* sqlite3_mutex_methods* */
2156
+ #define SQLITE_CONFIG_GETMUTEX 11 /* sqlite3_mutex_methods* */
2157
+ /* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */
2158
+ #define SQLITE_CONFIG_LOOKASIDE 13 /* int int */
2159
+ #define SQLITE_CONFIG_PCACHE 14 /* no-op */
2160
+ #define SQLITE_CONFIG_GETPCACHE 15 /* no-op */
2161
+ #define SQLITE_CONFIG_LOG 16 /* xFunc, void* */
2162
+ #define SQLITE_CONFIG_URI 17 /* int */
2163
+ #define SQLITE_CONFIG_PCACHE2 18 /* sqlite3_pcache_methods2* */
2164
+ #define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */
2144
2165
  #define SQLITE_CONFIG_COVERING_INDEX_SCAN 20 /* int */
2145
- #define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */
2146
- #define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */
2166
+ #define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */
2167
+ #define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */
2147
2168
  #define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */
2148
2169
  #define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */
2149
2170
  #define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */
@@ -2281,7 +2302,7 @@ struct sqlite3_mem_methods {
2281
2302
  ** database handle, SQLite checks if this will mean that there are now no
2282
2303
  ** connections at all to the database. If so, it performs a checkpoint
2283
2304
  ** operation before closing the connection. This option may be used to
2284
- ** override this behaviour. The first parameter passed to this operation
2305
+ ** override this behavior. The first parameter passed to this operation
2285
2306
  ** is an integer - positive to disable checkpoints-on-close, or zero (the
2286
2307
  ** default) to enable them, and negative to leave the setting unchanged.
2287
2308
  ** The second parameter is a pointer to an integer
@@ -2378,7 +2399,7 @@ struct sqlite3_mem_methods {
2378
2399
  ** </dd>
2379
2400
  **
2380
2401
  ** [[SQLITE_DBCONFIG_DQS_DML]]
2381
- ** <dt>SQLITE_DBCONFIG_DQS_DML</td>
2402
+ ** <dt>SQLITE_DBCONFIG_DQS_DML</dt>
2382
2403
  ** <dd>The SQLITE_DBCONFIG_DQS_DML option activates or deactivates
2383
2404
  ** the legacy [double-quoted string literal] misfeature for DML statements
2384
2405
  ** only, that is DELETE, INSERT, SELECT, and UPDATE statements. The
@@ -2387,7 +2408,7 @@ struct sqlite3_mem_methods {
2387
2408
  ** </dd>
2388
2409
  **
2389
2410
  ** [[SQLITE_DBCONFIG_DQS_DDL]]
2390
- ** <dt>SQLITE_DBCONFIG_DQS_DDL</td>
2411
+ ** <dt>SQLITE_DBCONFIG_DQS_DDL</dt>
2391
2412
  ** <dd>The SQLITE_DBCONFIG_DQS option activates or deactivates
2392
2413
  ** the legacy [double-quoted string literal] misfeature for DDL statements,
2393
2414
  ** such as CREATE TABLE and CREATE INDEX. The
@@ -2396,7 +2417,7 @@ struct sqlite3_mem_methods {
2396
2417
  ** </dd>
2397
2418
  **
2398
2419
  ** [[SQLITE_DBCONFIG_TRUSTED_SCHEMA]]
2399
- ** <dt>SQLITE_DBCONFIG_TRUSTED_SCHEMA</td>
2420
+ ** <dt>SQLITE_DBCONFIG_TRUSTED_SCHEMA</dt>
2400
2421
  ** <dd>The SQLITE_DBCONFIG_TRUSTED_SCHEMA option tells SQLite to
2401
2422
  ** assume that database schemas are untainted by malicious content.
2402
2423
  ** When the SQLITE_DBCONFIG_TRUSTED_SCHEMA option is disabled, SQLite
@@ -2416,7 +2437,7 @@ struct sqlite3_mem_methods {
2416
2437
  ** </dd>
2417
2438
  **
2418
2439
  ** [[SQLITE_DBCONFIG_LEGACY_FILE_FORMAT]]
2419
- ** <dt>SQLITE_DBCONFIG_LEGACY_FILE_FORMAT</td>
2440
+ ** <dt>SQLITE_DBCONFIG_LEGACY_FILE_FORMAT</dt>
2420
2441
  ** <dd>The SQLITE_DBCONFIG_LEGACY_FILE_FORMAT option activates or deactivates
2421
2442
  ** the legacy file format flag. When activated, this flag causes all newly
2422
2443
  ** created database file to have a schema format version number (the 4-byte
@@ -2425,7 +2446,7 @@ struct sqlite3_mem_methods {
2425
2446
  ** any SQLite version back to 3.0.0 ([dateof:3.0.0]). Without this setting,
2426
2447
  ** newly created databases are generally not understandable by SQLite versions
2427
2448
  ** prior to 3.3.0 ([dateof:3.3.0]). As these words are written, there
2428
- ** is now scarcely any need to generated database files that are compatible
2449
+ ** is now scarcely any need to generate database files that are compatible
2429
2450
  ** all the way back to version 3.0.0, and so this setting is of little
2430
2451
  ** practical use, but is provided so that SQLite can continue to claim the
2431
2452
  ** ability to generate new database files that are compatible with version
@@ -2434,8 +2455,40 @@ struct sqlite3_mem_methods {
2434
2455
  ** the [VACUUM] command will fail with an obscure error when attempting to
2435
2456
  ** process a table with generated columns and a descending index. This is
2436
2457
  ** not considered a bug since SQLite versions 3.3.0 and earlier do not support
2437
- ** either generated columns or decending indexes.
2458
+ ** either generated columns or descending indexes.
2459
+ ** </dd>
2460
+ **
2461
+ ** [[SQLITE_DBCONFIG_STMT_SCANSTATUS]]
2462
+ ** <dt>SQLITE_DBCONFIG_STMT_SCANSTATUS</dt>
2463
+ ** <dd>The SQLITE_DBCONFIG_STMT_SCANSTATUS option is only useful in
2464
+ ** SQLITE_ENABLE_STMT_SCANSTATUS builds. In this case, it sets or clears
2465
+ ** a flag that enables collection of the sqlite3_stmt_scanstatus_v2()
2466
+ ** statistics. For statistics to be collected, the flag must be set on
2467
+ ** the database handle both when the SQL statement is prepared and when it
2468
+ ** is stepped. The flag is set (collection of statistics is enabled)
2469
+ ** by default. This option takes two arguments: an integer and a pointer to
2470
+ ** an integer.. The first argument is 1, 0, or -1 to enable, disable, or
2471
+ ** leave unchanged the statement scanstatus option. If the second argument
2472
+ ** is not NULL, then the value of the statement scanstatus setting after
2473
+ ** processing the first argument is written into the integer that the second
2474
+ ** argument points to.
2475
+ ** </dd>
2476
+ **
2477
+ ** [[SQLITE_DBCONFIG_REVERSE_SCANORDER]]
2478
+ ** <dt>SQLITE_DBCONFIG_REVERSE_SCANORDER</dt>
2479
+ ** <dd>The SQLITE_DBCONFIG_REVERSE_SCANORDER option changes the default order
2480
+ ** in which tables and indexes are scanned so that the scans start at the end
2481
+ ** and work toward the beginning rather than starting at the beginning and
2482
+ ** working toward the end. Setting SQLITE_DBCONFIG_REVERSE_SCANORDER is the
2483
+ ** same as setting [PRAGMA reverse_unordered_selects]. This option takes
2484
+ ** two arguments which are an integer and a pointer to an integer. The first
2485
+ ** argument is 1, 0, or -1 to enable, disable, or leave unchanged the
2486
+ ** reverse scan order flag, respectively. If the second argument is not NULL,
2487
+ ** then 0 or 1 is written into the integer that the second argument points to
2488
+ ** depending on if the reverse scan order flag is set after processing the
2489
+ ** first argument.
2438
2490
  ** </dd>
2491
+ **
2439
2492
  ** </dl>
2440
2493
  */
2441
2494
  #define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */
@@ -2456,7 +2509,9 @@ struct sqlite3_mem_methods {
2456
2509
  #define SQLITE_DBCONFIG_ENABLE_VIEW 1015 /* int int* */
2457
2510
  #define SQLITE_DBCONFIG_LEGACY_FILE_FORMAT 1016 /* int int* */
2458
2511
  #define SQLITE_DBCONFIG_TRUSTED_SCHEMA 1017 /* int int* */
2459
- #define SQLITE_DBCONFIG_MAX 1017 /* Largest DBCONFIG */
2512
+ #define SQLITE_DBCONFIG_STMT_SCANSTATUS 1018 /* int int* */
2513
+ #define SQLITE_DBCONFIG_REVERSE_SCANORDER 1019 /* int int* */
2514
+ #define SQLITE_DBCONFIG_MAX 1019 /* Largest DBCONFIG */
2460
2515
 
2461
2516
  /*
2462
2517
  ** CAPI3REF: Enable Or Disable Extended Result Codes
@@ -2681,6 +2736,7 @@ SQLITE_API sqlite3_int64 sqlite3_total_changes64(sqlite3*);
2681
2736
  **
2682
2737
  ** ^The [sqlite3_is_interrupted(D)] interface can be used to determine whether
2683
2738
  ** or not an interrupt is currently in effect for [database connection] D.
2739
+ ** It returns 1 if an interrupt is currently in effect, or 0 otherwise.
2684
2740
  */
2685
2741
  SQLITE_API void sqlite3_interrupt(sqlite3*);
2686
2742
  SQLITE_API int sqlite3_is_interrupted(sqlite3*);
@@ -3334,8 +3390,10 @@ SQLITE_API SQLITE_DEPRECATED void *sqlite3_profile(sqlite3*,
3334
3390
  ** M argument should be the bitwise OR-ed combination of
3335
3391
  ** zero or more [SQLITE_TRACE] constants.
3336
3392
  **
3337
- ** ^Each call to either sqlite3_trace() or sqlite3_trace_v2() overrides
3338
- ** (cancels) any prior calls to sqlite3_trace() or sqlite3_trace_v2().
3393
+ ** ^Each call to either sqlite3_trace(D,X,P) or sqlite3_trace_v2(D,M,X,P)
3394
+ ** overrides (cancels) all prior calls to sqlite3_trace(D,X,P) or
3395
+ ** sqlite3_trace_v2(D,M,X,P) for the [database connection] D. Each
3396
+ ** database connection may have at most one trace callback.
3339
3397
  **
3340
3398
  ** ^The X callback is invoked whenever any of the events identified by
3341
3399
  ** mask M occur. ^The integer return value from the callback is currently
@@ -3704,7 +3762,7 @@ SQLITE_API int sqlite3_open_v2(
3704
3762
  ** as F) must be one of:
3705
3763
  ** <ul>
3706
3764
  ** <li> A database filename pointer created by the SQLite core and
3707
- ** passed into the xOpen() method of a VFS implemention, or
3765
+ ** passed into the xOpen() method of a VFS implementation, or
3708
3766
  ** <li> A filename obtained from [sqlite3_db_filename()], or
3709
3767
  ** <li> A new filename constructed using [sqlite3_create_filename()].
3710
3768
  ** </ul>
@@ -3817,7 +3875,7 @@ SQLITE_API sqlite3_file *sqlite3_database_file_object(const char*);
3817
3875
  /*
3818
3876
  ** CAPI3REF: Create and Destroy VFS Filenames
3819
3877
  **
3820
- ** These interfces are provided for use by [VFS shim] implementations and
3878
+ ** These interfaces are provided for use by [VFS shim] implementations and
3821
3879
  ** are not useful outside of that context.
3822
3880
  **
3823
3881
  ** The sqlite3_create_filename(D,J,W,N,P) allocates memory to hold a version of
@@ -3896,14 +3954,17 @@ SQLITE_API void sqlite3_free_filename(sqlite3_filename);
3896
3954
  ** </ul>
3897
3955
  **
3898
3956
  ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
3899
- ** text that describes the error, as either UTF-8 or UTF-16 respectively.
3957
+ ** text that describes the error, as either UTF-8 or UTF-16 respectively,
3958
+ ** or NULL if no error message is available.
3959
+ ** (See how SQLite handles [invalid UTF] for exceptions to this rule.)
3900
3960
  ** ^(Memory to hold the error message string is managed internally.
3901
3961
  ** The application does not need to worry about freeing the result.
3902
3962
  ** However, the error string might be overwritten or deallocated by
3903
3963
  ** subsequent calls to other SQLite interface functions.)^
3904
3964
  **
3905
- ** ^The sqlite3_errstr() interface returns the English-language text
3906
- ** that describes the [result code], as UTF-8.
3965
+ ** ^The sqlite3_errstr(E) interface returns the English-language text
3966
+ ** that describes the [result code] E, as UTF-8, or NULL if E is not an
3967
+ ** result code for which a text error message is available.
3907
3968
  ** ^(Memory to hold the error message string is managed internally
3908
3969
  ** and must not be freed by the application)^.
3909
3970
  **
@@ -4364,6 +4425,41 @@ SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
4364
4425
  */
4365
4426
  SQLITE_API int sqlite3_stmt_isexplain(sqlite3_stmt *pStmt);
4366
4427
 
4428
+ /*
4429
+ ** CAPI3REF: Change The EXPLAIN Setting For A Prepared Statement
4430
+ ** METHOD: sqlite3_stmt
4431
+ **
4432
+ ** The sqlite3_stmt_explain(S,E) interface changes the EXPLAIN
4433
+ ** setting for [prepared statement] S. If E is zero, then S becomes
4434
+ ** a normal prepared statement. If E is 1, then S behaves as if
4435
+ ** its SQL text began with "[EXPLAIN]". If E is 2, then S behaves as if
4436
+ ** its SQL text began with "[EXPLAIN QUERY PLAN]".
4437
+ **
4438
+ ** Calling sqlite3_stmt_explain(S,E) might cause S to be reprepared.
4439
+ ** SQLite tries to avoid a reprepare, but a reprepare might be necessary
4440
+ ** on the first transition into EXPLAIN or EXPLAIN QUERY PLAN mode.
4441
+ **
4442
+ ** Because of the potential need to reprepare, a call to
4443
+ ** sqlite3_stmt_explain(S,E) will fail with SQLITE_ERROR if S cannot be
4444
+ ** reprepared because it was created using [sqlite3_prepare()] instead of
4445
+ ** the newer [sqlite3_prepare_v2()] or [sqlite3_prepare_v3()] interfaces and
4446
+ ** hence has no saved SQL text with which to reprepare.
4447
+ **
4448
+ ** Changing the explain setting for a prepared statement does not change
4449
+ ** the original SQL text for the statement. Hence, if the SQL text originally
4450
+ ** began with EXPLAIN or EXPLAIN QUERY PLAN, but sqlite3_stmt_explain(S,0)
4451
+ ** is called to convert the statement into an ordinary statement, the EXPLAIN
4452
+ ** or EXPLAIN QUERY PLAN keywords will still appear in the sqlite3_sql(S)
4453
+ ** output, even though the statement now acts like a normal SQL statement.
4454
+ **
4455
+ ** This routine returns SQLITE_OK if the explain mode is successfully
4456
+ ** changed, or an error code if the explain mode could not be changed.
4457
+ ** The explain mode cannot be changed while a statement is active.
4458
+ ** Hence, it is good practice to call [sqlite3_reset(S)]
4459
+ ** immediately prior to calling sqlite3_stmt_explain(S,E).
4460
+ */
4461
+ SQLITE_API int sqlite3_stmt_explain(sqlite3_stmt *pStmt, int eMode);
4462
+
4367
4463
  /*
4368
4464
  ** CAPI3REF: Determine If A Prepared Statement Has Been Reset
4369
4465
  ** METHOD: sqlite3_stmt
@@ -4527,7 +4623,7 @@ typedef struct sqlite3_context sqlite3_context;
4527
4623
  ** with it may be passed. ^It is called to dispose of the BLOB or string even
4528
4624
  ** if the call to the bind API fails, except the destructor is not called if
4529
4625
  ** the third parameter is a NULL pointer or the fourth parameter is negative.
4530
- ** ^ (2) The special constant, [SQLITE_STATIC], may be passsed to indicate that
4626
+ ** ^ (2) The special constant, [SQLITE_STATIC], may be passed to indicate that
4531
4627
  ** the application remains responsible for disposing of the object. ^In this
4532
4628
  ** case, the object and the provided pointer to it must remain valid until
4533
4629
  ** either the prepared statement is finalized or the same SQL parameter is
@@ -5206,20 +5302,33 @@ SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt);
5206
5302
  ** ^The [sqlite3_reset(S)] interface resets the [prepared statement] S
5207
5303
  ** back to the beginning of its program.
5208
5304
  **
5209
- ** ^If the most recent call to [sqlite3_step(S)] for the
5210
- ** [prepared statement] S returned [SQLITE_ROW] or [SQLITE_DONE],
5211
- ** or if [sqlite3_step(S)] has never before been called on S,
5212
- ** then [sqlite3_reset(S)] returns [SQLITE_OK].
5305
+ ** ^The return code from [sqlite3_reset(S)] indicates whether or not
5306
+ ** the previous evaluation of prepared statement S completed successfully.
5307
+ ** ^If [sqlite3_step(S)] has never before been called on S or if
5308
+ ** [sqlite3_step(S)] has not been called since the previous call
5309
+ ** to [sqlite3_reset(S)], then [sqlite3_reset(S)] will return
5310
+ ** [SQLITE_OK].
5213
5311
  **
5214
5312
  ** ^If the most recent call to [sqlite3_step(S)] for the
5215
5313
  ** [prepared statement] S indicated an error, then
5216
5314
  ** [sqlite3_reset(S)] returns an appropriate [error code].
5315
+ ** ^The [sqlite3_reset(S)] interface might also return an [error code]
5316
+ ** if there were no prior errors but the process of resetting
5317
+ ** the prepared statement caused a new error. ^For example, if an
5318
+ ** [INSERT] statement with a [RETURNING] clause is only stepped one time,
5319
+ ** that one call to [sqlite3_step(S)] might return SQLITE_ROW but
5320
+ ** the overall statement might still fail and the [sqlite3_reset(S)] call
5321
+ ** might return SQLITE_BUSY if locking constraints prevent the
5322
+ ** database change from committing. Therefore, it is important that
5323
+ ** applications check the return code from [sqlite3_reset(S)] even if
5324
+ ** no prior call to [sqlite3_step(S)] indicated a problem.
5217
5325
  **
5218
5326
  ** ^The [sqlite3_reset(S)] interface does not change the values
5219
5327
  ** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S.
5220
5328
  */
5221
5329
  SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
5222
5330
 
5331
+
5223
5332
  /*
5224
5333
  ** CAPI3REF: Create Or Redefine SQL Functions
5225
5334
  ** KEYWORDS: {function creation routines}
@@ -5430,7 +5539,7 @@ SQLITE_API int sqlite3_create_window_function(
5430
5539
  ** [application-defined SQL function]
5431
5540
  ** that has side-effects or that could potentially leak sensitive information.
5432
5541
  ** This will prevent attacks in which an application is tricked
5433
- ** into using a database file that has had its schema surreptiously
5542
+ ** into using a database file that has had its schema surreptitiously
5434
5543
  ** modified to invoke the application-defined function in ways that are
5435
5544
  ** harmful.
5436
5545
  ** <p>
@@ -5466,13 +5575,27 @@ SQLITE_API int sqlite3_create_window_function(
5466
5575
  ** </dd>
5467
5576
  **
5468
5577
  ** [[SQLITE_SUBTYPE]] <dt>SQLITE_SUBTYPE</dt><dd>
5469
- ** The SQLITE_SUBTYPE flag indicates to SQLite that a function may call
5578
+ ** The SQLITE_SUBTYPE flag indicates to SQLite that a function might call
5470
5579
  ** [sqlite3_value_subtype()] to inspect the sub-types of its arguments.
5471
- ** Specifying this flag makes no difference for scalar or aggregate user
5472
- ** functions. However, if it is not specified for a user-defined window
5473
- ** function, then any sub-types belonging to arguments passed to the window
5474
- ** function may be discarded before the window function is called (i.e.
5475
- ** sqlite3_value_subtype() will always return 0).
5580
+ ** This flag instructs SQLite to omit some corner-case optimizations that
5581
+ ** might disrupt the operation of the [sqlite3_value_subtype()] function,
5582
+ ** causing it to return zero rather than the correct subtype().
5583
+ ** SQL functions that invokes [sqlite3_value_subtype()] should have this
5584
+ ** property. If the SQLITE_SUBTYPE property is omitted, then the return
5585
+ ** value from [sqlite3_value_subtype()] might sometimes be zero even though
5586
+ ** a non-zero subtype was specified by the function argument expression.
5587
+ **
5588
+ ** [[SQLITE_RESULT_SUBTYPE]] <dt>SQLITE_RESULT_SUBTYPE</dt><dd>
5589
+ ** The SQLITE_RESULT_SUBTYPE flag indicates to SQLite that a function might call
5590
+ ** [sqlite3_result_subtype()] to cause a sub-type to be associated with its
5591
+ ** result.
5592
+ ** Every function that invokes [sqlite3_result_subtype()] should have this
5593
+ ** property. If it does not, then the call to [sqlite3_result_subtype()]
5594
+ ** might become a no-op if the function is used as term in an
5595
+ ** [expression index]. On the other hand, SQL functions that never invoke
5596
+ ** [sqlite3_result_subtype()] should avoid setting this property, as the
5597
+ ** purpose of this property is to disable certain optimizations that are
5598
+ ** incompatible with subtypes.
5476
5599
  ** </dd>
5477
5600
  ** </dl>
5478
5601
  */
@@ -5480,6 +5603,7 @@ SQLITE_API int sqlite3_create_window_function(
5480
5603
  #define SQLITE_DIRECTONLY 0x000080000
5481
5604
  #define SQLITE_SUBTYPE 0x000100000
5482
5605
  #define SQLITE_INNOCUOUS 0x000200000
5606
+ #define SQLITE_RESULT_SUBTYPE 0x001000000
5483
5607
 
5484
5608
  /*
5485
5609
  ** CAPI3REF: Deprecated Functions
@@ -5676,6 +5800,12 @@ SQLITE_API int sqlite3_value_encoding(sqlite3_value*);
5676
5800
  ** information can be used to pass a limited amount of context from
5677
5801
  ** one SQL function to another. Use the [sqlite3_result_subtype()]
5678
5802
  ** routine to set the subtype for the return value of an SQL function.
5803
+ **
5804
+ ** Every [application-defined SQL function] that invoke this interface
5805
+ ** should include the [SQLITE_SUBTYPE] property in the text
5806
+ ** encoding argument when the function is [sqlite3_create_function|registered].
5807
+ ** If the [SQLITE_SUBTYPE] property is omitted, then sqlite3_value_subtype()
5808
+ ** might return zero instead of the upstream subtype in some corner cases.
5679
5809
  */
5680
5810
  SQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value*);
5681
5811
 
@@ -5774,48 +5904,56 @@ SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*);
5774
5904
  ** METHOD: sqlite3_context
5775
5905
  **
5776
5906
  ** These functions may be used by (non-aggregate) SQL functions to
5777
- ** associate metadata with argument values. If the same value is passed to
5778
- ** multiple invocations of the same SQL function during query execution, under
5779
- ** some circumstances the associated metadata may be preserved. An example
5780
- ** of where this might be useful is in a regular-expression matching
5781
- ** function. The compiled version of the regular expression can be stored as
5782
- ** metadata associated with the pattern string.
5907
+ ** associate auxiliary data with argument values. If the same argument
5908
+ ** value is passed to multiple invocations of the same SQL function during
5909
+ ** query execution, under some circumstances the associated auxiliary data
5910
+ ** might be preserved. An example of where this might be useful is in a
5911
+ ** regular-expression matching function. The compiled version of the regular
5912
+ ** expression can be stored as auxiliary data associated with the pattern string.
5783
5913
  ** Then as long as the pattern string remains the same,
5784
5914
  ** the compiled regular expression can be reused on multiple
5785
5915
  ** invocations of the same function.
5786
5916
  **
5787
- ** ^The sqlite3_get_auxdata(C,N) interface returns a pointer to the metadata
5917
+ ** ^The sqlite3_get_auxdata(C,N) interface returns a pointer to the auxiliary data
5788
5918
  ** associated by the sqlite3_set_auxdata(C,N,P,X) function with the Nth argument
5789
5919
  ** value to the application-defined function. ^N is zero for the left-most
5790
- ** function argument. ^If there is no metadata
5920
+ ** function argument. ^If there is no auxiliary data
5791
5921
  ** associated with the function argument, the sqlite3_get_auxdata(C,N) interface
5792
5922
  ** returns a NULL pointer.
5793
5923
  **
5794
- ** ^The sqlite3_set_auxdata(C,N,P,X) interface saves P as metadata for the N-th
5795
- ** argument of the application-defined function. ^Subsequent
5924
+ ** ^The sqlite3_set_auxdata(C,N,P,X) interface saves P as auxiliary data for the
5925
+ ** N-th argument of the application-defined function. ^Subsequent
5796
5926
  ** calls to sqlite3_get_auxdata(C,N) return P from the most recent
5797
- ** sqlite3_set_auxdata(C,N,P,X) call if the metadata is still valid or
5798
- ** NULL if the metadata has been discarded.
5927
+ ** sqlite3_set_auxdata(C,N,P,X) call if the auxiliary data is still valid or
5928
+ ** NULL if the auxiliary data has been discarded.
5799
5929
  ** ^After each call to sqlite3_set_auxdata(C,N,P,X) where X is not NULL,
5800
5930
  ** SQLite will invoke the destructor function X with parameter P exactly
5801
- ** once, when the metadata is discarded.
5802
- ** SQLite is free to discard the metadata at any time, including: <ul>
5931
+ ** once, when the auxiliary data is discarded.
5932
+ ** SQLite is free to discard the auxiliary data at any time, including: <ul>
5803
5933
  ** <li> ^(when the corresponding function parameter changes)^, or
5804
5934
  ** <li> ^(when [sqlite3_reset()] or [sqlite3_finalize()] is called for the
5805
5935
  ** SQL statement)^, or
5806
5936
  ** <li> ^(when sqlite3_set_auxdata() is invoked again on the same
5807
5937
  ** parameter)^, or
5808
5938
  ** <li> ^(during the original sqlite3_set_auxdata() call when a memory
5809
- ** allocation error occurs.)^ </ul>
5939
+ ** allocation error occurs.)^
5940
+ ** <li> ^(during the original sqlite3_set_auxdata() call if the function
5941
+ ** is evaluated during query planning instead of during query execution,
5942
+ ** as sometimes happens with [SQLITE_ENABLE_STAT4].)^ </ul>
5810
5943
  **
5811
- ** Note the last bullet in particular. The destructor X in
5944
+ ** Note the last two bullets in particular. The destructor X in
5812
5945
  ** sqlite3_set_auxdata(C,N,P,X) might be called immediately, before the
5813
5946
  ** sqlite3_set_auxdata() interface even returns. Hence sqlite3_set_auxdata()
5814
5947
  ** should be called near the end of the function implementation and the
5815
5948
  ** function implementation should not make any use of P after
5816
- ** sqlite3_set_auxdata() has been called.
5817
- **
5818
- ** ^(In practice, metadata is preserved between function calls for
5949
+ ** sqlite3_set_auxdata() has been called. Furthermore, a call to
5950
+ ** sqlite3_get_auxdata() that occurs immediately after a corresponding call
5951
+ ** to sqlite3_set_auxdata() might still return NULL if an out-of-memory
5952
+ ** condition occurred during the sqlite3_set_auxdata() call or if the
5953
+ ** function is being evaluated during query planning rather than during
5954
+ ** query execution.
5955
+ **
5956
+ ** ^(In practice, auxiliary data is preserved between function calls for
5819
5957
  ** function parameters that are compile-time constants, including literal
5820
5958
  ** values and [parameters] and expressions composed from the same.)^
5821
5959
  **
@@ -5825,10 +5963,67 @@ SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*);
5825
5963
  **
5826
5964
  ** These routines must be called from the same thread in which
5827
5965
  ** the SQL function is running.
5966
+ **
5967
+ ** See also: [sqlite3_get_clientdata()] and [sqlite3_set_clientdata()].
5828
5968
  */
5829
5969
  SQLITE_API void *sqlite3_get_auxdata(sqlite3_context*, int N);
5830
5970
  SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*));
5831
5971
 
5972
+ /*
5973
+ ** CAPI3REF: Database Connection Client Data
5974
+ ** METHOD: sqlite3
5975
+ **
5976
+ ** These functions are used to associate one or more named pointers
5977
+ ** with a [database connection].
5978
+ ** A call to sqlite3_set_clientdata(D,N,P,X) causes the pointer P
5979
+ ** to be attached to [database connection] D using name N. Subsequent
5980
+ ** calls to sqlite3_get_clientdata(D,N) will return a copy of pointer P
5981
+ ** or a NULL pointer if there were no prior calls to
5982
+ ** sqlite3_set_clientdata() with the same values of D and N.
5983
+ ** Names are compared using strcmp() and are thus case sensitive.
5984
+ **
5985
+ ** If P and X are both non-NULL, then the destructor X is invoked with
5986
+ ** argument P on the first of the following occurrences:
5987
+ ** <ul>
5988
+ ** <li> An out-of-memory error occurs during the call to
5989
+ ** sqlite3_set_clientdata() which attempts to register pointer P.
5990
+ ** <li> A subsequent call to sqlite3_set_clientdata(D,N,P,X) is made
5991
+ ** with the same D and N parameters.
5992
+ ** <li> The database connection closes. SQLite does not make any guarantees
5993
+ ** about the order in which destructors are called, only that all
5994
+ ** destructors will be called exactly once at some point during the
5995
+ ** database connection closing process.
5996
+ ** </ul>
5997
+ **
5998
+ ** SQLite does not do anything with client data other than invoke
5999
+ ** destructors on the client data at the appropriate time. The intended
6000
+ ** use for client data is to provide a mechanism for wrapper libraries
6001
+ ** to store additional information about an SQLite database connection.
6002
+ **
6003
+ ** There is no limit (other than available memory) on the number of different
6004
+ ** client data pointers (with different names) that can be attached to a
6005
+ ** single database connection. However, the implementation is optimized
6006
+ ** for the case of having only one or two different client data names.
6007
+ ** Applications and wrapper libraries are discouraged from using more than
6008
+ ** one client data name each.
6009
+ **
6010
+ ** There is no way to enumerate the client data pointers
6011
+ ** associated with a database connection. The N parameter can be thought
6012
+ ** of as a secret key such that only code that knows the secret key is able
6013
+ ** to access the associated data.
6014
+ **
6015
+ ** Security Warning: These interfaces should not be exposed in scripting
6016
+ ** languages or in other circumstances where it might be possible for an
6017
+ ** an attacker to invoke them. Any agent that can invoke these interfaces
6018
+ ** can probably also take control of the process.
6019
+ **
6020
+ ** Database connection client data is only available for SQLite
6021
+ ** version 3.44.0 ([dateof:3.44.0]) and later.
6022
+ **
6023
+ ** See also: [sqlite3_set_auxdata()] and [sqlite3_get_auxdata()].
6024
+ */
6025
+ SQLITE_API void *sqlite3_get_clientdata(sqlite3*,const char*);
6026
+ SQLITE_API int sqlite3_set_clientdata(sqlite3*, const char*, void*, void(*)(void*));
5832
6027
 
5833
6028
  /*
5834
6029
  ** CAPI3REF: Constants Defining Special Destructor Behavior
@@ -6030,6 +6225,20 @@ SQLITE_API int sqlite3_result_zeroblob64(sqlite3_context*, sqlite3_uint64 n);
6030
6225
  ** higher order bits are discarded.
6031
6226
  ** The number of subtype bytes preserved by SQLite might increase
6032
6227
  ** in future releases of SQLite.
6228
+ **
6229
+ ** Every [application-defined SQL function] that invokes this interface
6230
+ ** should include the [SQLITE_RESULT_SUBTYPE] property in its
6231
+ ** text encoding argument when the SQL function is
6232
+ ** [sqlite3_create_function|registered]. If the [SQLITE_RESULT_SUBTYPE]
6233
+ ** property is omitted from the function that invokes sqlite3_result_subtype(),
6234
+ ** then in some cases the sqlite3_result_subtype() might fail to set
6235
+ ** the result subtype.
6236
+ **
6237
+ ** If SQLite is compiled with -DSQLITE_STRICT_SUBTYPE=1, then any
6238
+ ** SQL function that invokes the sqlite3_result_subtype() interface
6239
+ ** and that does not have the SQLITE_RESULT_SUBTYPE property will raise
6240
+ ** an error. Future versions of SQLite might enable -DSQLITE_STRICT_SUBTYPE=1
6241
+ ** by default.
6033
6242
  */
6034
6243
  SQLITE_API void sqlite3_result_subtype(sqlite3_context*,unsigned int);
6035
6244
 
@@ -6201,6 +6410,13 @@ SQLITE_API void sqlite3_activate_cerod(
6201
6410
  ** of the default VFS is not implemented correctly, or not implemented at
6202
6411
  ** all, then the behavior of sqlite3_sleep() may deviate from the description
6203
6412
  ** in the previous paragraphs.
6413
+ **
6414
+ ** If a negative argument is passed to sqlite3_sleep() the results vary by
6415
+ ** VFS and operating system. Some system treat a negative argument as an
6416
+ ** instruction to sleep forever. Others understand it to mean do not sleep
6417
+ ** at all. ^In SQLite version 3.42.0 and later, a negative
6418
+ ** argument passed into sqlite3_sleep() is changed to zero before it is relayed
6419
+ ** down into the xSleep method of the VFS.
6204
6420
  */
6205
6421
  SQLITE_API int sqlite3_sleep(int);
6206
6422
 
@@ -6454,7 +6670,7 @@ SQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName);
6454
6670
  SQLITE_API int sqlite3_txn_state(sqlite3*,const char *zSchema);
6455
6671
 
6456
6672
  /*
6457
- ** CAPI3REF: Allowed return values from [sqlite3_txn_state()]
6673
+ ** CAPI3REF: Allowed return values from sqlite3_txn_state()
6458
6674
  ** KEYWORDS: {transaction state}
6459
6675
  **
6460
6676
  ** These constants define the current transaction state of a database file.
@@ -6586,7 +6802,7 @@ SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
6586
6802
  ** ^Each call to the sqlite3_autovacuum_pages() interface overrides all
6587
6803
  ** previous invocations for that database connection. ^If the callback
6588
6804
  ** argument (C) to sqlite3_autovacuum_pages(D,C,P,X) is a NULL pointer,
6589
- ** then the autovacuum steps callback is cancelled. The return value
6805
+ ** then the autovacuum steps callback is canceled. The return value
6590
6806
  ** from sqlite3_autovacuum_pages() is normally SQLITE_OK, but might
6591
6807
  ** be some other error code if something goes wrong. The current
6592
6808
  ** implementation will only return SQLITE_OK or SQLITE_MISUSE, but other
@@ -7105,6 +7321,10 @@ struct sqlite3_module {
7105
7321
  /* The methods above are in versions 1 and 2 of the sqlite_module object.
7106
7322
  ** Those below are for version 3 and greater. */
7107
7323
  int (*xShadowName)(const char*);
7324
+ /* The methods above are in versions 1 through 3 of the sqlite_module object.
7325
+ ** Those below are for version 4 and greater. */
7326
+ int (*xIntegrity)(sqlite3_vtab *pVTab, const char *zSchema,
7327
+ const char *zTabName, int mFlags, char **pzErr);
7108
7328
  };
7109
7329
 
7110
7330
  /*
@@ -7592,7 +7812,7 @@ SQLITE_API int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64);
7592
7812
  ** code is returned and the transaction rolled back.
7593
7813
  **
7594
7814
  ** Calling this function with an argument that is not a NULL pointer or an
7595
- ** open blob handle results in undefined behaviour. ^Calling this routine
7815
+ ** open blob handle results in undefined behavior. ^Calling this routine
7596
7816
  ** with a null pointer (such as would be returned by a failed call to
7597
7817
  ** [sqlite3_blob_open()]) is a harmless no-op. ^Otherwise, if this function
7598
7818
  ** is passed a valid open blob handle, the values returned by the
@@ -7819,18 +8039,20 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
7819
8039
  **
7820
8040
  ** ^(Some systems (for example, Windows 95) do not support the operation
7821
8041
  ** implemented by sqlite3_mutex_try(). On those systems, sqlite3_mutex_try()
7822
- ** will always return SQLITE_BUSY. The SQLite core only ever uses
7823
- ** sqlite3_mutex_try() as an optimization so this is acceptable
7824
- ** behavior.)^
8042
+ ** will always return SQLITE_BUSY. In most cases the SQLite core only uses
8043
+ ** sqlite3_mutex_try() as an optimization, so this is acceptable
8044
+ ** behavior. The exceptions are unix builds that set the
8045
+ ** SQLITE_ENABLE_SETLK_TIMEOUT build option. In that case a working
8046
+ ** sqlite3_mutex_try() is required.)^
7825
8047
  **
7826
8048
  ** ^The sqlite3_mutex_leave() routine exits a mutex that was
7827
8049
  ** previously entered by the same thread. The behavior
7828
8050
  ** is undefined if the mutex is not currently entered by the
7829
8051
  ** calling thread or is not currently allocated.
7830
8052
  **
7831
- ** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(), or
7832
- ** sqlite3_mutex_leave() is a NULL pointer, then all three routines
7833
- ** behave as no-ops.
8053
+ ** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(),
8054
+ ** sqlite3_mutex_leave(), or sqlite3_mutex_free() is a NULL pointer,
8055
+ ** then any of the four routines behaves as a no-op.
7834
8056
  **
7835
8057
  ** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()].
7836
8058
  */
@@ -8072,6 +8294,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
8072
8294
  #define SQLITE_TESTCTRL_PRNG_SAVE 5
8073
8295
  #define SQLITE_TESTCTRL_PRNG_RESTORE 6
8074
8296
  #define SQLITE_TESTCTRL_PRNG_RESET 7 /* NOT USED */
8297
+ #define SQLITE_TESTCTRL_FK_NO_ACTION 7
8075
8298
  #define SQLITE_TESTCTRL_BITVEC_TEST 8
8076
8299
  #define SQLITE_TESTCTRL_FAULT_INSTALL 9
8077
8300
  #define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10
@@ -8079,6 +8302,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
8079
8302
  #define SQLITE_TESTCTRL_ASSERT 12
8080
8303
  #define SQLITE_TESTCTRL_ALWAYS 13
8081
8304
  #define SQLITE_TESTCTRL_RESERVE 14 /* NOT USED */
8305
+ #define SQLITE_TESTCTRL_JSON_SELFCHECK 14
8082
8306
  #define SQLITE_TESTCTRL_OPTIMIZATIONS 15
8083
8307
  #define SQLITE_TESTCTRL_ISKEYWORD 16 /* NOT USED */
8084
8308
  #define SQLITE_TESTCTRL_SCRATCHMALLOC 17 /* NOT USED */
@@ -8100,7 +8324,8 @@ SQLITE_API int sqlite3_test_control(int op, ...);
8100
8324
  #define SQLITE_TESTCTRL_TRACEFLAGS 31
8101
8325
  #define SQLITE_TESTCTRL_TUNE 32
8102
8326
  #define SQLITE_TESTCTRL_LOGEST 33
8103
- #define SQLITE_TESTCTRL_LAST 33 /* Largest TESTCTRL */
8327
+ #define SQLITE_TESTCTRL_USELONGDOUBLE 34
8328
+ #define SQLITE_TESTCTRL_LAST 34 /* Largest TESTCTRL */
8104
8329
 
8105
8330
  /*
8106
8331
  ** CAPI3REF: SQL Keyword Checking
@@ -9556,7 +9781,7 @@ SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);
9556
9781
  ** [[SQLITE_VTAB_DIRECTONLY]]<dt>SQLITE_VTAB_DIRECTONLY</dt>
9557
9782
  ** <dd>Calls of the form
9558
9783
  ** [sqlite3_vtab_config](db,SQLITE_VTAB_DIRECTONLY) from within the
9559
- ** the [xConnect] or [xCreate] methods of a [virtual table] implmentation
9784
+ ** the [xConnect] or [xCreate] methods of a [virtual table] implementation
9560
9785
  ** prohibits that virtual table from being used from within triggers and
9561
9786
  ** views.
9562
9787
  ** </dd>
@@ -9564,18 +9789,28 @@ SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);
9564
9789
  ** [[SQLITE_VTAB_INNOCUOUS]]<dt>SQLITE_VTAB_INNOCUOUS</dt>
9565
9790
  ** <dd>Calls of the form
9566
9791
  ** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the
9567
- ** the [xConnect] or [xCreate] methods of a [virtual table] implmentation
9792
+ ** the [xConnect] or [xCreate] methods of a [virtual table] implementation
9568
9793
  ** identify that virtual table as being safe to use from within triggers
9569
9794
  ** and views. Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the
9570
9795
  ** virtual table can do no serious harm even if it is controlled by a
9571
9796
  ** malicious hacker. Developers should avoid setting the SQLITE_VTAB_INNOCUOUS
9572
9797
  ** flag unless absolutely necessary.
9573
9798
  ** </dd>
9799
+ **
9800
+ ** [[SQLITE_VTAB_USES_ALL_SCHEMAS]]<dt>SQLITE_VTAB_USES_ALL_SCHEMAS</dt>
9801
+ ** <dd>Calls of the form
9802
+ ** [sqlite3_vtab_config](db,SQLITE_VTAB_USES_ALL_SCHEMA) from within the
9803
+ ** the [xConnect] or [xCreate] methods of a [virtual table] implementation
9804
+ ** instruct the query planner to begin at least a read transaction on
9805
+ ** all schemas ("main", "temp", and any ATTACH-ed databases) whenever the
9806
+ ** virtual table is used.
9807
+ ** </dd>
9574
9808
  ** </dl>
9575
9809
  */
9576
9810
  #define SQLITE_VTAB_CONSTRAINT_SUPPORT 1
9577
9811
  #define SQLITE_VTAB_INNOCUOUS 2
9578
9812
  #define SQLITE_VTAB_DIRECTONLY 3
9813
+ #define SQLITE_VTAB_USES_ALL_SCHEMAS 4
9579
9814
 
9580
9815
  /*
9581
9816
  ** CAPI3REF: Determine The Virtual Table Conflict Policy
@@ -9736,7 +9971,7 @@ SQLITE_API int sqlite3_vtab_distinct(sqlite3_index_info*);
9736
9971
  ** communicated to the xBestIndex method as a
9737
9972
  ** [SQLITE_INDEX_CONSTRAINT_EQ] constraint.)^ If xBestIndex wants to use
9738
9973
  ** this constraint, it must set the corresponding
9739
- ** aConstraintUsage[].argvIndex to a postive integer. ^(Then, under
9974
+ ** aConstraintUsage[].argvIndex to a positive integer. ^(Then, under
9740
9975
  ** the usual mode of handling IN operators, SQLite generates [bytecode]
9741
9976
  ** that invokes the [xFilter|xFilter() method] once for each value
9742
9977
  ** on the right-hand side of the IN operator.)^ Thus the virtual table
@@ -10165,7 +10400,7 @@ SQLITE_API int sqlite3_db_cacheflush(sqlite3*);
10165
10400
  ** When the [sqlite3_blob_write()] API is used to update a blob column,
10166
10401
  ** the pre-update hook is invoked with SQLITE_DELETE. This is because the
10167
10402
  ** in this case the new values are not available. In this case, when a
10168
- ** callback made with op==SQLITE_DELETE is actuall a write using the
10403
+ ** callback made with op==SQLITE_DELETE is actually a write using the
10169
10404
  ** sqlite3_blob_write() API, the [sqlite3_preupdate_blobwrite()] returns
10170
10405
  ** the index of the column being written. In other cases, where the
10171
10406
  ** pre-update hook is being invoked for some other reason, including a
@@ -10426,6 +10661,13 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const c
10426
10661
  ** SQLITE_SERIALIZE_NOCOPY bit is set but no contiguous copy
10427
10662
  ** of the database exists.
10428
10663
  **
10664
+ ** After the call, if the SQLITE_SERIALIZE_NOCOPY bit had been set,
10665
+ ** the returned buffer content will remain accessible and unchanged
10666
+ ** until either the next write operation on the connection or when
10667
+ ** the connection is closed, and applications must not modify the
10668
+ ** buffer. If the bit had been clear, the returned buffer will not
10669
+ ** be accessed by SQLite after the call.
10670
+ **
10429
10671
  ** A call to sqlite3_serialize(D,S,P,F) might return NULL even if the
10430
10672
  ** SQLITE_SERIALIZE_NOCOPY bit is omitted from argument F if a memory
10431
10673
  ** allocation error occurs.
@@ -10474,6 +10716,9 @@ SQLITE_API unsigned char *sqlite3_serialize(
10474
10716
  ** SQLite will try to increase the buffer size using sqlite3_realloc64()
10475
10717
  ** if writes on the database cause it to grow larger than M bytes.
10476
10718
  **
10719
+ ** Applications must not modify the buffer P or invalidate it before
10720
+ ** the database connection D is closed.
10721
+ **
10477
10722
  ** The sqlite3_deserialize() interface will fail with SQLITE_BUSY if the
10478
10723
  ** database is currently in a read transaction or is involved in a backup
10479
10724
  ** operation.
@@ -10482,6 +10727,13 @@ SQLITE_API unsigned char *sqlite3_serialize(
10482
10727
  ** S argument to sqlite3_deserialize(D,S,P,N,M,F) is "temp" then the
10483
10728
  ** function returns SQLITE_ERROR.
10484
10729
  **
10730
+ ** The deserialized database should not be in [WAL mode]. If the database
10731
+ ** is in WAL mode, then any attempt to use the database file will result
10732
+ ** in an [SQLITE_CANTOPEN] error. The application can set the
10733
+ ** [file format version numbers] (bytes 18 and 19) of the input database P
10734
+ ** to 0x01 prior to invoking sqlite3_deserialize(D,S,P,N,M,F) to force the
10735
+ ** database file into rollback mode and work around this limitation.
10736
+ **
10485
10737
  ** If sqlite3_deserialize(D,S,P,N,M,F) fails for any reason and if the
10486
10738
  ** SQLITE_DESERIALIZE_FREEONCLOSE bit is set in argument F, then
10487
10739
  ** [sqlite3_free()] is invoked on argument P prior to returning.
@@ -10750,16 +11002,20 @@ SQLITE_API int sqlite3session_create(
10750
11002
  SQLITE_API void sqlite3session_delete(sqlite3_session *pSession);
10751
11003
 
10752
11004
  /*
10753
- ** CAPIREF: Conigure a Session Object
11005
+ ** CAPI3REF: Configure a Session Object
10754
11006
  ** METHOD: sqlite3_session
10755
11007
  **
10756
11008
  ** This method is used to configure a session object after it has been
10757
- ** created. At present the only valid value for the second parameter is
10758
- ** [SQLITE_SESSION_OBJCONFIG_SIZE].
11009
+ ** created. At present the only valid values for the second parameter are
11010
+ ** [SQLITE_SESSION_OBJCONFIG_SIZE] and [SQLITE_SESSION_OBJCONFIG_ROWID].
10759
11011
  **
10760
- ** Arguments for sqlite3session_object_config()
11012
+ */
11013
+ SQLITE_API int sqlite3session_object_config(sqlite3_session*, int op, void *pArg);
11014
+
11015
+ /*
11016
+ ** CAPI3REF: Options for sqlite3session_object_config
10761
11017
  **
10762
- ** The following values may passed as the the 4th parameter to
11018
+ ** The following values may passed as the the 2nd parameter to
10763
11019
  ** sqlite3session_object_config().
10764
11020
  **
10765
11021
  ** <dt>SQLITE_SESSION_OBJCONFIG_SIZE <dd>
@@ -10775,12 +11031,21 @@ SQLITE_API void sqlite3session_delete(sqlite3_session *pSession);
10775
11031
  **
10776
11032
  ** It is an error (SQLITE_MISUSE) to attempt to modify this setting after
10777
11033
  ** the first table has been attached to the session object.
11034
+ **
11035
+ ** <dt>SQLITE_SESSION_OBJCONFIG_ROWID <dd>
11036
+ ** This option is used to set, clear or query the flag that enables
11037
+ ** collection of data for tables with no explicit PRIMARY KEY.
11038
+ **
11039
+ ** Normally, tables with no explicit PRIMARY KEY are simply ignored
11040
+ ** by the sessions module. However, if this flag is set, it behaves
11041
+ ** as if such tables have a column "_rowid_ INTEGER PRIMARY KEY" inserted
11042
+ ** as their leftmost columns.
11043
+ **
11044
+ ** It is an error (SQLITE_MISUSE) to attempt to modify this setting after
11045
+ ** the first table has been attached to the session object.
10778
11046
  */
10779
- SQLITE_API int sqlite3session_object_config(sqlite3_session*, int op, void *pArg);
10780
-
10781
- /*
10782
- */
10783
- #define SQLITE_SESSION_OBJCONFIG_SIZE 1
11047
+ #define SQLITE_SESSION_OBJCONFIG_SIZE 1
11048
+ #define SQLITE_SESSION_OBJCONFIG_ROWID 2
10784
11049
 
10785
11050
  /*
10786
11051
  ** CAPI3REF: Enable Or Disable A Session Object
@@ -11541,6 +11806,18 @@ SQLITE_API int sqlite3changeset_concat(
11541
11806
  );
11542
11807
 
11543
11808
 
11809
+ /*
11810
+ ** CAPI3REF: Upgrade the Schema of a Changeset/Patchset
11811
+ */
11812
+ SQLITE_API int sqlite3changeset_upgrade(
11813
+ sqlite3 *db,
11814
+ const char *zDb,
11815
+ int nIn, const void *pIn, /* Input changeset */
11816
+ int *pnOut, void **ppOut /* OUT: Inverse of input */
11817
+ );
11818
+
11819
+
11820
+
11544
11821
  /*
11545
11822
  ** CAPI3REF: Changegroup Handle
11546
11823
  **
@@ -11587,6 +11864,38 @@ typedef struct sqlite3_changegroup sqlite3_changegroup;
11587
11864
  */
11588
11865
  SQLITE_API int sqlite3changegroup_new(sqlite3_changegroup **pp);
11589
11866
 
11867
+ /*
11868
+ ** CAPI3REF: Add a Schema to a Changegroup
11869
+ ** METHOD: sqlite3_changegroup_schema
11870
+ **
11871
+ ** This method may be used to optionally enforce the rule that the changesets
11872
+ ** added to the changegroup handle must match the schema of database zDb
11873
+ ** ("main", "temp", or the name of an attached database). If
11874
+ ** sqlite3changegroup_add() is called to add a changeset that is not compatible
11875
+ ** with the configured schema, SQLITE_SCHEMA is returned and the changegroup
11876
+ ** object is left in an undefined state.
11877
+ **
11878
+ ** A changeset schema is considered compatible with the database schema in
11879
+ ** the same way as for sqlite3changeset_apply(). Specifically, for each
11880
+ ** table in the changeset, there exists a database table with:
11881
+ **
11882
+ ** <ul>
11883
+ ** <li> The name identified by the changeset, and
11884
+ ** <li> at least as many columns as recorded in the changeset, and
11885
+ ** <li> the primary key columns in the same position as recorded in
11886
+ ** the changeset.
11887
+ ** </ul>
11888
+ **
11889
+ ** The output of the changegroup object always has the same schema as the
11890
+ ** database nominated using this function. In cases where changesets passed
11891
+ ** to sqlite3changegroup_add() have fewer columns than the corresponding table
11892
+ ** in the database schema, these are filled in using the default column
11893
+ ** values from the database schema. This makes it possible to combined
11894
+ ** changesets that have different numbers of columns for a single table
11895
+ ** within a changegroup, provided that they are otherwise compatible.
11896
+ */
11897
+ SQLITE_API int sqlite3changegroup_schema(sqlite3_changegroup*, sqlite3*, const char *zDb);
11898
+
11590
11899
  /*
11591
11900
  ** CAPI3REF: Add A Changeset To A Changegroup
11592
11901
  ** METHOD: sqlite3_changegroup
@@ -11655,13 +11964,18 @@ SQLITE_API int sqlite3changegroup_new(sqlite3_changegroup **pp);
11655
11964
  ** If the new changeset contains changes to a table that is already present
11656
11965
  ** in the changegroup, then the number of columns and the position of the
11657
11966
  ** primary key columns for the table must be consistent. If this is not the
11658
- ** case, this function fails with SQLITE_SCHEMA. If the input changeset
11659
- ** appears to be corrupt and the corruption is detected, SQLITE_CORRUPT is
11660
- ** returned. Or, if an out-of-memory condition occurs during processing, this
11661
- ** function returns SQLITE_NOMEM. In all cases, if an error occurs the state
11662
- ** of the final contents of the changegroup is undefined.
11967
+ ** case, this function fails with SQLITE_SCHEMA. Except, if the changegroup
11968
+ ** object has been configured with a database schema using the
11969
+ ** sqlite3changegroup_schema() API, then it is possible to combine changesets
11970
+ ** with different numbers of columns for a single table, provided that
11971
+ ** they are otherwise compatible.
11972
+ **
11973
+ ** If the input changeset appears to be corrupt and the corruption is
11974
+ ** detected, SQLITE_CORRUPT is returned. Or, if an out-of-memory condition
11975
+ ** occurs during processing, this function returns SQLITE_NOMEM.
11663
11976
  **
11664
- ** If no error occurs, SQLITE_OK is returned.
11977
+ ** In all cases, if an error occurs the state of the final contents of the
11978
+ ** changegroup is undefined. If no error occurs, SQLITE_OK is returned.
11665
11979
  */
11666
11980
  SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData);
11667
11981
 
@@ -11913,9 +12227,30 @@ SQLITE_API int sqlite3changeset_apply_v2(
11913
12227
  ** Invert the changeset before applying it. This is equivalent to inverting
11914
12228
  ** a changeset using sqlite3changeset_invert() before applying it. It is
11915
12229
  ** an error to specify this flag with a patchset.
12230
+ **
12231
+ ** <dt>SQLITE_CHANGESETAPPLY_IGNORENOOP <dd>
12232
+ ** Do not invoke the conflict handler callback for any changes that
12233
+ ** would not actually modify the database even if they were applied.
12234
+ ** Specifically, this means that the conflict handler is not invoked
12235
+ ** for:
12236
+ ** <ul>
12237
+ ** <li>a delete change if the row being deleted cannot be found,
12238
+ ** <li>an update change if the modified fields are already set to
12239
+ ** their new values in the conflicting row, or
12240
+ ** <li>an insert change if all fields of the conflicting row match
12241
+ ** the row being inserted.
12242
+ ** </ul>
12243
+ **
12244
+ ** <dt>SQLITE_CHANGESETAPPLY_FKNOACTION <dd>
12245
+ ** If this flag it set, then all foreign key constraints in the target
12246
+ ** database behave as if they were declared with "ON UPDATE NO ACTION ON
12247
+ ** DELETE NO ACTION", even if they are actually CASCADE, RESTRICT, SET NULL
12248
+ ** or SET DEFAULT.
11916
12249
  */
11917
12250
  #define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001
11918
12251
  #define SQLITE_CHANGESETAPPLY_INVERT 0x0002
12252
+ #define SQLITE_CHANGESETAPPLY_IGNORENOOP 0x0004
12253
+ #define SQLITE_CHANGESETAPPLY_FKNOACTION 0x0008
11919
12254
 
11920
12255
  /*
11921
12256
  ** CAPI3REF: Constants Passed To The Conflict Handler
@@ -12481,8 +12816,11 @@ struct Fts5PhraseIter {
12481
12816
  ** created with the "columnsize=0" option.
12482
12817
  **
12483
12818
  ** xColumnText:
12484
- ** This function attempts to retrieve the text of column iCol of the
12485
- ** current document. If successful, (*pz) is set to point to a buffer
12819
+ ** If parameter iCol is less than zero, or greater than or equal to the
12820
+ ** number of columns in the table, SQLITE_RANGE is returned.
12821
+ **
12822
+ ** Otherwise, this function attempts to retrieve the text of column iCol of
12823
+ ** the current document. If successful, (*pz) is set to point to a buffer
12486
12824
  ** containing the text in utf-8 encoding, (*pn) is set to the size in bytes
12487
12825
  ** (not characters) of the buffer and SQLITE_OK is returned. Otherwise,
12488
12826
  ** if an error occurs, an SQLite error code is returned and the final values
@@ -12492,8 +12830,10 @@ struct Fts5PhraseIter {
12492
12830
  ** Returns the number of phrases in the current query expression.
12493
12831
  **
12494
12832
  ** xPhraseSize:
12495
- ** Returns the number of tokens in phrase iPhrase of the query. Phrases
12496
- ** are numbered starting from zero.
12833
+ ** If parameter iCol is less than zero, or greater than or equal to the
12834
+ ** number of phrases in the current query, as returned by xPhraseCount,
12835
+ ** 0 is returned. Otherwise, this function returns the number of tokens in
12836
+ ** phrase iPhrase of the query. Phrases are numbered starting from zero.
12497
12837
  **
12498
12838
  ** xInstCount:
12499
12839
  ** Set *pnInst to the total number of occurrences of all phrases within
@@ -12509,12 +12849,13 @@ struct Fts5PhraseIter {
12509
12849
  ** Query for the details of phrase match iIdx within the current row.
12510
12850
  ** Phrase matches are numbered starting from zero, so the iIdx argument
12511
12851
  ** should be greater than or equal to zero and smaller than the value
12512
- ** output by xInstCount().
12852
+ ** output by xInstCount(). If iIdx is less than zero or greater than
12853
+ ** or equal to the value returned by xInstCount(), SQLITE_RANGE is returned.
12513
12854
  **
12514
- ** Usually, output parameter *piPhrase is set to the phrase number, *piCol
12855
+ ** Otherwise, output parameter *piPhrase is set to the phrase number, *piCol
12515
12856
  ** to the column in which it occurs and *piOff the token offset of the
12516
- ** first token of the phrase. Returns SQLITE_OK if successful, or an error
12517
- ** code (i.e. SQLITE_NOMEM) if an error occurs.
12857
+ ** first token of the phrase. SQLITE_OK is returned if successful, or an
12858
+ ** error code (i.e. SQLITE_NOMEM) if an error occurs.
12518
12859
  **
12519
12860
  ** This API can be quite slow if used with an FTS5 table created with the
12520
12861
  ** "detail=none" or "detail=column" option.
@@ -12540,6 +12881,10 @@ struct Fts5PhraseIter {
12540
12881
  ** Invoking Api.xUserData() returns a copy of the pointer passed as
12541
12882
  ** the third argument to pUserData.
12542
12883
  **
12884
+ ** If parameter iPhrase is less than zero, or greater than or equal to
12885
+ ** the number of phrases in the query, as returned by xPhraseCount(),
12886
+ ** this function returns SQLITE_RANGE.
12887
+ **
12543
12888
  ** If the callback function returns any value other than SQLITE_OK, the
12544
12889
  ** query is abandoned and the xQueryPhrase function returns immediately.
12545
12890
  ** If the returned value is SQLITE_DONE, xQueryPhrase returns SQLITE_OK.
@@ -12654,6 +12999,39 @@ struct Fts5PhraseIter {
12654
12999
  **
12655
13000
  ** xPhraseNextColumn()
12656
13001
  ** See xPhraseFirstColumn above.
13002
+ **
13003
+ ** xQueryToken(pFts5, iPhrase, iToken, ppToken, pnToken)
13004
+ ** This is used to access token iToken of phrase iPhrase of the current
13005
+ ** query. Before returning, output parameter *ppToken is set to point
13006
+ ** to a buffer containing the requested token, and *pnToken to the
13007
+ ** size of this buffer in bytes.
13008
+ **
13009
+ ** If iPhrase or iToken are less than zero, or if iPhrase is greater than
13010
+ ** or equal to the number of phrases in the query as reported by
13011
+ ** xPhraseCount(), or if iToken is equal to or greater than the number of
13012
+ ** tokens in the phrase, SQLITE_RANGE is returned and *ppToken and *pnToken
13013
+ are both zeroed.
13014
+ **
13015
+ ** The output text is not a copy of the query text that specified the
13016
+ ** token. It is the output of the tokenizer module. For tokendata=1
13017
+ ** tables, this includes any embedded 0x00 and trailing data.
13018
+ **
13019
+ ** xInstToken(pFts5, iIdx, iToken, ppToken, pnToken)
13020
+ ** This is used to access token iToken of phrase hit iIdx within the
13021
+ ** current row. If iIdx is less than zero or greater than or equal to the
13022
+ ** value returned by xInstCount(), SQLITE_RANGE is returned. Otherwise,
13023
+ ** output variable (*ppToken) is set to point to a buffer containing the
13024
+ ** matching document token, and (*pnToken) to the size of that buffer in
13025
+ ** bytes. This API is not available if the specified token matches a
13026
+ ** prefix query term. In that case both output variables are always set
13027
+ ** to 0.
13028
+ **
13029
+ ** The output text is not a copy of the document text that was tokenized.
13030
+ ** It is the output of the tokenizer module. For tokendata=1 tables, this
13031
+ ** includes any embedded 0x00 and trailing data.
13032
+ **
13033
+ ** This API can be quite slow if used with an FTS5 table created with the
13034
+ ** "detail=none" or "detail=column" option.
12657
13035
  */
12658
13036
  struct Fts5ExtensionApi {
12659
13037
  int iVersion; /* Currently always set to 3 */
@@ -12691,6 +13069,13 @@ struct Fts5ExtensionApi {
12691
13069
 
12692
13070
  int (*xPhraseFirstColumn)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*);
12693
13071
  void (*xPhraseNextColumn)(Fts5Context*, Fts5PhraseIter*, int *piCol);
13072
+
13073
+ /* Below this point are iVersion>=3 only */
13074
+ int (*xQueryToken)(Fts5Context*,
13075
+ int iPhrase, int iToken,
13076
+ const char **ppToken, int *pnToken
13077
+ );
13078
+ int (*xInstToken)(Fts5Context*, int iIdx, int iToken, const char**, int*);
12694
13079
  };
12695
13080
 
12696
13081
  /*
@@ -12885,8 +13270,8 @@ struct Fts5ExtensionApi {
12885
13270
  ** as separate queries of the FTS index are required for each synonym.
12886
13271
  **
12887
13272
  ** When using methods (2) or (3), it is important that the tokenizer only
12888
- ** provide synonyms when tokenizing document text (method (2)) or query
12889
- ** text (method (3)), not both. Doing so will not cause any errors, but is
13273
+ ** provide synonyms when tokenizing document text (method (3)) or query
13274
+ ** text (method (2)), not both. Doing so will not cause any errors, but is
12890
13275
  ** inefficient.
12891
13276
  */
12892
13277
  typedef struct Fts5Tokenizer Fts5Tokenizer;
@@ -12934,7 +13319,7 @@ struct fts5_api {
12934
13319
  int (*xCreateTokenizer)(
12935
13320
  fts5_api *pApi,
12936
13321
  const char *zName,
12937
- void *pContext,
13322
+ void *pUserData,
12938
13323
  fts5_tokenizer *pTokenizer,
12939
13324
  void (*xDestroy)(void*)
12940
13325
  );
@@ -12943,7 +13328,7 @@ struct fts5_api {
12943
13328
  int (*xFindTokenizer)(
12944
13329
  fts5_api *pApi,
12945
13330
  const char *zName,
12946
- void **ppContext,
13331
+ void **ppUserData,
12947
13332
  fts5_tokenizer *pTokenizer
12948
13333
  );
12949
13334
 
@@ -12951,7 +13336,7 @@ struct fts5_api {
12951
13336
  int (*xCreateFunction)(
12952
13337
  fts5_api *pApi,
12953
13338
  const char *zName,
12954
- void *pContext,
13339
+ void *pUserData,
12955
13340
  fts5_extension_function xFunction,
12956
13341
  void (*xDestroy)(void*)
12957
13342
  );