extralite-bundle 2.8.1 → 2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/test-bundle.yml +6 -4
- data/.github/workflows/test.yml +6 -4
- data/CHANGELOG.md +14 -0
- data/README.md +1 -1
- data/ext/extralite/common.c +61 -19
- data/ext/sqlite3/sqlite3.c +11930 -6410
- data/ext/sqlite3/sqlite3.h +414 -73
- data/gemspec.rb +5 -5
- data/lib/extralite/version.rb +1 -1
- data/test/extensions/{text.dylib → arm64/text.dylib} +0 -0
- data/test/extensions/arm64/text.so +0 -0
- data/test/extensions/x86/text.dylib +0 -0
- data/test/extensions/x86/text.so +0 -0
- data/test/test_database.rb +56 -5
- metadata +17 -19
- data/test/extensions/text.so +0 -0
data/ext/sqlite3/sqlite3.h
CHANGED
@@ -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.
|
150
|
-
#define SQLITE_VERSION_NUMBER
|
151
|
-
#define SQLITE_SOURCE_ID "
|
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
|
@@ -764,16 +772,16 @@ struct sqlite3_file {
|
|
764
772
|
** </ul>
|
765
773
|
** xLock() upgrades the database file lock. In other words, xLock() moves the
|
766
774
|
** database file lock in the direction NONE toward EXCLUSIVE. The argument to
|
767
|
-
** xLock() is always
|
775
|
+
** xLock() is always one of SHARED, RESERVED, PENDING, or EXCLUSIVE, never
|
768
776
|
** SQLITE_LOCK_NONE. If the database file lock is already at or above the
|
769
777
|
** requested lock, then the call to xLock() is a no-op.
|
770
778
|
** xUnlock() downgrades the database file lock to either SHARED or NONE.
|
771
|
-
|
779
|
+
** If the lock is already at or below the requested lock state, then the call
|
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
|
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
|
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>
|
2212
|
-
**
|
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].
|
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
|
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
|
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
|
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.
|
2312
|
-
**
|
2313
|
-
**
|
2314
|
-
**
|
2315
|
-
**
|
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
|
2321
|
-
** database handle, SQLite checks if
|
2322
|
-
**
|
2323
|
-
**
|
2324
|
-
**
|
2325
|
-
**
|
2326
|
-
**
|
2327
|
-
**
|
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.
|
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].
|
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
|
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],
|
@@ -3305,8 +3418,8 @@ SQLITE_API int sqlite3_set_authorizer(
|
|
3305
3418
|
#define SQLITE_RECURSIVE 33 /* NULL NULL */
|
3306
3419
|
|
3307
3420
|
/*
|
3308
|
-
** CAPI3REF: Tracing And Profiling Functions
|
3309
|
-
**
|
3421
|
+
** CAPI3REF: Deprecated Tracing And Profiling Functions
|
3422
|
+
** DEPRECATED
|
3310
3423
|
**
|
3311
3424
|
** These routines are deprecated. Use the [sqlite3_trace_v2()] interface
|
3312
3425
|
** instead of the routines described here.
|
@@ -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
|
3574
|
-
** [sqlite3_extended_result_codes(db,1)]
|
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.
|
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
|
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
|
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()
|
@@ -6887,6 +7025,12 @@ SQLITE_API int sqlite3_autovacuum_pages(
|
|
6887
7025
|
** The exceptions defined in this paragraph might change in a future
|
6888
7026
|
** release of SQLite.
|
6889
7027
|
**
|
7028
|
+
** Whether the update hook is invoked before or after the
|
7029
|
+
** corresponding change is currently unspecified and may differ
|
7030
|
+
** depending on the type of change. Do not rely on the order of the
|
7031
|
+
** hook call with regards to the final result of the operation which
|
7032
|
+
** triggers the hook.
|
7033
|
+
**
|
6890
7034
|
** The update hook implementation must not do anything that will modify
|
6891
7035
|
** the database connection that invoked the update hook. Any actions
|
6892
7036
|
** to modify the database connection must be deferred until after the
|
@@ -7421,9 +7565,11 @@ struct sqlite3_module {
|
|
7421
7565
|
** will be returned by the strategy.
|
7422
7566
|
**
|
7423
7567
|
** The xBestIndex method may optionally populate the idxFlags field with a
|
7424
|
-
** mask of SQLITE_INDEX_SCAN_* flags.
|
7425
|
-
**
|
7426
|
-
**
|
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.
|
7427
7573
|
**
|
7428
7574
|
** Additionally, if xBestIndex sets the SQLITE_INDEX_SCAN_UNIQUE flag, then
|
7429
7575
|
** SQLite also assumes that if a call to the xUpdate() method is made as
|
@@ -7487,7 +7633,9 @@ struct sqlite3_index_info {
|
|
7487
7633
|
** [sqlite3_index_info].idxFlags field to some combination of
|
7488
7634
|
** these bits.
|
7489
7635
|
*/
|
7490
|
-
#define SQLITE_INDEX_SCAN_UNIQUE
|
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 */
|
7491
7639
|
|
7492
7640
|
/*
|
7493
7641
|
** CAPI3REF: Virtual Table Constraint Operator Codes
|
@@ -8324,6 +8472,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
|
|
8324
8472
|
#define SQLITE_TESTCTRL_JSON_SELFCHECK 14
|
8325
8473
|
#define SQLITE_TESTCTRL_OPTIMIZATIONS 15
|
8326
8474
|
#define SQLITE_TESTCTRL_ISKEYWORD 16 /* NOT USED */
|
8475
|
+
#define SQLITE_TESTCTRL_GETOPT 16
|
8327
8476
|
#define SQLITE_TESTCTRL_SCRATCHMALLOC 17 /* NOT USED */
|
8328
8477
|
#define SQLITE_TESTCTRL_INTERNAL_FUNCTIONS 17
|
8329
8478
|
#define SQLITE_TESTCTRL_LOCALTIME_FAULT 18
|
@@ -8343,7 +8492,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
|
|
8343
8492
|
#define SQLITE_TESTCTRL_TRACEFLAGS 31
|
8344
8493
|
#define SQLITE_TESTCTRL_TUNE 32
|
8345
8494
|
#define SQLITE_TESTCTRL_LOGEST 33
|
8346
|
-
#define SQLITE_TESTCTRL_USELONGDOUBLE 34
|
8495
|
+
#define SQLITE_TESTCTRL_USELONGDOUBLE 34 /* NOT USED */
|
8347
8496
|
#define SQLITE_TESTCTRL_LAST 34 /* Largest TESTCTRL */
|
8348
8497
|
|
8349
8498
|
/*
|
@@ -8357,7 +8506,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
|
|
8357
8506
|
** The sqlite3_keyword_count() interface returns the number of distinct
|
8358
8507
|
** keywords understood by SQLite.
|
8359
8508
|
**
|
8360
|
-
** The sqlite3_keyword_name(N,Z,L) interface finds the N-th keyword and
|
8509
|
+
** The sqlite3_keyword_name(N,Z,L) interface finds the 0-based N-th keyword and
|
8361
8510
|
** makes *Z point to that keyword expressed as UTF8 and writes the number
|
8362
8511
|
** of bytes in the keyword into *L. The string that *Z points to is not
|
8363
8512
|
** zero-terminated. The sqlite3_keyword_name(N,Z,L) routine returns
|
@@ -9319,6 +9468,16 @@ typedef struct sqlite3_backup sqlite3_backup;
|
|
9319
9468
|
** APIs are not strictly speaking threadsafe. If they are invoked at the
|
9320
9469
|
** same time as another thread is invoking sqlite3_backup_step() it is
|
9321
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>
|
9322
9481
|
*/
|
9323
9482
|
SQLITE_API sqlite3_backup *sqlite3_backup_init(
|
9324
9483
|
sqlite3 *pDest, /* Destination database handle */
|
@@ -9936,24 +10095,45 @@ SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
|
|
9936
10095
|
** <li value="2"><p>
|
9937
10096
|
** ^(If the sqlite3_vtab_distinct() interface returns 2, that means
|
9938
10097
|
** that the query planner does not need the rows returned in any particular
|
9939
|
-
** order, as long as rows with the same values in all
|
9940
|
-
** are adjacent.)^ ^(Furthermore,
|
9941
|
-
**
|
9942
|
-
**
|
9943
|
-
**
|
9944
|
-
**
|
9945
|
-
**
|
9946
|
-
** ^However omitting the extra rows is optional.
|
10098
|
+
** order, as long as rows with the same values in all columns identified
|
10099
|
+
** by "aOrderBy" are adjacent.)^ ^(Furthermore, when two or more rows
|
10100
|
+
** contain the same values for all columns identified by "colUsed", all but
|
10101
|
+
** one such row may optionally be omitted from the result.)^
|
10102
|
+
** The virtual table is not required to omit rows that are duplicates
|
10103
|
+
** over the "colUsed" columns, but if the virtual table can do that without
|
10104
|
+
** too much extra effort, it could potentially help the query to run faster.
|
9947
10105
|
** This mode is used for a DISTINCT query.
|
9948
10106
|
** <li value="3"><p>
|
9949
|
-
** ^(If the sqlite3_vtab_distinct() interface returns 3, that means
|
9950
|
-
**
|
9951
|
-
**
|
9952
|
-
**
|
9953
|
-
**
|
10107
|
+
** ^(If the sqlite3_vtab_distinct() interface returns 3, that means the
|
10108
|
+
** virtual table must return rows in the order defined by "aOrderBy" as
|
10109
|
+
** if the sqlite3_vtab_distinct() interface had returned 0. However if
|
10110
|
+
** two or more rows in the result have the same values for all columns
|
10111
|
+
** identified by "colUsed", then all but one such row may optionally be
|
10112
|
+
** omitted.)^ Like when the return value is 2, the virtual table
|
10113
|
+
** is not required to omit rows that are duplicates over the "colUsed"
|
10114
|
+
** columns, but if the virtual table can do that without
|
10115
|
+
** too much extra effort, it could potentially help the query to run faster.
|
10116
|
+
** This mode is used for queries
|
9954
10117
|
** that have both DISTINCT and ORDER BY clauses.
|
9955
10118
|
** </ol>
|
9956
10119
|
**
|
10120
|
+
** <p>The following table summarizes the conditions under which the
|
10121
|
+
** virtual table is allowed to set the "orderByConsumed" flag based on
|
10122
|
+
** the value returned by sqlite3_vtab_distinct(). This table is a
|
10123
|
+
** restatement of the previous four paragraphs:
|
10124
|
+
**
|
10125
|
+
** <table border=1 cellspacing=0 cellpadding=10 width="90%">
|
10126
|
+
** <tr>
|
10127
|
+
** <td valign="top">sqlite3_vtab_distinct() return value
|
10128
|
+
** <td valign="top">Rows are returned in aOrderBy order
|
10129
|
+
** <td valign="top">Rows with the same value in all aOrderBy columns are adjacent
|
10130
|
+
** <td valign="top">Duplicates over all colUsed columns may be omitted
|
10131
|
+
** <tr><td>0<td>yes<td>yes<td>no
|
10132
|
+
** <tr><td>1<td>no<td>yes<td>no
|
10133
|
+
** <tr><td>2<td>no<td>yes<td>yes
|
10134
|
+
** <tr><td>3<td>yes<td>yes<td>yes
|
10135
|
+
** </table>
|
10136
|
+
**
|
9957
10137
|
** ^For the purposes of comparing virtual table output values to see if the
|
9958
10138
|
** values are same value for sorting purposes, two NULL values are considered
|
9959
10139
|
** to be the same. In other words, the comparison operator is "IS"
|
@@ -10497,6 +10677,14 @@ typedef struct sqlite3_snapshot {
|
|
10497
10677
|
** If there is not already a read-transaction open on schema S when
|
10498
10678
|
** this function is called, one is opened automatically.
|
10499
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
|
+
**
|
10500
10688
|
** The following must be true for this function to succeed. If any of
|
10501
10689
|
** the following statements are false when sqlite3_snapshot_get() is
|
10502
10690
|
** called, SQLITE_ERROR is returned. The final value of *P is undefined
|
@@ -10654,8 +10842,9 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const c
|
|
10654
10842
|
/*
|
10655
10843
|
** CAPI3REF: Serialize a database
|
10656
10844
|
**
|
10657
|
-
** The sqlite3_serialize(D,S,P,F) interface returns a pointer to
|
10658
|
-
** that is a serialization of the S database on
|
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.
|
10659
10848
|
** If P is not a NULL pointer, then the size of the database in bytes
|
10660
10849
|
** is written into *P.
|
10661
10850
|
**
|
@@ -10805,8 +10994,6 @@ SQLITE_API int sqlite3_deserialize(
|
|
10805
10994
|
#if defined(__wasi__)
|
10806
10995
|
# undef SQLITE_WASI
|
10807
10996
|
# define SQLITE_WASI 1
|
10808
|
-
# undef SQLITE_OMIT_WAL
|
10809
|
-
# define SQLITE_OMIT_WAL 1/* because it requires shared memory APIs */
|
10810
10997
|
# ifndef SQLITE_OMIT_LOAD_EXTENSION
|
10811
10998
|
# define SQLITE_OMIT_LOAD_EXTENSION
|
10812
10999
|
# endif
|
@@ -10818,7 +11005,7 @@ SQLITE_API int sqlite3_deserialize(
|
|
10818
11005
|
#ifdef __cplusplus
|
10819
11006
|
} /* End of the 'extern "C"' block */
|
10820
11007
|
#endif
|
10821
|
-
#endif
|
11008
|
+
/* #endif for SQLITE3_H will be added by mksqlite3.tcl */
|
10822
11009
|
|
10823
11010
|
/******** Begin file sqlite3rtree.h *********/
|
10824
11011
|
/*
|
@@ -11998,6 +12185,30 @@ SQLITE_API int sqlite3changegroup_schema(sqlite3_changegroup*, sqlite3*, const c
|
|
11998
12185
|
*/
|
11999
12186
|
SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData);
|
12000
12187
|
|
12188
|
+
/*
|
12189
|
+
** CAPI3REF: Add A Single Change To A Changegroup
|
12190
|
+
** METHOD: sqlite3_changegroup
|
12191
|
+
**
|
12192
|
+
** This function adds the single change currently indicated by the iterator
|
12193
|
+
** passed as the second argument to the changegroup object. The rules for
|
12194
|
+
** adding the change are just as described for [sqlite3changegroup_add()].
|
12195
|
+
**
|
12196
|
+
** If the change is successfully added to the changegroup, SQLITE_OK is
|
12197
|
+
** returned. Otherwise, an SQLite error code is returned.
|
12198
|
+
**
|
12199
|
+
** The iterator must point to a valid entry when this function is called.
|
12200
|
+
** If it does not, SQLITE_ERROR is returned and no change is added to the
|
12201
|
+
** changegroup. Additionally, the iterator must not have been opened with
|
12202
|
+
** the SQLITE_CHANGESETAPPLY_INVERT flag. In this case SQLITE_ERROR is also
|
12203
|
+
** returned.
|
12204
|
+
*/
|
12205
|
+
SQLITE_API int sqlite3changegroup_add_change(
|
12206
|
+
sqlite3_changegroup*,
|
12207
|
+
sqlite3_changeset_iter*
|
12208
|
+
);
|
12209
|
+
|
12210
|
+
|
12211
|
+
|
12001
12212
|
/*
|
12002
12213
|
** CAPI3REF: Obtain A Composite Changeset From A Changegroup
|
12003
12214
|
** METHOD: sqlite3_changegroup
|
@@ -12802,8 +13013,8 @@ struct Fts5PhraseIter {
|
|
12802
13013
|
** EXTENSION API FUNCTIONS
|
12803
13014
|
**
|
12804
13015
|
** xUserData(pFts):
|
12805
|
-
** Return a copy of the
|
12806
|
-
** registered
|
13016
|
+
** Return a copy of the pUserData pointer passed to the xCreateFunction()
|
13017
|
+
** API when the extension function was registered.
|
12807
13018
|
**
|
12808
13019
|
** xColumnTotalSize(pFts, iCol, pnToken):
|
12809
13020
|
** If parameter iCol is less than zero, set output variable *pnToken
|
@@ -12985,6 +13196,10 @@ struct Fts5PhraseIter {
|
|
12985
13196
|
** (i.e. if it is a contentless table), then this API always iterates
|
12986
13197
|
** through an empty set (all calls to xPhraseFirst() set iCol to -1).
|
12987
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
|
+
**
|
12988
13203
|
** xPhraseNext()
|
12989
13204
|
** See xPhraseFirst above.
|
12990
13205
|
**
|
@@ -13041,19 +13256,57 @@ struct Fts5PhraseIter {
|
|
13041
13256
|
** value returned by xInstCount(), SQLITE_RANGE is returned. Otherwise,
|
13042
13257
|
** output variable (*ppToken) is set to point to a buffer containing the
|
13043
13258
|
** matching document token, and (*pnToken) to the size of that buffer in
|
13044
|
-
** bytes.
|
13045
|
-
** prefix query term. In that case both output variables are always set
|
13046
|
-
** to 0.
|
13259
|
+
** bytes.
|
13047
13260
|
**
|
13048
13261
|
** The output text is not a copy of the document text that was tokenized.
|
13049
13262
|
** It is the output of the tokenizer module. For tokendata=1 tables, this
|
13050
13263
|
** includes any embedded 0x00 and trailing data.
|
13051
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
|
+
**
|
13052
13282
|
** This API can be quite slow if used with an FTS5 table created with the
|
13053
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.
|
13054
13307
|
*/
|
13055
13308
|
struct Fts5ExtensionApi {
|
13056
|
-
int iVersion; /* Currently always set to
|
13309
|
+
int iVersion; /* Currently always set to 4 */
|
13057
13310
|
|
13058
13311
|
void *(*xUserData)(Fts5Context*);
|
13059
13312
|
|
@@ -13095,6 +13348,15 @@ struct Fts5ExtensionApi {
|
|
13095
13348
|
const char **ppToken, int *pnToken
|
13096
13349
|
);
|
13097
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
|
+
);
|
13098
13360
|
};
|
13099
13361
|
|
13100
13362
|
/*
|
@@ -13115,7 +13377,7 @@ struct Fts5ExtensionApi {
|
|
13115
13377
|
** A tokenizer instance is required to actually tokenize text.
|
13116
13378
|
**
|
13117
13379
|
** The first argument passed to this function is a copy of the (void*)
|
13118
|
-
** pointer provided by the application when the
|
13380
|
+
** pointer provided by the application when the fts5_tokenizer_v2 object
|
13119
13381
|
** was registered with FTS5 (the third argument to xCreateTokenizer()).
|
13120
13382
|
** The second and third arguments are an array of nul-terminated strings
|
13121
13383
|
** containing the tokenizer arguments, if any, specified following the
|
@@ -13139,7 +13401,7 @@ struct Fts5ExtensionApi {
|
|
13139
13401
|
** argument passed to this function is a pointer to an Fts5Tokenizer object
|
13140
13402
|
** returned by an earlier call to xCreate().
|
13141
13403
|
**
|
13142
|
-
** The
|
13404
|
+
** The third argument indicates the reason that FTS5 is requesting
|
13143
13405
|
** tokenization of the supplied text. This is always one of the following
|
13144
13406
|
** four values:
|
13145
13407
|
**
|
@@ -13163,6 +13425,13 @@ struct Fts5ExtensionApi {
|
|
13163
13425
|
** on a columnsize=0 database.
|
13164
13426
|
** </ul>
|
13165
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
|
+
**
|
13166
13435
|
** For each token in the input string, the supplied callback xToken() must
|
13167
13436
|
** be invoked. The first argument to it should be a copy of the pointer
|
13168
13437
|
** passed as the second argument to xTokenize(). The third and fourth
|
@@ -13186,6 +13455,30 @@ struct Fts5ExtensionApi {
|
|
13186
13455
|
** may abandon the tokenization and return any error code other than
|
13187
13456
|
** SQLITE_OK or SQLITE_DONE.
|
13188
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
|
+
**
|
13189
13482
|
** SYNONYM SUPPORT
|
13190
13483
|
**
|
13191
13484
|
** Custom tokenizers may also support synonyms. Consider a case in which a
|
@@ -13294,6 +13587,33 @@ struct Fts5ExtensionApi {
|
|
13294
13587
|
** inefficient.
|
13295
13588
|
*/
|
13296
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
|
+
*/
|
13297
13617
|
typedef struct fts5_tokenizer fts5_tokenizer;
|
13298
13618
|
struct fts5_tokenizer {
|
13299
13619
|
int (*xCreate)(void*, const char **azArg, int nArg, Fts5Tokenizer **ppOut);
|
@@ -13313,6 +13633,7 @@ struct fts5_tokenizer {
|
|
13313
13633
|
);
|
13314
13634
|
};
|
13315
13635
|
|
13636
|
+
|
13316
13637
|
/* Flags that may be passed as the third argument to xTokenize() */
|
13317
13638
|
#define FTS5_TOKENIZE_QUERY 0x0001
|
13318
13639
|
#define FTS5_TOKENIZE_PREFIX 0x0002
|
@@ -13332,7 +13653,7 @@ struct fts5_tokenizer {
|
|
13332
13653
|
*/
|
13333
13654
|
typedef struct fts5_api fts5_api;
|
13334
13655
|
struct fts5_api {
|
13335
|
-
int iVersion; /* Currently always set to
|
13656
|
+
int iVersion; /* Currently always set to 3 */
|
13336
13657
|
|
13337
13658
|
/* Create a new tokenizer */
|
13338
13659
|
int (*xCreateTokenizer)(
|
@@ -13359,6 +13680,25 @@ struct fts5_api {
|
|
13359
13680
|
fts5_extension_function xFunction,
|
13360
13681
|
void (*xDestroy)(void*)
|
13361
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
|
+
);
|
13362
13702
|
};
|
13363
13703
|
|
13364
13704
|
/*
|
@@ -13372,3 +13712,4 @@ struct fts5_api {
|
|
13372
13712
|
#endif /* _FTS5_H */
|
13373
13713
|
|
13374
13714
|
/******** End of fts5.h *********/
|
13715
|
+
#endif /* SQLITE3_H */
|