extralite-bundle 2.8.2 → 2.10

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.46.0"
150
- #define SQLITE_VERSION_NUMBER 3046000
151
- #define SQLITE_SOURCE_ID "2024-05-23 13:25:27 96c92aba00c8375bc32fafcdf12429c58bd8aabfcadab6683e35bbb9cdebf19e"
149
+ #define SQLITE_VERSION "3.49.0"
150
+ #define SQLITE_VERSION_NUMBER 3049000
151
+ #define SQLITE_SOURCE_ID "2025-02-06 11:55:18 4a7dd425dc2a0e5082a9049c9b4a9d4f199a71583d014c24b4cfe276c5a77cde"
152
152
 
153
153
  /*
154
154
  ** CAPI3REF: Run-Time Library Version Numbers
@@ -652,6 +652,13 @@ SQLITE_API int sqlite3_exec(
652
652
  ** filesystem supports doing multiple write operations atomically when those
653
653
  ** write operations are bracketed by [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] and
654
654
  ** [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE].
655
+ **
656
+ ** The SQLITE_IOCAP_SUBPAGE_READ property means that it is ok to read
657
+ ** from the database file in amounts that are not a multiple of the
658
+ ** page size and that do not begin at a page boundary. Without this
659
+ ** property, SQLite is careful to only do full-page reads and write
660
+ ** on aligned pages, with the one exception that it will do a sub-page
661
+ ** read of the first page to access the database header.
655
662
  */
656
663
  #define SQLITE_IOCAP_ATOMIC 0x00000001
657
664
  #define SQLITE_IOCAP_ATOMIC512 0x00000002
