@op-engineering/op-sqlite 12.0.3 → 13.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/CMakeLists.txt +3 -1
- package/android/build.gradle +1 -1
- package/cpp/sqlcipher/sqlite3.c +9802 -5435
- package/cpp/sqlcipher/sqlite3.h +343 -53
- package/op-sqlite.podspec +1 -1
- package/package.json +1 -1
package/cpp/sqlcipher/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.1"
|
|
150
|
+
#define SQLITE_VERSION_NUMBER 3049001
|
|
151
|
+
#define SQLITE_SOURCE_ID "2025-02-18 13:38:58 873d4e274b4988d260ba8354a9718324a1c26187a4ab4c1cc0227c03d0f1alt1"
|
|
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
|
|
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],
|
|
@@ -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()
|
|
@@ -7487,9 +7625,11 @@ struct sqlite3_module {
|
|
|
7487
7625
|
** will be returned by the strategy.
|
|
7488
7626
|
**
|
|
7489
7627
|
** The xBestIndex method may optionally populate the idxFlags field with a
|
|
7490
|
-
** mask of SQLITE_INDEX_SCAN_* flags.
|
|
7491
|
-
**
|
|
7492
|
-
**
|
|
7628
|
+
** mask of SQLITE_INDEX_SCAN_* flags. One such flag is
|
|
7629
|
+
** [SQLITE_INDEX_SCAN_HEX], which if set causes the [EXPLAIN QUERY PLAN]
|
|
7630
|
+
** output to show the idxNum has hex instead of as decimal. Another flag is
|
|
7631
|
+
** SQLITE_INDEX_SCAN_UNIQUE, which if set indicates that the query plan will
|
|
7632
|
+
** return at most one row.
|
|
7493
7633
|
**
|
|
7494
7634
|
** Additionally, if xBestIndex sets the SQLITE_INDEX_SCAN_UNIQUE flag, then
|
|
7495
7635
|
** SQLite also assumes that if a call to the xUpdate() method is made as
|
|
@@ -7553,7 +7693,9 @@ struct sqlite3_index_info {
|
|
|
7553
7693
|
** [sqlite3_index_info].idxFlags field to some combination of
|
|
7554
7694
|
** these bits.
|
|
7555
7695
|
*/
|
|
7556
|
-
#define SQLITE_INDEX_SCAN_UNIQUE
|
|
7696
|
+
#define SQLITE_INDEX_SCAN_UNIQUE 0x00000001 /* Scan visits at most 1 row */
|
|
7697
|
+
#define SQLITE_INDEX_SCAN_HEX 0x00000002 /* Display idxNum as hex */
|
|
7698
|
+
/* in EXPLAIN QUERY PLAN */
|
|
7557
7699
|
|
|
7558
7700
|
/*
|
|
7559
7701
|
** CAPI3REF: Virtual Table Constraint Operator Codes
|
|
@@ -8390,6 +8532,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
|
|
|
8390
8532
|
#define SQLITE_TESTCTRL_JSON_SELFCHECK 14
|
|
8391
8533
|
#define SQLITE_TESTCTRL_OPTIMIZATIONS 15
|
|
8392
8534
|
#define SQLITE_TESTCTRL_ISKEYWORD 16 /* NOT USED */
|
|
8535
|
+
#define SQLITE_TESTCTRL_GETOPT 16
|
|
8393
8536
|
#define SQLITE_TESTCTRL_SCRATCHMALLOC 17 /* NOT USED */
|
|
8394
8537
|
#define SQLITE_TESTCTRL_INTERNAL_FUNCTIONS 17
|
|
8395
8538
|
#define SQLITE_TESTCTRL_LOCALTIME_FAULT 18
|
|
@@ -8409,7 +8552,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
|
|
|
8409
8552
|
#define SQLITE_TESTCTRL_TRACEFLAGS 31
|
|
8410
8553
|
#define SQLITE_TESTCTRL_TUNE 32
|
|
8411
8554
|
#define SQLITE_TESTCTRL_LOGEST 33
|
|
8412
|
-
#define SQLITE_TESTCTRL_USELONGDOUBLE 34
|
|
8555
|
+
#define SQLITE_TESTCTRL_USELONGDOUBLE 34 /* NOT USED */
|
|
8413
8556
|
#define SQLITE_TESTCTRL_LAST 34 /* Largest TESTCTRL */
|
|
8414
8557
|
|
|
8415
8558
|
/*
|
|
@@ -9385,6 +9528,16 @@ typedef struct sqlite3_backup sqlite3_backup;
|
|
|
9385
9528
|
** APIs are not strictly speaking threadsafe. If they are invoked at the
|
|
9386
9529
|
** same time as another thread is invoking sqlite3_backup_step() it is
|
|
9387
9530
|
** possible that they return invalid values.
|
|
9531
|
+
**
|
|
9532
|
+
** <b>Alternatives To Using The Backup API</b>
|
|
9533
|
+
**
|
|
9534
|
+
** Other techniques for safely creating a consistent backup of an SQLite
|
|
9535
|
+
** database include:
|
|
9536
|
+
**
|
|
9537
|
+
** <ul>
|
|
9538
|
+
** <li> The [VACUUM INTO] command.
|
|
9539
|
+
** <li> The [sqlite3_rsync] utility program.
|
|
9540
|
+
** </ul>
|
|
9388
9541
|
*/
|
|
9389
9542
|
SQLITE_API sqlite3_backup *sqlite3_backup_init(
|
|
9390
9543
|
sqlite3 *pDest, /* Destination database handle */
|
|
@@ -10584,6 +10737,14 @@ typedef struct sqlite3_snapshot {
|
|
|
10584
10737
|
** If there is not already a read-transaction open on schema S when
|
|
10585
10738
|
** this function is called, one is opened automatically.
|
|
10586
10739
|
**
|
|
10740
|
+
** If a read-transaction is opened by this function, then it is guaranteed
|
|
10741
|
+
** that the returned snapshot object may not be invalidated by a database
|
|
10742
|
+
** writer or checkpointer until after the read-transaction is closed. This
|
|
10743
|
+
** is not guaranteed if a read-transaction is already open when this
|
|
10744
|
+
** function is called. In that case, any subsequent write or checkpoint
|
|
10745
|
+
** operation on the database may invalidate the returned snapshot handle,
|
|
10746
|
+
** even while the read-transaction remains open.
|
|
10747
|
+
**
|
|
10587
10748
|
** The following must be true for this function to succeed. If any of
|
|
10588
10749
|
** the following statements are false when sqlite3_snapshot_get() is
|
|
10589
10750
|
** called, SQLITE_ERROR is returned. The final value of *P is undefined
|
|
@@ -10741,8 +10902,9 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const c
|
|
|
10741
10902
|
/*
|
|
10742
10903
|
** CAPI3REF: Serialize a database
|
|
10743
10904
|
**
|
|
10744
|
-
** The sqlite3_serialize(D,S,P,F) interface returns a pointer to
|
|
10745
|
-
** that is a serialization of the S database on
|
|
10905
|
+
** The sqlite3_serialize(D,S,P,F) interface returns a pointer to
|
|
10906
|
+
** memory that is a serialization of the S database on
|
|
10907
|
+
** [database connection] D. If S is a NULL pointer, the main database is used.
|
|
10746
10908
|
** If P is not a NULL pointer, then the size of the database in bytes
|
|
10747
10909
|
** is written into *P.
|
|
10748
10910
|
**
|
|
@@ -10892,8 +11054,6 @@ SQLITE_API int sqlite3_deserialize(
|
|
|
10892
11054
|
#if defined(__wasi__)
|
|
10893
11055
|
# undef SQLITE_WASI
|
|
10894
11056
|
# define SQLITE_WASI 1
|
|
10895
|
-
# undef SQLITE_OMIT_WAL
|
|
10896
|
-
# define SQLITE_OMIT_WAL 1/* because it requires shared memory APIs */
|
|
10897
11057
|
# ifndef SQLITE_OMIT_LOAD_EXTENSION
|
|
10898
11058
|
# define SQLITE_OMIT_LOAD_EXTENSION
|
|
10899
11059
|
# endif
|
|
@@ -10905,7 +11065,7 @@ SQLITE_API int sqlite3_deserialize(
|
|
|
10905
11065
|
#ifdef __cplusplus
|
|
10906
11066
|
} /* End of the 'extern "C"' block */
|
|
10907
11067
|
#endif
|
|
10908
|
-
#endif
|
|
11068
|
+
/* #endif for SQLITE3_H will be added by mksqlite3.tcl */
|
|
10909
11069
|
|
|
10910
11070
|
/******** Begin file sqlite3rtree.h *********/
|
|
10911
11071
|
/*
|
|
@@ -13096,6 +13256,10 @@ struct Fts5PhraseIter {
|
|
|
13096
13256
|
** (i.e. if it is a contentless table), then this API always iterates
|
|
13097
13257
|
** through an empty set (all calls to xPhraseFirst() set iCol to -1).
|
|
13098
13258
|
**
|
|
13259
|
+
** In all cases, matches are visited in (column ASC, offset ASC) order.
|
|
13260
|
+
** i.e. all those in column 0, sorted by offset, followed by those in
|
|
13261
|
+
** column 1, etc.
|
|
13262
|
+
**
|
|
13099
13263
|
** xPhraseNext()
|
|
13100
13264
|
** See xPhraseFirst above.
|
|
13101
13265
|
**
|
|
@@ -13152,19 +13316,57 @@ struct Fts5PhraseIter {
|
|
|
13152
13316
|
** value returned by xInstCount(), SQLITE_RANGE is returned. Otherwise,
|
|
13153
13317
|
** output variable (*ppToken) is set to point to a buffer containing the
|
|
13154
13318
|
** matching document token, and (*pnToken) to the size of that buffer in
|
|
13155
|
-
** bytes.
|
|
13156
|
-
** prefix query term. In that case both output variables are always set
|
|
13157
|
-
** to 0.
|
|
13319
|
+
** bytes.
|
|
13158
13320
|
**
|
|
13159
13321
|
** The output text is not a copy of the document text that was tokenized.
|
|
13160
13322
|
** It is the output of the tokenizer module. For tokendata=1 tables, this
|
|
13161
13323
|
** includes any embedded 0x00 and trailing data.
|
|
13162
13324
|
**
|
|
13325
|
+
** This API may be slow in some cases if the token identified by parameters
|
|
13326
|
+
** iIdx and iToken matched a prefix token in the query. In most cases, the
|
|
13327
|
+
** first call to this API for each prefix token in the query is forced
|
|
13328
|
+
** to scan the portion of the full-text index that matches the prefix
|
|
13329
|
+
** token to collect the extra data required by this API. If the prefix
|
|
13330
|
+
** token matches a large number of token instances in the document set,
|
|
13331
|
+
** this may be a performance problem.
|
|
13332
|
+
**
|
|
13333
|
+
** If the user knows in advance that a query may use this API for a
|
|
13334
|
+
** prefix token, FTS5 may be configured to collect all required data as part
|
|
13335
|
+
** of the initial querying of the full-text index, avoiding the second scan
|
|
13336
|
+
** entirely. This also causes prefix queries that do not use this API to
|
|
13337
|
+
** run more slowly and use more memory. FTS5 may be configured in this way
|
|
13338
|
+
** either on a per-table basis using the [FTS5 insttoken | 'insttoken']
|
|
13339
|
+
** option, or on a per-query basis using the
|
|
13340
|
+
** [fts5_insttoken | fts5_insttoken()] user function.
|
|
13341
|
+
**
|
|
13163
13342
|
** This API can be quite slow if used with an FTS5 table created with the
|
|
13164
13343
|
** "detail=none" or "detail=column" option.
|
|
13344
|
+
**
|
|
13345
|
+
** xColumnLocale(pFts5, iIdx, pzLocale, pnLocale)
|
|
13346
|
+
** If parameter iCol is less than zero, or greater than or equal to the
|
|
13347
|
+
** number of columns in the table, SQLITE_RANGE is returned.
|
|
13348
|
+
**
|
|
13349
|
+
** Otherwise, this function attempts to retrieve the locale associated
|
|
13350
|
+
** with column iCol of the current row. Usually, there is no associated
|
|
13351
|
+
** locale, and output parameters (*pzLocale) and (*pnLocale) are set
|
|
13352
|
+
** to NULL and 0, respectively. However, if the fts5_locale() function
|
|
13353
|
+
** was used to associate a locale with the value when it was inserted
|
|
13354
|
+
** into the fts5 table, then (*pzLocale) is set to point to a nul-terminated
|
|
13355
|
+
** buffer containing the name of the locale in utf-8 encoding. (*pnLocale)
|
|
13356
|
+
** is set to the size in bytes of the buffer, not including the
|
|
13357
|
+
** nul-terminator.
|
|
13358
|
+
**
|
|
13359
|
+
** If successful, SQLITE_OK is returned. Or, if an error occurs, an
|
|
13360
|
+
** SQLite error code is returned. The final value of the output parameters
|
|
13361
|
+
** is undefined in this case.
|
|
13362
|
+
**
|
|
13363
|
+
** xTokenize_v2:
|
|
13364
|
+
** Tokenize text using the tokenizer belonging to the FTS5 table. This
|
|
13365
|
+
** API is the same as the xTokenize() API, except that it allows a tokenizer
|
|
13366
|
+
** locale to be specified.
|
|
13165
13367
|
*/
|
|
13166
13368
|
struct Fts5ExtensionApi {
|
|
13167
|
-
int iVersion; /* Currently always set to
|
|
13369
|
+
int iVersion; /* Currently always set to 4 */
|
|
13168
13370
|
|
|
13169
13371
|
void *(*xUserData)(Fts5Context*);
|
|
13170
13372
|
|
|
@@ -13206,6 +13408,15 @@ struct Fts5ExtensionApi {
|
|
|
13206
13408
|
const char **ppToken, int *pnToken
|
|
13207
13409
|
);
|
|
13208
13410
|
int (*xInstToken)(Fts5Context*, int iIdx, int iToken, const char**, int*);
|
|
13411
|
+
|
|
13412
|
+
/* Below this point are iVersion>=4 only */
|
|
13413
|
+
int (*xColumnLocale)(Fts5Context*, int iCol, const char **pz, int *pn);
|
|
13414
|
+
int (*xTokenize_v2)(Fts5Context*,
|
|
13415
|
+
const char *pText, int nText, /* Text to tokenize */
|
|
13416
|
+
const char *pLocale, int nLocale, /* Locale to pass to tokenizer */
|
|
13417
|
+
void *pCtx, /* Context passed to xToken() */
|
|
13418
|
+
int (*xToken)(void*, int, const char*, int, int, int) /* Callback */
|
|
13419
|
+
);
|
|
13209
13420
|
};
|
|
13210
13421
|
|
|
13211
13422
|
/*
|
|
@@ -13226,7 +13437,7 @@ struct Fts5ExtensionApi {
|
|
|
13226
13437
|
** A tokenizer instance is required to actually tokenize text.
|
|
13227
13438
|
**
|
|
13228
13439
|
** The first argument passed to this function is a copy of the (void*)
|
|
13229
|
-
** pointer provided by the application when the
|
|
13440
|
+
** pointer provided by the application when the fts5_tokenizer_v2 object
|
|
13230
13441
|
** was registered with FTS5 (the third argument to xCreateTokenizer()).
|
|
13231
13442
|
** The second and third arguments are an array of nul-terminated strings
|
|
13232
13443
|
** containing the tokenizer arguments, if any, specified following the
|
|
@@ -13250,7 +13461,7 @@ struct Fts5ExtensionApi {
|
|
|
13250
13461
|
** argument passed to this function is a pointer to an Fts5Tokenizer object
|
|
13251
13462
|
** returned by an earlier call to xCreate().
|
|
13252
13463
|
**
|
|
13253
|
-
** The
|
|
13464
|
+
** The third argument indicates the reason that FTS5 is requesting
|
|
13254
13465
|
** tokenization of the supplied text. This is always one of the following
|
|
13255
13466
|
** four values:
|
|
13256
13467
|
**
|
|
@@ -13274,6 +13485,13 @@ struct Fts5ExtensionApi {
|
|
|
13274
13485
|
** on a columnsize=0 database.
|
|
13275
13486
|
** </ul>
|
|
13276
13487
|
**
|
|
13488
|
+
** The sixth and seventh arguments passed to xTokenize() - pLocale and
|
|
13489
|
+
** nLocale - are a pointer to a buffer containing the locale to use for
|
|
13490
|
+
** tokenization (e.g. "en_US") and its size in bytes, respectively. The
|
|
13491
|
+
** pLocale buffer is not nul-terminated. pLocale may be passed NULL (in
|
|
13492
|
+
** which case nLocale is always 0) to indicate that the tokenizer should
|
|
13493
|
+
** use its default locale.
|
|
13494
|
+
**
|
|
13277
13495
|
** For each token in the input string, the supplied callback xToken() must
|
|
13278
13496
|
** be invoked. The first argument to it should be a copy of the pointer
|
|
13279
13497
|
** passed as the second argument to xTokenize(). The third and fourth
|
|
@@ -13297,6 +13515,30 @@ struct Fts5ExtensionApi {
|
|
|
13297
13515
|
** may abandon the tokenization and return any error code other than
|
|
13298
13516
|
** SQLITE_OK or SQLITE_DONE.
|
|
13299
13517
|
**
|
|
13518
|
+
** If the tokenizer is registered using an fts5_tokenizer_v2 object,
|
|
13519
|
+
** then the xTokenize() method has two additional arguments - pLocale
|
|
13520
|
+
** and nLocale. These specify the locale that the tokenizer should use
|
|
13521
|
+
** for the current request. If pLocale and nLocale are both 0, then the
|
|
13522
|
+
** tokenizer should use its default locale. Otherwise, pLocale points to
|
|
13523
|
+
** an nLocale byte buffer containing the name of the locale to use as utf-8
|
|
13524
|
+
** text. pLocale is not nul-terminated.
|
|
13525
|
+
**
|
|
13526
|
+
** FTS5_TOKENIZER
|
|
13527
|
+
**
|
|
13528
|
+
** There is also an fts5_tokenizer object. This is an older, deprecated,
|
|
13529
|
+
** version of fts5_tokenizer_v2. It is similar except that:
|
|
13530
|
+
**
|
|
13531
|
+
** <ul>
|
|
13532
|
+
** <li> There is no "iVersion" field, and
|
|
13533
|
+
** <li> The xTokenize() method does not take a locale argument.
|
|
13534
|
+
** </ul>
|
|
13535
|
+
**
|
|
13536
|
+
** Legacy fts5_tokenizer tokenizers must be registered using the
|
|
13537
|
+
** legacy xCreateTokenizer() function, instead of xCreateTokenizer_v2().
|
|
13538
|
+
**
|
|
13539
|
+
** Tokenizer implementations registered using either API may be retrieved
|
|
13540
|
+
** using both xFindTokenizer() and xFindTokenizer_v2().
|
|
13541
|
+
**
|
|
13300
13542
|
** SYNONYM SUPPORT
|
|
13301
13543
|
**
|
|
13302
13544
|
** Custom tokenizers may also support synonyms. Consider a case in which a
|
|
@@ -13405,6 +13647,33 @@ struct Fts5ExtensionApi {
|
|
|
13405
13647
|
** inefficient.
|
|
13406
13648
|
*/
|
|
13407
13649
|
typedef struct Fts5Tokenizer Fts5Tokenizer;
|
|
13650
|
+
typedef struct fts5_tokenizer_v2 fts5_tokenizer_v2;
|
|
13651
|
+
struct fts5_tokenizer_v2 {
|
|
13652
|
+
int iVersion; /* Currently always 2 */
|
|
13653
|
+
|
|
13654
|
+
int (*xCreate)(void*, const char **azArg, int nArg, Fts5Tokenizer **ppOut);
|
|
13655
|
+
void (*xDelete)(Fts5Tokenizer*);
|
|
13656
|
+
int (*xTokenize)(Fts5Tokenizer*,
|
|
13657
|
+
void *pCtx,
|
|
13658
|
+
int flags, /* Mask of FTS5_TOKENIZE_* flags */
|
|
13659
|
+
const char *pText, int nText,
|
|
13660
|
+
const char *pLocale, int nLocale,
|
|
13661
|
+
int (*xToken)(
|
|
13662
|
+
void *pCtx, /* Copy of 2nd argument to xTokenize() */
|
|
13663
|
+
int tflags, /* Mask of FTS5_TOKEN_* flags */
|
|
13664
|
+
const char *pToken, /* Pointer to buffer containing token */
|
|
13665
|
+
int nToken, /* Size of token in bytes */
|
|
13666
|
+
int iStart, /* Byte offset of token within input text */
|
|
13667
|
+
int iEnd /* Byte offset of end of token within input text */
|
|
13668
|
+
)
|
|
13669
|
+
);
|
|
13670
|
+
};
|
|
13671
|
+
|
|
13672
|
+
/*
|
|
13673
|
+
** New code should use the fts5_tokenizer_v2 type to define tokenizer
|
|
13674
|
+
** implementations. The following type is included for legacy applications
|
|
13675
|
+
** that still use it.
|
|
13676
|
+
*/
|
|
13408
13677
|
typedef struct fts5_tokenizer fts5_tokenizer;
|
|
13409
13678
|
struct fts5_tokenizer {
|
|
13410
13679
|
int (*xCreate)(void*, const char **azArg, int nArg, Fts5Tokenizer **ppOut);
|
|
@@ -13424,6 +13693,7 @@ struct fts5_tokenizer {
|
|
|
13424
13693
|
);
|
|
13425
13694
|
};
|
|
13426
13695
|
|
|
13696
|
+
|
|
13427
13697
|
/* Flags that may be passed as the third argument to xTokenize() */
|
|
13428
13698
|
#define FTS5_TOKENIZE_QUERY 0x0001
|
|
13429
13699
|
#define FTS5_TOKENIZE_PREFIX 0x0002
|
|
@@ -13443,7 +13713,7 @@ struct fts5_tokenizer {
|
|
|
13443
13713
|
*/
|
|
13444
13714
|
typedef struct fts5_api fts5_api;
|
|
13445
13715
|
struct fts5_api {
|
|
13446
|
-
int iVersion; /* Currently always set to
|
|
13716
|
+
int iVersion; /* Currently always set to 3 */
|
|
13447
13717
|
|
|
13448
13718
|
/* Create a new tokenizer */
|
|
13449
13719
|
int (*xCreateTokenizer)(
|
|
@@ -13470,6 +13740,25 @@ struct fts5_api {
|
|
|
13470
13740
|
fts5_extension_function xFunction,
|
|
13471
13741
|
void (*xDestroy)(void*)
|
|
13472
13742
|
);
|
|
13743
|
+
|
|
13744
|
+
/* APIs below this point are only available if iVersion>=3 */
|
|
13745
|
+
|
|
13746
|
+
/* Create a new tokenizer */
|
|
13747
|
+
int (*xCreateTokenizer_v2)(
|
|
13748
|
+
fts5_api *pApi,
|
|
13749
|
+
const char *zName,
|
|
13750
|
+
void *pUserData,
|
|
13751
|
+
fts5_tokenizer_v2 *pTokenizer,
|
|
13752
|
+
void (*xDestroy)(void*)
|
|
13753
|
+
);
|
|
13754
|
+
|
|
13755
|
+
/* Find an existing tokenizer */
|
|
13756
|
+
int (*xFindTokenizer_v2)(
|
|
13757
|
+
fts5_api *pApi,
|
|
13758
|
+
const char *zName,
|
|
13759
|
+
void **ppUserData,
|
|
13760
|
+
fts5_tokenizer_v2 **ppTokenizer
|
|
13761
|
+
);
|
|
13473
13762
|
};
|
|
13474
13763
|
|
|
13475
13764
|
/*
|
|
@@ -13483,3 +13772,4 @@ struct fts5_api {
|
|
|
13483
13772
|
#endif /* _FTS5_H */
|
|
13484
13773
|
|
|
13485
13774
|
/******** End of fts5.h *********/
|
|
13775
|
+
#endif /* SQLITE3_H */
|