@op-engineering/op-sqlite 11.2.5 → 11.2.7
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 +5 -16
- package/android/build.gradle +1 -1
- package/android/cpp-adapter.cpp +1 -1
- package/android/src/main/java/com/op/sqlite/OPSQLiteBridge.kt +1 -1
- package/android/src/main/java/com/op/sqlite/OPSQLiteModule.kt +1 -1
- package/cpp/DBHostObject.cpp +286 -371
- package/cpp/DBHostObject.h +29 -16
- package/cpp/DumbHostObject.cpp +5 -5
- package/cpp/DumbHostObject.h +8 -11
- package/cpp/PreparedStatementHostObject.cpp +54 -20
- package/cpp/PreparedStatementHostObject.h +15 -11
- package/cpp/SmartHostObject.cpp +5 -4
- package/cpp/SmartHostObject.h +4 -7
- package/cpp/ThreadPool.cpp +9 -8
- package/cpp/ThreadPool.h +4 -7
- package/cpp/bindings.cpp +14 -25
- package/cpp/bindings.h +3 -2
- package/cpp/bridge.cpp +146 -365
- package/cpp/bridge.h +30 -42
- package/cpp/libsql/bridge.cpp +65 -164
- package/cpp/libsql/bridge.h +25 -22
- package/cpp/logs.h +2 -0
- package/cpp/macros.h +8 -4
- package/cpp/sqlite3.c +5622 -2808
- package/cpp/sqlite3.h +180 -22
- package/cpp/types.h +1 -8
- package/cpp/utils.cpp +78 -67
- package/cpp/utils.h +9 -13
- package/ios/OPSQLite.mm +1 -1
- package/lib/commonjs/index.js +4 -5
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +4 -5
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +16 -13
package/cpp/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 "2024-
|
|
149
|
+
#define SQLITE_VERSION "3.47.2"
|
|
150
|
+
#define SQLITE_VERSION_NUMBER 3047002
|
|
151
|
+
#define SQLITE_SOURCE_ID "2024-12-07 20:39:59 2aabe05e2e8cae4847a802ee2daddc1d7413d8fc560254d93ee3e72c14685b6c"
|
|
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
|
|
@@ -3570,8 +3579,8 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
|
|
|
3570
3579
|
**
|
|
3571
3580
|
** [[OPEN_EXRESCODE]] ^(<dt>[SQLITE_OPEN_EXRESCODE]</dt>
|
|
3572
3581
|
** <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)]
|
|
3582
|
+
** In other words, the database behaves as if
|
|
3583
|
+
** [sqlite3_extended_result_codes(db,1)] were called on the database
|
|
3575
3584
|
** connection as soon as the connection is created. In addition to setting
|
|
3576
3585
|
** the extended result code mode, this flag also causes [sqlite3_open_v2()]
|
|
3577
3586
|
** to return an extended result code.</dd>
|
|
@@ -4222,13 +4231,17 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
|
|
|
4222
4231
|
** and sqlite3_prepare16_v3() use UTF-16.
|
|
4223
4232
|
**
|
|
4224
4233
|
** ^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.
|
|
4234
|
+
** first zero terminator. ^If nByte is positive, then it is the maximum
|
|
4235
|
+
** number of bytes read from zSql. When nByte is positive, zSql is read
|
|
4236
|
+
** up to the first zero terminator or until the nByte bytes have been read,
|
|
4237
|
+
** whichever comes first. ^If nByte is zero, then no prepared
|
|
4227
4238
|
** statement is generated.
|
|
4228
4239
|
** If the caller knows that the supplied string is nul-terminated, then
|
|
4229
4240
|
** there is a small performance advantage to passing an nByte parameter that
|
|
4230
4241
|
** is the number of bytes in the input string <i>including</i>
|
|
4231
4242
|
** the nul-terminator.
|
|
4243
|
+
** Note that nByte measure the length of the input in bytes, not
|
|
4244
|
+
** characters, even for the UTF-16 interfaces.
|
|
4232
4245
|
**
|
|
4233
4246
|
** ^If pzTail is not NULL then *pzTail is made to point to the first byte
|
|
4234
4247
|
** past the end of the first SQL statement in zSql. These routines only
|
|
@@ -5599,7 +5612,7 @@ SQLITE_API int sqlite3_create_window_function(
|
|
|
5599
5612
|
** This flag instructs SQLite to omit some corner-case optimizations that
|
|
5600
5613
|
** might disrupt the operation of the [sqlite3_value_subtype()] function,
|
|
5601
5614
|
** causing it to return zero rather than the correct subtype().
|
|
5602
|
-
** SQL functions that
|
|
5615
|
+
** All SQL functions that invoke [sqlite3_value_subtype()] should have this
|
|
5603
5616
|
** property. If the SQLITE_SUBTYPE property is omitted, then the return
|
|
5604
5617
|
** value from [sqlite3_value_subtype()] might sometimes be zero even though
|
|
5605
5618
|
** a non-zero subtype was specified by the function argument expression.
|
|
@@ -5615,6 +5628,15 @@ SQLITE_API int sqlite3_create_window_function(
|
|
|
5615
5628
|
** [sqlite3_result_subtype()] should avoid setting this property, as the
|
|
5616
5629
|
** purpose of this property is to disable certain optimizations that are
|
|
5617
5630
|
** incompatible with subtypes.
|
|
5631
|
+
**
|
|
5632
|
+
** [[SQLITE_SELFORDER1]] <dt>SQLITE_SELFORDER1</dt><dd>
|
|
5633
|
+
** The SQLITE_SELFORDER1 flag indicates that the function is an aggregate
|
|
5634
|
+
** that internally orders the values provided to the first argument. The
|
|
5635
|
+
** ordered-set aggregate SQL notation with a single ORDER BY term can be
|
|
5636
|
+
** used to invoke this function. If the ordered-set aggregate notation is
|
|
5637
|
+
** used on a function that lacks this flag, then an error is raised. Note
|
|
5638
|
+
** that the ordered-set aggregate syntax is only available if SQLite is
|
|
5639
|
+
** built using the -DSQLITE_ENABLE_ORDERED_SET_AGGREGATES compile-time option.
|
|
5618
5640
|
** </dd>
|
|
5619
5641
|
** </dl>
|
|
5620
5642
|
*/
|
|
@@ -5623,6 +5645,7 @@ SQLITE_API int sqlite3_create_window_function(
|
|
|
5623
5645
|
#define SQLITE_SUBTYPE 0x000100000
|
|
5624
5646
|
#define SQLITE_INNOCUOUS 0x000200000
|
|
5625
5647
|
#define SQLITE_RESULT_SUBTYPE 0x001000000
|
|
5648
|
+
#define SQLITE_SELFORDER1 0x002000000
|
|
5626
5649
|
|
|
5627
5650
|
/*
|
|
5628
5651
|
** CAPI3REF: Deprecated Functions
|
|
@@ -5820,7 +5843,7 @@ SQLITE_API int sqlite3_value_encoding(sqlite3_value*);
|
|
|
5820
5843
|
** one SQL function to another. Use the [sqlite3_result_subtype()]
|
|
5821
5844
|
** routine to set the subtype for the return value of an SQL function.
|
|
5822
5845
|
**
|
|
5823
|
-
** Every [application-defined SQL function] that
|
|
5846
|
+
** Every [application-defined SQL function] that invokes this interface
|
|
5824
5847
|
** should include the [SQLITE_SUBTYPE] property in the text
|
|
5825
5848
|
** encoding argument when the function is [sqlite3_create_function|registered].
|
|
5826
5849
|
** If the [SQLITE_SUBTYPE] property is omitted, then sqlite3_value_subtype()
|
|
@@ -7427,9 +7450,11 @@ struct sqlite3_module {
|
|
|
7427
7450
|
** will be returned by the strategy.
|
|
7428
7451
|
**
|
|
7429
7452
|
** The xBestIndex method may optionally populate the idxFlags field with a
|
|
7430
|
-
** mask of SQLITE_INDEX_SCAN_* flags.
|
|
7431
|
-
**
|
|
7432
|
-
**
|
|
7453
|
+
** mask of SQLITE_INDEX_SCAN_* flags. One such flag is
|
|
7454
|
+
** [SQLITE_INDEX_SCAN_HEX], which if set causes the [EXPLAIN QUERY PLAN]
|
|
7455
|
+
** output to show the idxNum has hex instead of as decimal. Another flag is
|
|
7456
|
+
** SQLITE_INDEX_SCAN_UNIQUE, which if set indicates that the query plan will
|
|
7457
|
+
** return at most one row.
|
|
7433
7458
|
**
|
|
7434
7459
|
** Additionally, if xBestIndex sets the SQLITE_INDEX_SCAN_UNIQUE flag, then
|
|
7435
7460
|
** SQLite also assumes that if a call to the xUpdate() method is made as
|
|
@@ -7493,7 +7518,9 @@ struct sqlite3_index_info {
|
|
|
7493
7518
|
** [sqlite3_index_info].idxFlags field to some combination of
|
|
7494
7519
|
** these bits.
|
|
7495
7520
|
*/
|
|
7496
|
-
#define SQLITE_INDEX_SCAN_UNIQUE
|
|
7521
|
+
#define SQLITE_INDEX_SCAN_UNIQUE 0x00000001 /* Scan visits at most 1 row */
|
|
7522
|
+
#define SQLITE_INDEX_SCAN_HEX 0x00000002 /* Display idxNum as hex */
|
|
7523
|
+
/* in EXPLAIN QUERY PLAN */
|
|
7497
7524
|
|
|
7498
7525
|
/*
|
|
7499
7526
|
** CAPI3REF: Virtual Table Constraint Operator Codes
|
|
@@ -8330,6 +8357,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
|
|
|
8330
8357
|
#define SQLITE_TESTCTRL_JSON_SELFCHECK 14
|
|
8331
8358
|
#define SQLITE_TESTCTRL_OPTIMIZATIONS 15
|
|
8332
8359
|
#define SQLITE_TESTCTRL_ISKEYWORD 16 /* NOT USED */
|
|
8360
|
+
#define SQLITE_TESTCTRL_GETOPT 16
|
|
8333
8361
|
#define SQLITE_TESTCTRL_SCRATCHMALLOC 17 /* NOT USED */
|
|
8334
8362
|
#define SQLITE_TESTCTRL_INTERNAL_FUNCTIONS 17
|
|
8335
8363
|
#define SQLITE_TESTCTRL_LOCALTIME_FAULT 18
|
|
@@ -8349,7 +8377,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
|
|
|
8349
8377
|
#define SQLITE_TESTCTRL_TRACEFLAGS 31
|
|
8350
8378
|
#define SQLITE_TESTCTRL_TUNE 32
|
|
8351
8379
|
#define SQLITE_TESTCTRL_LOGEST 33
|
|
8352
|
-
#define SQLITE_TESTCTRL_USELONGDOUBLE 34
|
|
8380
|
+
#define SQLITE_TESTCTRL_USELONGDOUBLE 34 /* NOT USED */
|
|
8353
8381
|
#define SQLITE_TESTCTRL_LAST 34 /* Largest TESTCTRL */
|
|
8354
8382
|
|
|
8355
8383
|
/*
|
|
@@ -9325,6 +9353,16 @@ typedef struct sqlite3_backup sqlite3_backup;
|
|
|
9325
9353
|
** APIs are not strictly speaking threadsafe. If they are invoked at the
|
|
9326
9354
|
** same time as another thread is invoking sqlite3_backup_step() it is
|
|
9327
9355
|
** possible that they return invalid values.
|
|
9356
|
+
**
|
|
9357
|
+
** <b>Alternatives To Using The Backup API</b>
|
|
9358
|
+
**
|
|
9359
|
+
** Other techniques for safely creating a consistent backup of an SQLite
|
|
9360
|
+
** database include:
|
|
9361
|
+
**
|
|
9362
|
+
** <ul>
|
|
9363
|
+
** <li> The [VACUUM INTO] command.
|
|
9364
|
+
** <li> The [sqlite3_rsync] utility program.
|
|
9365
|
+
** </ul>
|
|
9328
9366
|
*/
|
|
9329
9367
|
SQLITE_API sqlite3_backup *sqlite3_backup_init(
|
|
9330
9368
|
sqlite3 *pDest, /* Destination database handle */
|
|
@@ -10524,6 +10562,14 @@ typedef struct sqlite3_snapshot {
|
|
|
10524
10562
|
** If there is not already a read-transaction open on schema S when
|
|
10525
10563
|
** this function is called, one is opened automatically.
|
|
10526
10564
|
**
|
|
10565
|
+
** If a read-transaction is opened by this function, then it is guaranteed
|
|
10566
|
+
** that the returned snapshot object may not be invalidated by a database
|
|
10567
|
+
** writer or checkpointer until after the read-transaction is closed. This
|
|
10568
|
+
** is not guaranteed if a read-transaction is already open when this
|
|
10569
|
+
** function is called. In that case, any subsequent write or checkpoint
|
|
10570
|
+
** operation on the database may invalidate the returned snapshot handle,
|
|
10571
|
+
** even while the read-transaction remains open.
|
|
10572
|
+
**
|
|
10527
10573
|
** The following must be true for this function to succeed. If any of
|
|
10528
10574
|
** the following statements are false when sqlite3_snapshot_get() is
|
|
10529
10575
|
** called, SQLITE_ERROR is returned. The final value of *P is undefined
|
|
@@ -10832,8 +10878,6 @@ SQLITE_API int sqlite3_deserialize(
|
|
|
10832
10878
|
#if defined(__wasi__)
|
|
10833
10879
|
# undef SQLITE_WASI
|
|
10834
10880
|
# define SQLITE_WASI 1
|
|
10835
|
-
# undef SQLITE_OMIT_WAL
|
|
10836
|
-
# define SQLITE_OMIT_WAL 1/* because it requires shared memory APIs */
|
|
10837
10881
|
# ifndef SQLITE_OMIT_LOAD_EXTENSION
|
|
10838
10882
|
# define SQLITE_OMIT_LOAD_EXTENSION
|
|
10839
10883
|
# endif
|
|
@@ -13036,6 +13080,10 @@ struct Fts5PhraseIter {
|
|
|
13036
13080
|
** (i.e. if it is a contentless table), then this API always iterates
|
|
13037
13081
|
** through an empty set (all calls to xPhraseFirst() set iCol to -1).
|
|
13038
13082
|
**
|
|
13083
|
+
** In all cases, matches are visited in (column ASC, offset ASC) order.
|
|
13084
|
+
** i.e. all those in column 0, sorted by offset, followed by those in
|
|
13085
|
+
** column 1, etc.
|
|
13086
|
+
**
|
|
13039
13087
|
** xPhraseNext()
|
|
13040
13088
|
** See xPhraseFirst above.
|
|
13041
13089
|
**
|
|
@@ -13102,9 +13150,32 @@ struct Fts5PhraseIter {
|
|
|
13102
13150
|
**
|
|
13103
13151
|
** This API can be quite slow if used with an FTS5 table created with the
|
|
13104
13152
|
** "detail=none" or "detail=column" option.
|
|
13153
|
+
**
|
|
13154
|
+
** xColumnLocale(pFts5, iIdx, pzLocale, pnLocale)
|
|
13155
|
+
** If parameter iCol is less than zero, or greater than or equal to the
|
|
13156
|
+
** number of columns in the table, SQLITE_RANGE is returned.
|
|
13157
|
+
**
|
|
13158
|
+
** Otherwise, this function attempts to retrieve the locale associated
|
|
13159
|
+
** with column iCol of the current row. Usually, there is no associated
|
|
13160
|
+
** locale, and output parameters (*pzLocale) and (*pnLocale) are set
|
|
13161
|
+
** to NULL and 0, respectively. However, if the fts5_locale() function
|
|
13162
|
+
** was used to associate a locale with the value when it was inserted
|
|
13163
|
+
** into the fts5 table, then (*pzLocale) is set to point to a nul-terminated
|
|
13164
|
+
** buffer containing the name of the locale in utf-8 encoding. (*pnLocale)
|
|
13165
|
+
** is set to the size in bytes of the buffer, not including the
|
|
13166
|
+
** nul-terminator.
|
|
13167
|
+
**
|
|
13168
|
+
** If successful, SQLITE_OK is returned. Or, if an error occurs, an
|
|
13169
|
+
** SQLite error code is returned. The final value of the output parameters
|
|
13170
|
+
** is undefined in this case.
|
|
13171
|
+
**
|
|
13172
|
+
** xTokenize_v2:
|
|
13173
|
+
** Tokenize text using the tokenizer belonging to the FTS5 table. This
|
|
13174
|
+
** API is the same as the xTokenize() API, except that it allows a tokenizer
|
|
13175
|
+
** locale to be specified.
|
|
13105
13176
|
*/
|
|
13106
13177
|
struct Fts5ExtensionApi {
|
|
13107
|
-
int iVersion; /* Currently always set to
|
|
13178
|
+
int iVersion; /* Currently always set to 4 */
|
|
13108
13179
|
|
|
13109
13180
|
void *(*xUserData)(Fts5Context*);
|
|
13110
13181
|
|
|
@@ -13146,6 +13217,15 @@ struct Fts5ExtensionApi {
|
|
|
13146
13217
|
const char **ppToken, int *pnToken
|
|
13147
13218
|
);
|
|
13148
13219
|
int (*xInstToken)(Fts5Context*, int iIdx, int iToken, const char**, int*);
|
|
13220
|
+
|
|
13221
|
+
/* Below this point are iVersion>=4 only */
|
|
13222
|
+
int (*xColumnLocale)(Fts5Context*, int iCol, const char **pz, int *pn);
|
|
13223
|
+
int (*xTokenize_v2)(Fts5Context*,
|
|
13224
|
+
const char *pText, int nText, /* Text to tokenize */
|
|
13225
|
+
const char *pLocale, int nLocale, /* Locale to pass to tokenizer */
|
|
13226
|
+
void *pCtx, /* Context passed to xToken() */
|
|
13227
|
+
int (*xToken)(void*, int, const char*, int, int, int) /* Callback */
|
|
13228
|
+
);
|
|
13149
13229
|
};
|
|
13150
13230
|
|
|
13151
13231
|
/*
|
|
@@ -13166,7 +13246,7 @@ struct Fts5ExtensionApi {
|
|
|
13166
13246
|
** A tokenizer instance is required to actually tokenize text.
|
|
13167
13247
|
**
|
|
13168
13248
|
** The first argument passed to this function is a copy of the (void*)
|
|
13169
|
-
** pointer provided by the application when the
|
|
13249
|
+
** pointer provided by the application when the fts5_tokenizer_v2 object
|
|
13170
13250
|
** was registered with FTS5 (the third argument to xCreateTokenizer()).
|
|
13171
13251
|
** The second and third arguments are an array of nul-terminated strings
|
|
13172
13252
|
** containing the tokenizer arguments, if any, specified following the
|
|
@@ -13190,7 +13270,7 @@ struct Fts5ExtensionApi {
|
|
|
13190
13270
|
** argument passed to this function is a pointer to an Fts5Tokenizer object
|
|
13191
13271
|
** returned by an earlier call to xCreate().
|
|
13192
13272
|
**
|
|
13193
|
-
** The
|
|
13273
|
+
** The third argument indicates the reason that FTS5 is requesting
|
|
13194
13274
|
** tokenization of the supplied text. This is always one of the following
|
|
13195
13275
|
** four values:
|
|
13196
13276
|
**
|
|
@@ -13214,6 +13294,13 @@ struct Fts5ExtensionApi {
|
|
|
13214
13294
|
** on a columnsize=0 database.
|
|
13215
13295
|
** </ul>
|
|
13216
13296
|
**
|
|
13297
|
+
** The sixth and seventh arguments passed to xTokenize() - pLocale and
|
|
13298
|
+
** nLocale - are a pointer to a buffer containing the locale to use for
|
|
13299
|
+
** tokenization (e.g. "en_US") and its size in bytes, respectively. The
|
|
13300
|
+
** pLocale buffer is not nul-terminated. pLocale may be passed NULL (in
|
|
13301
|
+
** which case nLocale is always 0) to indicate that the tokenizer should
|
|
13302
|
+
** use its default locale.
|
|
13303
|
+
**
|
|
13217
13304
|
** For each token in the input string, the supplied callback xToken() must
|
|
13218
13305
|
** be invoked. The first argument to it should be a copy of the pointer
|
|
13219
13306
|
** passed as the second argument to xTokenize(). The third and fourth
|
|
@@ -13237,6 +13324,30 @@ struct Fts5ExtensionApi {
|
|
|
13237
13324
|
** may abandon the tokenization and return any error code other than
|
|
13238
13325
|
** SQLITE_OK or SQLITE_DONE.
|
|
13239
13326
|
**
|
|
13327
|
+
** If the tokenizer is registered using an fts5_tokenizer_v2 object,
|
|
13328
|
+
** then the xTokenize() method has two additional arguments - pLocale
|
|
13329
|
+
** and nLocale. These specify the locale that the tokenizer should use
|
|
13330
|
+
** for the current request. If pLocale and nLocale are both 0, then the
|
|
13331
|
+
** tokenizer should use its default locale. Otherwise, pLocale points to
|
|
13332
|
+
** an nLocale byte buffer containing the name of the locale to use as utf-8
|
|
13333
|
+
** text. pLocale is not nul-terminated.
|
|
13334
|
+
**
|
|
13335
|
+
** FTS5_TOKENIZER
|
|
13336
|
+
**
|
|
13337
|
+
** There is also an fts5_tokenizer object. This is an older, deprecated,
|
|
13338
|
+
** version of fts5_tokenizer_v2. It is similar except that:
|
|
13339
|
+
**
|
|
13340
|
+
** <ul>
|
|
13341
|
+
** <li> There is no "iVersion" field, and
|
|
13342
|
+
** <li> The xTokenize() method does not take a locale argument.
|
|
13343
|
+
** </ul>
|
|
13344
|
+
**
|
|
13345
|
+
** Legacy fts5_tokenizer tokenizers must be registered using the
|
|
13346
|
+
** legacy xCreateTokenizer() function, instead of xCreateTokenizer_v2().
|
|
13347
|
+
**
|
|
13348
|
+
** Tokenizer implementations registered using either API may be retrieved
|
|
13349
|
+
** using both xFindTokenizer() and xFindTokenizer_v2().
|
|
13350
|
+
**
|
|
13240
13351
|
** SYNONYM SUPPORT
|
|
13241
13352
|
**
|
|
13242
13353
|
** Custom tokenizers may also support synonyms. Consider a case in which a
|
|
@@ -13345,6 +13456,33 @@ struct Fts5ExtensionApi {
|
|
|
13345
13456
|
** inefficient.
|
|
13346
13457
|
*/
|
|
13347
13458
|
typedef struct Fts5Tokenizer Fts5Tokenizer;
|
|
13459
|
+
typedef struct fts5_tokenizer_v2 fts5_tokenizer_v2;
|
|
13460
|
+
struct fts5_tokenizer_v2 {
|
|
13461
|
+
int iVersion; /* Currently always 2 */
|
|
13462
|
+
|
|
13463
|
+
int (*xCreate)(void*, const char **azArg, int nArg, Fts5Tokenizer **ppOut);
|
|
13464
|
+
void (*xDelete)(Fts5Tokenizer*);
|
|
13465
|
+
int (*xTokenize)(Fts5Tokenizer*,
|
|
13466
|
+
void *pCtx,
|
|
13467
|
+
int flags, /* Mask of FTS5_TOKENIZE_* flags */
|
|
13468
|
+
const char *pText, int nText,
|
|
13469
|
+
const char *pLocale, int nLocale,
|
|
13470
|
+
int (*xToken)(
|
|
13471
|
+
void *pCtx, /* Copy of 2nd argument to xTokenize() */
|
|
13472
|
+
int tflags, /* Mask of FTS5_TOKEN_* flags */
|
|
13473
|
+
const char *pToken, /* Pointer to buffer containing token */
|
|
13474
|
+
int nToken, /* Size of token in bytes */
|
|
13475
|
+
int iStart, /* Byte offset of token within input text */
|
|
13476
|
+
int iEnd /* Byte offset of end of token within input text */
|
|
13477
|
+
)
|
|
13478
|
+
);
|
|
13479
|
+
};
|
|
13480
|
+
|
|
13481
|
+
/*
|
|
13482
|
+
** New code should use the fts5_tokenizer_v2 type to define tokenizer
|
|
13483
|
+
** implementations. The following type is included for legacy applications
|
|
13484
|
+
** that still use it.
|
|
13485
|
+
*/
|
|
13348
13486
|
typedef struct fts5_tokenizer fts5_tokenizer;
|
|
13349
13487
|
struct fts5_tokenizer {
|
|
13350
13488
|
int (*xCreate)(void*, const char **azArg, int nArg, Fts5Tokenizer **ppOut);
|
|
@@ -13364,6 +13502,7 @@ struct fts5_tokenizer {
|
|
|
13364
13502
|
);
|
|
13365
13503
|
};
|
|
13366
13504
|
|
|
13505
|
+
|
|
13367
13506
|
/* Flags that may be passed as the third argument to xTokenize() */
|
|
13368
13507
|
#define FTS5_TOKENIZE_QUERY 0x0001
|
|
13369
13508
|
#define FTS5_TOKENIZE_PREFIX 0x0002
|
|
@@ -13383,7 +13522,7 @@ struct fts5_tokenizer {
|
|
|
13383
13522
|
*/
|
|
13384
13523
|
typedef struct fts5_api fts5_api;
|
|
13385
13524
|
struct fts5_api {
|
|
13386
|
-
int iVersion; /* Currently always set to
|
|
13525
|
+
int iVersion; /* Currently always set to 3 */
|
|
13387
13526
|
|
|
13388
13527
|
/* Create a new tokenizer */
|
|
13389
13528
|
int (*xCreateTokenizer)(
|
|
@@ -13410,6 +13549,25 @@ struct fts5_api {
|
|
|
13410
13549
|
fts5_extension_function xFunction,
|
|
13411
13550
|
void (*xDestroy)(void*)
|
|
13412
13551
|
);
|
|
13552
|
+
|
|
13553
|
+
/* APIs below this point are only available if iVersion>=3 */
|
|
13554
|
+
|
|
13555
|
+
/* Create a new tokenizer */
|
|
13556
|
+
int (*xCreateTokenizer_v2)(
|
|
13557
|
+
fts5_api *pApi,
|
|
13558
|
+
const char *zName,
|
|
13559
|
+
void *pUserData,
|
|
13560
|
+
fts5_tokenizer_v2 *pTokenizer,
|
|
13561
|
+
void (*xDestroy)(void*)
|
|
13562
|
+
);
|
|
13563
|
+
|
|
13564
|
+
/* Find an existing tokenizer */
|
|
13565
|
+
int (*xFindTokenizer_v2)(
|
|
13566
|
+
fts5_api *pApi,
|
|
13567
|
+
const char *zName,
|
|
13568
|
+
void **ppUserData,
|
|
13569
|
+
fts5_tokenizer_v2 **ppTokenizer
|
|
13570
|
+
);
|
|
13413
13571
|
};
|
|
13414
13572
|
|
|
13415
13573
|
/*
|
package/cpp/types.h
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
#
|
|
2
|
-
#define types_h
|
|
1
|
+
#pragma once
|
|
3
2
|
|
|
4
3
|
#include <memory>
|
|
5
4
|
#include <string>
|
|
@@ -14,10 +13,7 @@ struct ArrayBuffer {
|
|
|
14
13
|
using JSVariant = std::variant<nullptr_t, bool, int, double, long, long long,
|
|
15
14
|
std::string, ArrayBuffer>;
|
|
16
15
|
|
|
17
|
-
enum ResultType { SQLiteOk, SQLiteError };
|
|
18
|
-
|
|
19
16
|
struct BridgeResult {
|
|
20
|
-
ResultType type;
|
|
21
17
|
std::string message;
|
|
22
18
|
int affectedRows;
|
|
23
19
|
double insertId;
|
|
@@ -26,7 +22,6 @@ struct BridgeResult {
|
|
|
26
22
|
};
|
|
27
23
|
|
|
28
24
|
struct BatchResult {
|
|
29
|
-
ResultType type;
|
|
30
25
|
std::string message;
|
|
31
26
|
int affectedRows;
|
|
32
27
|
int commands;
|
|
@@ -36,5 +31,3 @@ struct BatchArguments {
|
|
|
36
31
|
std::string sql;
|
|
37
32
|
std::shared_ptr<std::vector<JSVariant>> params;
|
|
38
33
|
};
|
|
39
|
-
|
|
40
|
-
#endif /* types_h */
|