@@ -668,6 +675,7 @@ SQLITE_API int sqlite3_exec(
668
675
  #define SQLITE_IOCAP_POWERSAFE_OVERWRITE 0x00001000
669
676
  #define SQLITE_IOCAP_IMMUTABLE 0x00002000
670
677
  #define SQLITE_IOCAP_BATCH_ATOMIC 0x00004000
678
+ #define SQLITE_IOCAP_SUBPAGE_READ 0x00008000
671
679
 
672
680
  /*
673
681
  ** CAPI3REF: File Locking Levels
@@ -772,8 +780,8 @@ struct sqlite3_file {
772
780
  ** to xUnlock() is a no-op.
773
781
  ** The xCheckReservedLock() method checks whether any database connection,
774
782
  ** either in this process or in some other process, is holding a RESERVED,
775
- ** PENDING, or EXCLUSIVE lock on the file. It returns true
776
- ** if such a lock exists and false otherwise.
783
+ ** PENDING, or EXCLUSIVE lock on the file. It returns, via its output
784
+ ** pointer parameter, true if such a lock exists and false otherwise.
777
785
  **
778
786
  ** The xFileControl() method is a generic interface that allows custom
779
787
  ** VFS implementations to directly control an open file using the
@@ -814,6 +822,7 @@ struct sqlite3_file {
814
822
  ** <li> [SQLITE_IOCAP_POWERSAFE_OVERWRITE]
815
823
  ** <li> [SQLITE_IOCAP_IMMUTABLE]
816
824
  ** <li> [SQLITE_IOCAP_BATCH_ATOMIC]
825
+ ** <li> [SQLITE_IOCAP_SUBPAGE_READ]
817
826
  ** </ul>
818
827
  **
819
828
  ** The SQLITE_IOCAP_ATOMIC property means that all writes of
@@ -1091,6 +1100,11 @@ struct sqlite3_io_methods {
1091
1100
  ** pointed to by the pArg argument. This capability is used during testing
1092
1101
  ** and only needs to be supported when SQLITE_TEST is defined.
1093
1102
  **
1103
+ ** <li>[[SQLITE_FCNTL_NULL_IO]]
1104
+ ** The [SQLITE_FCNTL_NULL_IO] opcode sets the low-level file descriptor
1105
+ ** or file handle for the [sqlite3_file] object such that it will no longer
1106
+ ** read or write to the database file.
1107
+ **
1094
1108
  ** <li>[[SQLITE_FCNTL_WAL_BLOCK]]
1095
1109
  ** The [SQLITE_FCNTL_WAL_BLOCK] is a signal to the VFS layer that it might
1096
1110
  ** be advantageous to block on the next WAL lock if the lock is not immediately
@@ -1244,6 +1258,7 @@ struct sqlite3_io_methods {
1244
1258
  #define SQLITE_FCNTL_EXTERNAL_READER 40
1245
1259
  #define SQLITE_FCNTL_CKSM_FILE 41
1246
1260
  #define SQLITE_FCNTL_RESET_CACHE 42
1261
+ #define SQLITE_FCNTL_NULL_IO 43
1247
1262
 
1248
1263
  /* deprecated names */
1249
1264
  #define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
@@ -2196,7 +2211,15 @@ struct sqlite3_mem_methods {
2196
2211
  ** CAPI3REF: Database Connection Configuration Options
2197
2212
  **
2198
2213
  ** These constants are the available integer configuration options that
2199
- ** can be passed as the second argument to the [sqlite3_db_config()] interface.
2214
+ ** can be passed as the second parameter to the [sqlite3_db_config()] interface.
2215
+ **
2216
+ ** The [sqlite3_db_config()] interface is a var-args functions. It takes a
2217
+ ** variable number of parameters, though always at least two. The number of
2218
+ ** parameters passed into sqlite3_db_config() depends on which of these
2219
+ ** constants is given as the second parameter. This documentation page
2220
+ ** refers to parameters beyond the second as "arguments". Thus, when this
2221
+ ** page says "the N-th argument" it means "the N-th parameter past the
2222
+ ** configuration option" or "the (N+2)-th parameter to sqlite3_db_config()".
2200
2223
  **
2201
2224
  ** New configuration options may be added in future releases of SQLite.
2202
2225
  ** Existing configuration options might be discontinued. Applications
@@ -2208,8 +2231,14 @@ struct sqlite3_mem_methods {
2208
2231
  ** <dl>
2209
2232
  ** [[SQLITE_DBCONFIG_LOOKASIDE]]
2210
2233
  ** <dt>SQLITE_DBCONFIG_LOOKASIDE</dt>
2211
- ** <dd> ^This option takes three additional arguments that determine the
2212
- ** [lookaside memory allocator] configuration for the [database connection].
2234
+ ** <dd> The SQLITE_DBCONFIG_LOOKASIDE option is used to adjust the
2235
+ ** configuration of the lookaside memory allocator within a database
2236
+ ** connection.
2237
+ ** The arguments to the SQLITE_DBCONFIG_LOOKASIDE option are <i>not</i>
2238
+ ** in the [DBCONFIG arguments|usual format].
2239
+ ** The SQLITE_DBCONFIG_LOOKASIDE option takes three arguments, not two,
2240
+ ** so that a call to [sqlite3_db_config()] that uses SQLITE_DBCONFIG_LOOKASIDE
2241
+ ** should have a total of five parameters.
2213
2242
  ** ^The first argument (the third parameter to [sqlite3_db_config()] is a
2214
2243
  ** pointer to a memory buffer to use for lookaside memory.
2215
2244
  ** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb
@@ -2232,7 +2261,8 @@ struct sqlite3_mem_methods {
2232
2261
  ** [[SQLITE_DBCONFIG_ENABLE_FKEY]]
2233
2262
  ** <dt>SQLITE_DBCONFIG_ENABLE_FKEY</dt>
2234
2263
  ** <dd> ^This option is used to enable or disable the enforcement of
2235
- ** [foreign key constraints]. There should be two additional arguments.
2264
+ ** [foreign key constraints]. This is the same setting that is
2265
+ ** enabled or disabled by the [PRAGMA foreign_keys] statement.
2236
2266
  ** The first argument is an integer which is 0 to disable FK enforcement,
2237
2267
  ** positive to enable FK enforcement or negative to leave FK enforcement
2238
2268
  ** unchanged. The second parameter is a pointer to an integer into which
@@ -2254,13 +2284,13 @@ struct sqlite3_mem_methods {
2254
2284
  ** <p>Originally this option disabled all triggers. ^(However, since
2255
2285
  ** SQLite version 3.35.0, TEMP triggers are still allowed even if
2256
2286
  ** this option is off. So, in other words, this option now only disables
2257
- ** triggers in the main database schema or in the schemas of ATTACH-ed
2287
+ ** triggers in the main database schema or in the schemas of [ATTACH]-ed
2258
2288
  ** databases.)^ </dd>
2259
2289
  **
2260
2290
  ** [[SQLITE_DBCONFIG_ENABLE_VIEW]]
2261
2291
  ** <dt>SQLITE_DBCONFIG_ENABLE_VIEW</dt>
2262
2292
  ** <dd> ^This option is used to enable or disable [CREATE VIEW | views].
2263
- ** There should be two additional arguments.
2293
+ ** There must be two additional arguments.
2264
2294
  ** The first argument is an integer which is 0 to disable views,
2265
2295
  ** positive to enable views or negative to leave the setting unchanged.
2266
2296
  ** The second parameter is a pointer to an integer into which
@@ -2279,7 +2309,7 @@ struct sqlite3_mem_methods {
2279
2309
  ** <dd> ^This option is used to enable or disable the
2280
2310
  ** [fts3_tokenizer()] function which is part of the
2281
2311
  ** [FTS3] full-text search engine extension.
2282
- ** There should be two additional arguments.
2312
+ ** There must be two additional arguments.
2283
2313
  ** The first argument is an integer which is 0 to disable fts3_tokenizer() or
2284
2314
  ** positive to enable fts3_tokenizer() or negative to leave the setting
2285
2315
  ** unchanged.
@@ -2294,7 +2324,7 @@ struct sqlite3_mem_methods {
2294
2324
  ** interface independently of the [load_extension()] SQL function.
2295
2325
  ** The [sqlite3_enable_load_extension()] API enables or disables both the
2296
2326
  ** C-API [sqlite3_load_extension()] and the SQL function [load_extension()].
2297
- ** There should be two additional arguments.
2327
+ ** There must be two additional arguments.
2298
2328
  ** When the first argument to this interface is 1, then only the C-API is
2299
2329
  ** enabled and the SQL function remains disabled. If the first argument to
2300
2330
  ** this interface is 0, then both the C-API and the SQL function are disabled.
@@ -2308,23 +2338,30 @@ struct sqlite3_mem_methods {
2308
2338
  **
2309
2339
  ** [[SQLITE_DBCONFIG_MAINDBNAME]] <dt>SQLITE_DBCONFIG_MAINDBNAME</dt>
2310
2340
  ** <dd> ^This option is used to change the name of the "main" database
2311
- ** schema. ^The sole argument is a pointer to a constant UTF8 string
2312
- ** which will become the new schema name in place of "main". ^SQLite
2313
- ** does not make a copy of the new main schema name string, so the application
2314
- ** must ensure that the argument passed into this DBCONFIG option is unchanged
2315
- ** until after the database connection closes.
2341
+ ** schema. This option does not follow the
2342
+ ** [DBCONFIG arguments|usual SQLITE_DBCONFIG argument format].
2343
+ ** This option takes exactly one additional argument so that the
2344
+ ** [sqlite3_db_config()] call has a total of three parameters. The
2345
+ ** extra argument must be a pointer to a constant UTF8 string which
2346
+ ** will become the new schema name in place of "main". ^SQLite does
2347
+ ** not make a copy of the new main schema name string, so the application
2348
+ ** must ensure that the argument passed into SQLITE_DBCONFIG MAINDBNAME
2349
+ ** is unchanged until after the database connection closes.
2316
2350
  ** </dd>
2317
2351
  **
2318
2352
  ** [[SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE]]
2319
2353
  ** <dt>SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE</dt>
2320
- ** <dd> Usually, when a database in wal mode is closed or detached from a
2321
- ** database handle, SQLite checks if this will mean that there are now no
2322
- ** connections at all to the database. If so, it performs a checkpoint
2323
- ** operation before closing the connection. This option may be used to
2324
- ** override this behavior. The first parameter passed to this operation
2325
- ** is an integer - positive to disable checkpoints-on-close, or zero (the
2326
- ** default) to enable them, and negative to leave the setting unchanged.
2327
- ** The second parameter is a pointer to an integer
2354
+ ** <dd> Usually, when a database in [WAL mode] is closed or detached from a
2355
+ ** database handle, SQLite checks if if there are other connections to the
2356
+ ** same database, and if there are no other database connection (if the
2357
+ ** connection being closed is the last open connection to the database),
2358
+ ** then SQLite performs a [checkpoint] before closing the connection and
2359
+ ** deletes the WAL file. The SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE option can
2360
+ ** be used to override that behavior. The first argument passed to this
2361
+ ** operation (the third parameter to [sqlite3_db_config()]) is an integer
2362
+ ** which is positive to disable checkpoints-on-close, or zero (the default)
2363
+ ** to enable them, and negative to leave the setting unchanged.
2364
+ ** The second argument (the fourth parameter) is a pointer to an integer
2328
2365
  ** into which is written 0 or 1 to indicate whether checkpoints-on-close
2329
2366
  ** have been disabled - 0 if they are not disabled, 1 if they are.
2330
2367
  ** </dd>
@@ -2485,7 +2522,7 @@ struct sqlite3_mem_methods {
2485
2522
  ** statistics. For statistics to be collected, the flag must be set on
2486
2523
  ** the database handle both when the SQL statement is prepared and when it
2487
2524
  ** is stepped. The flag is set (collection of statistics is enabled)
2488
- ** by default. This option takes two arguments: an integer and a pointer to
2525
+ ** by default. <p>This option takes two arguments: an integer and a pointer to
2489
2526
  ** an integer.. The first argument is 1, 0, or -1 to enable, disable, or
2490
2527
  ** leave unchanged the statement scanstatus option. If the second argument
2491
2528
  ** is not NULL, then the value of the statement scanstatus setting after
@@ -2499,7 +2536,7 @@ struct sqlite3_mem_methods {
2499
2536
  ** in which tables and indexes are scanned so that the scans start at the end
2500
2537
  ** and work toward the beginning rather than starting at the beginning and
2501
2538
  ** working toward the end. Setting SQLITE_DBCONFIG_REVERSE_SCANORDER is the
2502
- ** same as setting [PRAGMA reverse_unordered_selects]. This option takes
2539
+ ** same as setting [PRAGMA reverse_unordered_selects]. <p>This option takes
2503
2540
  ** two arguments which are an integer and a pointer to an integer. The first
2504
2541
  ** argument is 1, 0, or -1 to enable, disable, or leave unchanged the
2505
2542
  ** reverse scan order flag, respectively. If the second argument is not NULL,
@@ -2508,7 +2545,76 @@ struct sqlite3_mem_methods {
2508
2545
  ** first argument.
2509
2546
  ** </dd>
2510
2547
  **
2548
+ ** [[SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE]]
2549
+ ** <dt>SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE</dt>
2550
+ ** <dd>The SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE option enables or disables
2551
+ ** the ability of the [ATTACH DATABASE] SQL command to create a new database
2552
+ ** file if the database filed named in the ATTACH command does not already
2553
+ ** exist. This ability of ATTACH to create a new database is enabled by
2554
+ ** default. Applications can disable or reenable the ability for ATTACH to
2555
+ ** create new database files using this DBCONFIG option.<p>
2556
+ ** This option takes two arguments which are an integer and a pointer
2557
+ ** to an integer. The first argument is 1, 0, or -1 to enable, disable, or
2558
+ ** leave unchanged the attach-create flag, respectively. If the second
2559
+ ** argument is not NULL, then 0 or 1 is written into the integer that the
2560
+ ** second argument points to depending on if the attach-create flag is set
2561
+ ** after processing the first argument.
2562
+ ** </dd>
2563
+ **
2564
+ ** [[SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE]]
2565
+ ** <dt>SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE</dt>
2566
+ ** <dd>The SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE option enables or disables the
2567
+ ** ability of the [ATTACH DATABASE] SQL command to open a database for writing.
2568
+ ** This capability is enabled by default. Applications can disable or
2569
+ ** reenable this capability using the current DBCONFIG option. If the
2570
+ ** the this capability is disabled, the [ATTACH] command will still work,
2571
+ ** but the database will be opened read-only. If this option is disabled,
2572
+ ** then the ability to create a new database using [ATTACH] is also disabled,
2573
+ ** regardless of the value of the [SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE]
2574
+ ** option.<p>
2575
+ ** This option takes two arguments which are an integer and a pointer
2576
+ ** to an integer. The first argument is 1, 0, or -1 to enable, disable, or
2577
+ ** leave unchanged the ability to ATTACH another database for writing,
2578
+ ** respectively. If the second argument is not NULL, then 0 or 1 is written
2579
+ ** into the integer to which the second argument points, depending on whether
2580
+ ** the ability to ATTACH a read/write database is enabled or disabled
2581
+ ** after processing the first argument.
2582
+ ** </dd>
2583
+ **
2584
+ ** [[SQLITE_DBCONFIG_ENABLE_COMMENTS]]
2585
+ ** <dt>SQLITE_DBCONFIG_ENABLE_COMMENTS</dt>
2586
+ ** <dd>The SQLITE_DBCONFIG_ENABLE_COMMENTS option enables or disables the
2587
+ ** ability to include comments in SQL text. Comments are enabled by default.
2588
+ ** An application can disable or reenable comments in SQL text using this
2589
+ ** DBCONFIG option.<p>
2590
+ ** This option takes two arguments which are an integer and a pointer
2591
+ ** to an integer. The first argument is 1, 0, or -1 to enable, disable, or
2592
+ ** leave unchanged the ability to use comments in SQL text,
2593
+ ** respectively. If the second argument is not NULL, then 0 or 1 is written
2594
+ ** into the integer that the second argument points to depending on if
2595
+ ** comments are allowed in SQL text after processing the first argument.
2596
+ ** </dd>
2597
+ **
2511
2598
  ** </dl>
2599
+ **
2600
+ ** [[DBCONFIG arguments]] <h3>Arguments To SQLITE_DBCONFIG Options</h3>
2601
+ **
2602
+ ** <p>Most of the SQLITE_DBCONFIG options take two arguments, so that the
2603
+ ** overall call to [sqlite3_db_config()] has a total of four parameters.
2604
+ ** The first argument (the third parameter to sqlite3_db_config()) is a integer.
2605
+ ** The second argument is a pointer to an integer. If the first argument is 1,
2606
+ ** then the option becomes enabled. If the first integer argument is 0, then the
2607
+ ** option is disabled. If the first argument is -1, then the option setting
2608
+ ** is unchanged. The second argument, the pointer to an integer, may be NULL.
2609
+ ** If the second argument is not NULL, then a value of 0 or 1 is written into
2610
+ ** the integer to which the second argument points, depending on whether the
2611
+ ** setting is disabled or enabled after applying any changes specified by
2612
+ ** the first argument.
2613
+ **
2614
+ ** <p>While most SQLITE_DBCONFIG options use the argument format
2615
+ ** described in the previous paragraph, the [SQLITE_DBCONFIG_MAINDBNAME]
2616
+ ** and [SQLITE_DBCONFIG_LOOKASIDE] options are different. See the
2617
+ ** documentation of those exceptional options for details.
2512
2618
  */
2513
2619
  #define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */
2514
2620
  #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */
@@ -2530,7 +2636,10 @@ struct sqlite3_mem_methods {
2530
2636
  #define SQLITE_DBCONFIG_TRUSTED_SCHEMA 1017 /* int int* */
2531
2637
  #define SQLITE_DBCONFIG_STMT_SCANSTATUS 1018 /* int int* */
2532
2638
  #define SQLITE_DBCONFIG_REVERSE_SCANORDER 1019 /* int int* */
2533
- #define SQLITE_DBCONFIG_MAX 1019 /* Largest DBCONFIG */
2639
+ #define SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE 1020 /* int int* */
2640
+ #define SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE 1021 /* int int* */
2641
+ #define SQLITE_DBCONFIG_ENABLE_COMMENTS 1022 /* int int* */
2642
+ #define SQLITE_DBCONFIG_MAX 1022 /* Largest DBCONFIG */
2534
2643
 
2535
2644
  /*
2536
2645
  ** CAPI3REF: Enable Or Disable Extended Result Codes
@@ -2622,10 +2731,14 @@ SQLITE_API void sqlite3_set_last_insert_rowid(sqlite3*,sqlite3_int64);
2622
2731
  ** deleted by the most recently completed INSERT, UPDATE or DELETE
2623
2732
  ** statement on the database connection specified by the only parameter.
2624
2733
  ** The two functions are identical except for the type of the return value
2625
- ** and that if the number of rows modified by the most recent INSERT, UPDATE
2734
+ ** and that if the number of rows modified by the most recent INSERT, UPDATE,
2626
2735
  ** or DELETE is greater than the maximum value supported by type "int", then
2627
2736
  ** the return value of sqlite3_changes() is undefined. ^Executing any other
2628
2737
  ** type of SQL statement does not modify the value returned by these functions.
2738
+ ** For the purposes of this interface, a CREATE TABLE AS SELECT statement
2739
+ ** does not count as an INSERT, UPDATE or DELETE statement and hence the rows
2740
+ ** added to the new table by the CREATE TABLE AS SELECT statement are not
2741
+ ** counted.
2629
2742
  **
2630
2743
  ** ^Only changes made directly by the INSERT, UPDATE or DELETE statement are
2631
2744
  ** considered - auxiliary changes caused by [CREATE TRIGGER | triggers],
@@ -3570,8 +3683,8 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
3570
3683
  **
3571
3684
  ** [[OPEN_EXRESCODE]] ^(<dt>[SQLITE_OPEN_EXRESCODE]</dt>
3572
3685
  ** <dd>The database connection comes up in "extended result code mode".
3573
- ** In other words, the database behaves has if
3574
- ** [sqlite3_extended_result_codes(db,1)] where called on the database
3686
+ ** In other words, the database behaves as if
3687
+ ** [sqlite3_extended_result_codes(db,1)] were called on the database
3575
3688
  ** connection as soon as the connection is created. In addition to setting
3576
3689
  ** the extended result code mode, this flag also causes [sqlite3_open_v2()]
3577
3690
  ** to return an extended result code.</dd>
@@ -4185,11 +4298,22 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
4185
4298
  ** <dd>The SQLITE_PREPARE_NO_VTAB flag causes the SQL compiler
4186
4299
  ** to return an error (error code SQLITE_ERROR) if the statement uses
4187
4300
  ** any virtual tables.
4301
+ **
4302
+ ** [[SQLITE_PREPARE_DONT_LOG]] <dt>SQLITE_PREPARE_DONT_LOG</dt>
4303
+ ** <dd>The SQLITE_PREPARE_DONT_LOG flag prevents SQL compiler
4304
+ ** errors from being sent to the error log defined by
4305
+ ** [SQLITE_CONFIG_LOG]. This can be used, for example, to do test
4306
+ ** compiles to see if some SQL syntax is well-formed, without generating
4307
+ ** messages on the global error log when it is not. If the test compile
4308
+ ** fails, the sqlite3_prepare_v3() call returns the same error indications
4309
+ ** with or without this flag; it just omits the call to [sqlite3_log()] that
4310
+ ** logs the error.
4188
4311
  ** </dl>
4189
4312
  */
4190
4313
  #define SQLITE_PREPARE_PERSISTENT 0x01
4191
4314
  #define SQLITE_PREPARE_NORMALIZE 0x02
4192
4315
  #define SQLITE_PREPARE_NO_VTAB 0x04
4316
+ #define SQLITE_PREPARE_DONT_LOG 0x10
4193
4317
 
4194
4318
  /*
4195
4319
  ** CAPI3REF: Compiling An SQL Statement
@@ -4222,13 +4346,17 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
4222
4346
  ** and sqlite3_prepare16_v3() use UTF-16.
4223
4347
  **
4224
4348
  ** ^If the nByte argument is negative, then zSql is read up to the
4225
- ** first zero terminator. ^If nByte is positive, then it is the
4226
- ** number of bytes read from zSql. ^If nByte is zero, then no prepared
4349
+ ** first zero terminator. ^If nByte is positive, then it is the maximum
4350
+ ** number of bytes read from zSql. When nByte is positive, zSql is read
4351
+ ** up to the first zero terminator or until the nByte bytes have been read,
4352
+ ** whichever comes first. ^If nByte is zero, then no prepared
4227
4353
  ** statement is generated.
4228
4354
  ** If the caller knows that the supplied string is nul-terminated, then
4229
4355
  ** there is a small performance advantage to passing an nByte parameter that
4230
4356
  ** is the number of bytes in the input string <i>including</i>
4231
4357
  ** the nul-terminator.
4358
+ ** Note that nByte measure the length of the input in bytes, not
4359
+ ** characters, even for the UTF-16 interfaces.
4232
4360
  **
4233
4361
  ** ^If pzTail is not NULL then *pzTail is made to point to the first byte
4234
4362
  ** past the end of the first SQL statement in zSql. These routines only
@@ -5599,7 +5727,7 @@ SQLITE_API int sqlite3_create_window_function(
5599
5727
  ** This flag instructs SQLite to omit some corner-case optimizations that
5600
5728
  ** might disrupt the operation of the [sqlite3_value_subtype()] function,
5601
5729
  ** causing it to return zero rather than the correct subtype().
5602
- ** SQL functions that invokes [sqlite3_value_subtype()] should have this
5730
+ ** All SQL functions that invoke [sqlite3_value_subtype()] should have this
5603
5731
  ** property. If the SQLITE_SUBTYPE property is omitted, then the return
5604
5732
  ** value from [sqlite3_value_subtype()] might sometimes be zero even though
5605
5733
  ** a non-zero subtype was specified by the function argument expression.
@@ -5615,6 +5743,15 @@ SQLITE_API int sqlite3_create_window_function(
5615
5743
  ** [sqlite3_result_subtype()] should avoid setting this property, as the
5616
5744
  ** purpose of this property is to disable certain optimizations that are
5617
5745
  ** incompatible with subtypes.
5746
+ **
5747
+ ** [[SQLITE_SELFORDER1]] <dt>SQLITE_SELFORDER1</dt><dd>
5748
+ ** The SQLITE_SELFORDER1 flag indicates that the function is an aggregate
5749
+ ** that internally orders the values provided to the first argument. The
5750
+ ** ordered-set aggregate SQL notation with a single ORDER BY term can be
5751
+ ** used to invoke this function. If the ordered-set aggregate notation is
5752
+ ** used on a function that lacks this flag, then an error is raised. Note
5753
+ ** that the ordered-set aggregate syntax is only available if SQLite is
5754
+ ** built using the -DSQLITE_ENABLE_ORDERED_SET_AGGREGATES compile-time option.
5618
5755
  ** </dd>
5619
5756
  ** </dl>
5620
5757
  */
@@ -5623,6 +5760,7 @@ SQLITE_API int sqlite3_create_window_function(
5623
5760
  #define SQLITE_SUBTYPE 0x000100000
5624
5761
  #define SQLITE_INNOCUOUS 0x000200000
5625
5762
  #define SQLITE_RESULT_SUBTYPE 0x001000000
5763
+ #define SQLITE_SELFORDER1 0x002000000
5626
5764
 
5627
5765
  /*
5628
5766
  ** CAPI3REF: Deprecated Functions
@@ -5820,7 +5958,7 @@ SQLITE_API int sqlite3_value_encoding(sqlite3_value*);
5820
5958
  ** one SQL function to another. Use the [sqlite3_result_subtype()]
5821
5959
  ** routine to set the subtype for the return value of an SQL function.
5822
5960
  **
5823
- ** Every [application-defined SQL function] that invoke this interface
5961
+ ** Every [application-defined SQL function] that invokes this interface
5824
5962
  ** should include the [SQLITE_SUBTYPE] property in the text
5825
5963
  ** encoding argument when the function is [sqlite3_create_function|registered].
5826
5964
  ** If the [SQLITE_SUBTYPE] property is omitted, then sqlite3_value_subtype()
@@ -7427,9 +7565,11 @@ struct sqlite3_module {
7427
7565
  ** will be returned by the strategy.
7428
7566
  **
7429
7567
  ** The xBestIndex method may optionally populate the idxFlags field with a
7430
- ** mask of SQLITE_INDEX_SCAN_* flags. Currently there is only one such flag -
7431
- ** SQLITE_INDEX_SCAN_UNIQUE. If the xBestIndex method sets this flag, SQLite
7432
- ** assumes that the strategy may visit at most one row.
7568
+ ** mask of SQLITE_INDEX_SCAN_* flags. One such flag is
7569
+ ** [SQLITE_INDEX_SCAN_HEX], which if set causes the [EXPLAIN QUERY PLAN]
7570
+ ** output to show the idxNum has hex instead of as decimal. Another flag is
7571
+ ** SQLITE_INDEX_SCAN_UNIQUE, which if set indicates that the query plan will
7572
+ ** return at most one row.
7433
7573
  **
7434
7574
  ** Additionally, if xBestIndex sets the SQLITE_INDEX_SCAN_UNIQUE flag, then
7435
7575
  ** SQLite also assumes that if a call to the xUpdate() method is made as
@@ -7493,7 +7633,9 @@ struct sqlite3_index_info {
7493
7633
  ** [sqlite3_index_info].idxFlags field to some combination of
7494
7634
  ** these bits.
7495
7635
  */
7496
- #define SQLITE_INDEX_SCAN_UNIQUE 1 /* Scan visits at most 1 row */
7636
+ #define SQLITE_INDEX_SCAN_UNIQUE 0x00000001 /* Scan visits at most 1 row */
7637
+ #define SQLITE_INDEX_SCAN_HEX 0x00000002 /* Display idxNum as hex */
7638
+ /* in EXPLAIN QUERY PLAN */
7497
7639
 
7498
7640
  /*
7499
7641
  ** CAPI3REF: Virtual Table Constraint Operator Codes
@@ -8330,6 +8472,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
8330
8472
  #define SQLITE_TESTCTRL_JSON_SELFCHECK 14
8331
8473
  #define SQLITE_TESTCTRL_OPTIMIZATIONS 15
8332
8474
  #define SQLITE_TESTCTRL_ISKEYWORD 16 /* NOT USED */
8475
+ #define SQLITE_TESTCTRL_GETOPT 16
8333
8476
  #define SQLITE_TESTCTRL_SCRATCHMALLOC 17 /* NOT USED */
8334
8477
  #define SQLITE_TESTCTRL_INTERNAL_FUNCTIONS 17
8335
8478
  #define SQLITE_TESTCTRL_LOCALTIME_FAULT 18
@@ -8349,7 +8492,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
8349
8492
  #define SQLITE_TESTCTRL_TRACEFLAGS 31
8350
8493
  #define SQLITE_TESTCTRL_TUNE 32
8351
8494
  #define SQLITE_TESTCTRL_LOGEST 33
8352
- #define SQLITE_TESTCTRL_USELONGDOUBLE 34
8495
+ #define SQLITE_TESTCTRL_USELONGDOUBLE 34 /* NOT USED */
8353
8496
  #define SQLITE_TESTCTRL_LAST 34 /* Largest TESTCTRL */
8354
8497
 
8355
8498
  /*
@@ -9325,6 +9468,16 @@ typedef struct sqlite3_backup sqlite3_backup;
9325
9468
  ** APIs are not strictly speaking threadsafe. If they are invoked at the
9326
9469
  ** same time as another thread is invoking sqlite3_backup_step() it is
9327
9470
  ** possible that they return invalid values.
9471
+ **
9472
+ ** <b>Alternatives To Using The Backup API</b>
9473
+ **
9474
+ ** Other techniques for safely creating a consistent backup of an SQLite
9475
+ ** database include:
9476
+ **
9477
+ ** <ul>
9478
+ ** <li> The [VACUUM INTO] command.
9479
+ ** <li> The [sqlite3_rsync] utility program.
9480
+ ** </ul>
9328
9481
  */
9329
9482
  SQLITE_API sqlite3_backup *sqlite3_backup_init(
9330
9483
  sqlite3 *pDest, /* Destination database handle */
@@ -10524,6 +10677,14 @@ typedef struct sqlite3_snapshot {
10524
10677
  ** If there is not already a read-transaction open on schema S when
10525
10678
  ** this function is called, one is opened automatically.
10526
10679
  **
10680
+ ** If a read-transaction is opened by this function, then it is guaranteed
10681
+ ** that the returned snapshot object may not be invalidated by a database
10682
+ ** writer or checkpointer until after the read-transaction is closed. This
10683
+ ** is not guaranteed if a read-transaction is already open when this
10684
+ ** function is called. In that case, any subsequent write or checkpoint
10685
+ ** operation on the database may invalidate the returned snapshot handle,
10686
+ ** even while the read-transaction remains open.
10687
+ **
10527
10688
  ** The following must be true for this function to succeed. If any of
10528
10689
  ** the following statements are false when sqlite3_snapshot_get() is
10529
10690
  ** called, SQLITE_ERROR is returned. The final value of *P is undefined
@@ -10681,8 +10842,9 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const c
10681
10842
  /*
10682
10843
  ** CAPI3REF: Serialize a database
10683
10844
  **
10684
- ** The sqlite3_serialize(D,S,P,F) interface returns a pointer to memory
10685
- ** that is a serialization of the S database on [database connection] D.
10845
+ ** The sqlite3_serialize(D,S,P,F) interface returns a pointer to
10846
+ ** memory that is a serialization of the S database on
10847
+ ** [database connection] D. If S is a NULL pointer, the main database is used.
10686
10848
  ** If P is not a NULL pointer, then the size of the database in bytes
10687
10849
  ** is written into *P.
10688
10850
  **
@@ -10832,8 +10994,6 @@ SQLITE_API int sqlite3_deserialize(
10832
10994
  #if defined(__wasi__)
10833
10995
  # undef SQLITE_WASI
10834
10996
  # define SQLITE_WASI 1
10835
- # undef SQLITE_OMIT_WAL
10836
- # define SQLITE_OMIT_WAL 1/* because it requires shared memory APIs */
10837
10997
  # ifndef SQLITE_OMIT_LOAD_EXTENSION
10838
10998
  # define SQLITE_OMIT_LOAD_EXTENSION
10839
10999
  # endif
@@ -10845,7 +11005,7 @@ SQLITE_API int sqlite3_deserialize(
10845
11005
  #ifdef __cplusplus
10846
11006
  } /* End of the 'extern "C"' block */
10847
11007
  #endif
10848
- #endif /* SQLITE3_H */
11008
+ /* #endif for SQLITE3_H will be added by mksqlite3.tcl */
10849
11009
 
10850
11010
  /******** Begin file sqlite3rtree.h *********/
10851
11011
  /*
@@ -13036,6 +13196,10 @@ struct Fts5PhraseIter {
13036
13196
  ** (i.e. if it is a contentless table), then this API always iterates
13037
13197
  ** through an empty set (all calls to xPhraseFirst() set iCol to -1).
13038
13198
  **
13199
+ ** In all cases, matches are visited in (column ASC, offset ASC) order.
13200
+ ** i.e. all those in column 0, sorted by offset, followed by those in
13201
+ ** column 1, etc.
13202
+ **
13039
13203
  ** xPhraseNext()
13040
13204
  ** See xPhraseFirst above.
13041
13205
  **
@@ -13092,19 +13256,57 @@ struct Fts5PhraseIter {
13092
13256
  ** value returned by xInstCount(), SQLITE_RANGE is returned. Otherwise,
13093
13257
  ** output variable (*ppToken) is set to point to a buffer containing the
13094
13258
  ** matching document token, and (*pnToken) to the size of that buffer in
13095
- ** bytes. This API is not available if the specified token matches a
13096
- ** prefix query term. In that case both output variables are always set
13097
- ** to 0.
13259
+ ** bytes.
13098
13260
  **
13099
13261
  ** The output text is not a copy of the document text that was tokenized.
13100
13262
  ** It is the output of the tokenizer module. For tokendata=1 tables, this
13101
13263
  ** includes any embedded 0x00 and trailing data.
13102
13264
  **
13265
+ ** This API may be slow in some cases if the token identified by parameters
13266
+ ** iIdx and iToken matched a prefix token in the query. In most cases, the
13267
+ ** first call to this API for each prefix token in the query is forced
13268
+ ** to scan the portion of the full-text index that matches the prefix
13269
+ ** token to collect the extra data required by this API. If the prefix
13270
+ ** token matches a large number of token instances in the document set,
13271
+ ** this may be a performance problem.
13272
+ **
13273
+ ** If the user knows in advance that a query may use this API for a
13274
+ ** prefix token, FTS5 may be configured to collect all required data as part
13275
+ ** of the initial querying of the full-text index, avoiding the second scan
13276
+ ** entirely. This also causes prefix queries that do not use this API to
13277
+ ** run more slowly and use more memory. FTS5 may be configured in this way
13278
+ ** either on a per-table basis using the [FTS5 insttoken | 'insttoken']
13279
+ ** option, or on a per-query basis using the
13280
+ ** [fts5_insttoken | fts5_insttoken()] user function.
13281
+ **
13103
13282
  ** This API can be quite slow if used with an FTS5 table created with the
13104
13283
  ** "detail=none" or "detail=column" option.
13284
+ **
13285
+ ** xColumnLocale(pFts5, iIdx, pzLocale, pnLocale)
13286
+ ** If parameter iCol is less than zero, or greater than or equal to the
13287
+ ** number of columns in the table, SQLITE_RANGE is returned.
13288
+ **
13289
+ ** Otherwise, this function attempts to retrieve the locale associated
13290
+ ** with column iCol of the current row. Usually, there is no associated
13291
+ ** locale, and output parameters (*pzLocale) and (*pnLocale) are set
13292
+ ** to NULL and 0, respectively. However, if the fts5_locale() function
13293
+ ** was used to associate a locale with the value when it was inserted
13294
+ ** into the fts5 table, then (*pzLocale) is set to point to a nul-terminated
13295
+ ** buffer containing the name of the locale in utf-8 encoding. (*pnLocale)
13296
+ ** is set to the size in bytes of the buffer, not including the
13297
+ ** nul-terminator.
13298
+ **
13299
+ ** If successful, SQLITE_OK is returned. Or, if an error occurs, an
13300
+ ** SQLite error code is returned. The final value of the output parameters
13301
+ ** is undefined in this case.
13302
+ **
13303
+ ** xTokenize_v2:
13304
+ ** Tokenize text using the tokenizer belonging to the FTS5 table. This
13305
+ ** API is the same as the xTokenize() API, except that it allows a tokenizer
13306
+ ** locale to be specified.
13105
13307
  */
13106
13308
  struct Fts5ExtensionApi {
13107
- int iVersion; /* Currently always set to 3 */
13309
+ int iVersion; /* Currently always set to 4 */
13108
13310
 
13109
13311
  void *(*xUserData)(Fts5Context*);
13110
13312
 
@@ -13146,6 +13348,15 @@ struct Fts5ExtensionApi {
13146
13348
  const char **ppToken, int *pnToken
13147
13349
  );
13148
13350
  int (*xInstToken)(Fts5Context*, int iIdx, int iToken, const char**, int*);
13351
+
13352
+ /* Below this point are iVersion>=4 only */
13353
+ int (*xColumnLocale)(Fts5Context*, int iCol, const char **pz, int *pn);
13354
+ int (*xTokenize_v2)(Fts5Context*,
13355
+ const char *pText, int nText, /* Text to tokenize */
13356
+ const char *pLocale, int nLocale, /* Locale to pass to tokenizer */
13357
+ void *pCtx, /* Context passed to xToken() */
13358
+ int (*xToken)(void*, int, const char*, int, int, int) /* Callback */
13359
+ );
13149
13360
  };
13150
13361
 
13151
13362
  /*
@@ -13166,7 +13377,7 @@ struct Fts5ExtensionApi {
13166
13377
  ** A tokenizer instance is required to actually tokenize text.
13167
13378
  **
13168
13379
  ** The first argument passed to this function is a copy of the (void*)
13169
- ** pointer provided by the application when the fts5_tokenizer object
13380
+ ** pointer provided by the application when the fts5_tokenizer_v2 object
13170
13381
  ** was registered with FTS5 (the third argument to xCreateTokenizer()).
13171
13382
  ** The second and third arguments are an array of nul-terminated strings
13172
13383
  ** containing the tokenizer arguments, if any, specified following the
@@ -13190,7 +13401,7 @@ struct Fts5ExtensionApi {
13190
13401
  ** argument passed to this function is a pointer to an Fts5Tokenizer object
13191
13402
  ** returned by an earlier call to xCreate().
13192
13403
  **
13193
- ** The second argument indicates the reason that FTS5 is requesting
13404
+ ** The third argument indicates the reason that FTS5 is requesting
13194
13405
  ** tokenization of the supplied text. This is always one of the following
13195
13406
  ** four values:
13196
13407
  **
@@ -13214,6 +13425,13 @@ struct Fts5ExtensionApi {
13214
13425
  ** on a columnsize=0 database.
13215
13426
  ** </ul>
13216
13427
  **
13428
+ ** The sixth and seventh arguments passed to xTokenize() - pLocale and
13429
+ ** nLocale - are a pointer to a buffer containing the locale to use for
13430
+ ** tokenization (e.g. "en_US") and its size in bytes, respectively. The
13431
+ ** pLocale buffer is not nul-terminated. pLocale may be passed NULL (in
13432
+ ** which case nLocale is always 0) to indicate that the tokenizer should
13433
+ ** use its default locale.
13434
+ **
13217
13435
  ** For each token in the input string, the supplied callback xToken() must
13218
13436
  ** be invoked. The first argument to it should be a copy of the pointer
13219
13437
  ** passed as the second argument to xTokenize(). The third and fourth
@@ -13237,6 +13455,30 @@ struct Fts5ExtensionApi {
13237
13455
  ** may abandon the tokenization and return any error code other than
13238
13456
  ** SQLITE_OK or SQLITE_DONE.
13239
13457
  **
13458
+ ** If the tokenizer is registered using an fts5_tokenizer_v2 object,
13459
+ ** then the xTokenize() method has two additional arguments - pLocale
13460
+ ** and nLocale. These specify the locale that the tokenizer should use
13461
+ ** for the current request. If pLocale and nLocale are both 0, then the
13462
+ ** tokenizer should use its default locale. Otherwise, pLocale points to
13463
+ ** an nLocale byte buffer containing the name of the locale to use as utf-8
13464
+ ** text. pLocale is not nul-terminated.
13465
+ **
13466
+ ** FTS5_TOKENIZER
13467
+ **
13468
+ ** There is also an fts5_tokenizer object. This is an older, deprecated,
13469
+ ** version of fts5_tokenizer_v2. It is similar except that:
13470
+ **
13471
+ ** <ul>
13472
+ ** <li> There is no "iVersion" field, and
13473
+ ** <li> The xTokenize() method does not take a locale argument.
13474
+ ** </ul>
13475
+ **
13476
+ ** Legacy fts5_tokenizer tokenizers must be registered using the
13477
+ ** legacy xCreateTokenizer() function, instead of xCreateTokenizer_v2().
13478
+ **
13479
+ ** Tokenizer implementations registered using either API may be retrieved
13480
+ ** using both xFindTokenizer() and xFindTokenizer_v2().
13481
+ **
13240
13482
  ** SYNONYM SUPPORT
13241
13483
  **
13242
13484
  ** Custom tokenizers may also support synonyms. Consider a case in which a
@@ -13345,6 +13587,33 @@ struct Fts5ExtensionApi {
13345
13587
  ** inefficient.
13346
13588
  */
13347
13589
  typedef struct Fts5Tokenizer Fts5Tokenizer;
13590
+ typedef struct fts5_tokenizer_v2 fts5_tokenizer_v2;
13591
+ struct fts5_tokenizer_v2 {
13592
+ int iVersion; /* Currently always 2 */
13593
+
13594
+ int (*xCreate)(void*, const char **azArg, int nArg, Fts5Tokenizer **ppOut);
13595
+ void (*xDelete)(Fts5Tokenizer*);
13596
+ int (*xTokenize)(Fts5Tokenizer*,
13597
+ void *pCtx,
13598
+ int flags, /* Mask of FTS5_TOKENIZE_* flags */
13599
+ const char *pText, int nText,
13600
+ const char *pLocale, int nLocale,
13601
+ int (*xToken)(
13602
+ void *pCtx, /* Copy of 2nd argument to xTokenize() */
13603
+ int tflags, /* Mask of FTS5_TOKEN_* flags */
13604
+ const char *pToken, /* Pointer to buffer containing token */
13605
+ int nToken, /* Size of token in bytes */
13606
+ int iStart, /* Byte offset of token within input text */
13607
+ int iEnd /* Byte offset of end of token within input text */
13608
+ )
13609
+ );
13610
+ };
13611
+
13612
+ /*
13613
+ ** New code should use the fts5_tokenizer_v2 type to define tokenizer
13614
+ ** implementations. The following type is included for legacy applications
13615
+ ** that still use it.
13616
+ */
13348
13617
  typedef struct fts5_tokenizer fts5_tokenizer;
13349
13618
  struct fts5_tokenizer {
13350
13619
  int (*xCreate)(void*, const char **azArg, int nArg, Fts5Tokenizer **ppOut);
@@ -13364,6 +13633,7 @@ struct fts5_tokenizer {
13364
13633
  );
13365
13634
  };
13366
13635
 
13636
+
13367
13637
  /* Flags that may be passed as the third argument to xTokenize() */
13368
13638
  #define FTS5_TOKENIZE_QUERY 0x0001
13369
13639
  #define FTS5_TOKENIZE_PREFIX 0x0002
@@ -13383,7 +13653,7 @@ struct fts5_tokenizer {
13383
13653
  */
13384
13654
  typedef struct fts5_api fts5_api;
13385
13655
  struct fts5_api {
13386
- int iVersion; /* Currently always set to 2 */
13656
+ int iVersion; /* Currently always set to 3 */
13387
13657
 
13388
13658
  /* Create a new tokenizer */
13389
13659
  int (*xCreateTokenizer)(
@@ -13410,6 +13680,25 @@ struct fts5_api {
13410
13680
  fts5_extension_function xFunction,
13411
13681
  void (*xDestroy)(void*)
13412
13682
  );
13683
+
13684
+ /* APIs below this point are only available if iVersion>=3 */
13685
+
13686
+ /* Create a new tokenizer */
13687
+ int (*xCreateTokenizer_v2)(
13688
+ fts5_api *pApi,
13689
+ const char *zName,
13690
+ void *pUserData,
13691
+ fts5_tokenizer_v2 *pTokenizer,
13692
+ void (*xDestroy)(void*)
13693
+ );
13694
+
13695
+ /* Find an existing tokenizer */
13696
+ int (*xFindTokenizer_v2)(
13697
+ fts5_api *pApi,
13698
+ const char *zName,
13699
+ void **ppUserData,
13700
+ fts5_tokenizer_v2 **ppTokenizer
13701
+ );
13413
13702
  };
13414
13703
 
13415
13704
  /*
@@ -13423,3 +13712,4 @@ struct fts5_api {
13423
13712
  #endif /* _FTS5_H */
13424
13713
 
13425
13714
  /******** End of fts5.h *********/
13715
+ #endif /* SQLITE3_H */