better-sqlite3-multiple-ciphers 11.3.0 → 11.7.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/README.md +4 -4
- package/deps/setup.ps1 +1 -1
- package/deps/sqlite3/sqlite3.c +6511 -3044
- package/deps/sqlite3/sqlite3.h +187 -29
- package/package.json +1 -1
- package/src/better_sqlite3.cpp +25 -4
- package/src/better_sqlite3.hpp +22 -22
package/deps/sqlite3/sqlite3.h
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
** Purpose: Header file for SQLite3 Multiple Ciphers support
|
|
4
4
|
** Author: Ulrich Telle
|
|
5
5
|
** Created: 2020-03-01
|
|
6
|
-
** Copyright: (c) 2019-
|
|
6
|
+
** Copyright: (c) 2019-2024 Ulrich Telle
|
|
7
7
|
** License: MIT
|
|
8
8
|
*/
|
|
9
9
|
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
#define SQLITE3MC_VERSION_H_
|
|
31
31
|
|
|
32
32
|
#define SQLITE3MC_VERSION_MAJOR 1
|
|
33
|
-
#define SQLITE3MC_VERSION_MINOR
|
|
34
|
-
#define SQLITE3MC_VERSION_RELEASE
|
|
33
|
+
#define SQLITE3MC_VERSION_MINOR 9
|
|
34
|
+
#define SQLITE3MC_VERSION_RELEASE 2
|
|
35
35
|
#define SQLITE3MC_VERSION_SUBRELEASE 0
|
|
36
|
-
#define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 1.
|
|
36
|
+
#define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 1.9.2"
|
|
37
37
|
|
|
38
38
|
#endif /* SQLITE3MC_VERSION_H_ */
|
|
39
39
|
/*** End of #include "sqlite3mc_version.h" ***/
|
|
@@ -192,9 +192,9 @@ extern "C" {
|
|
|
192
192
|
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
|
193
193
|
** [sqlite_version()] and [sqlite_source_id()].
|
|
194
194
|
*/
|
|
195
|
-
#define SQLITE_VERSION "3.
|
|
196
|
-
#define SQLITE_VERSION_NUMBER
|
|
197
|
-
#define SQLITE_SOURCE_ID "2024-
|
|
195
|
+
#define SQLITE_VERSION "3.47.2"
|
|
196
|
+
#define SQLITE_VERSION_NUMBER 3047002
|
|
197
|
+
#define SQLITE_SOURCE_ID "2024-12-07 20:39:59 2aabe05e2e8cae4847a802ee2daddc1d7413d8fc560254d93ee3e72c14685b6c"
|
|
198
198
|
|
|
199
199
|
/*
|
|
200
200
|
** CAPI3REF: Run-Time Library Version Numbers
|
|
@@ -698,6 +698,13 @@ SQLITE_API int sqlite3_exec(
|
|
|
698
698
|
** filesystem supports doing multiple write operations atomically when those
|
|
699
699
|
** write operations are bracketed by [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] and
|
|
700
700
|
** [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE].
|
|
701
|
+
**
|
|
702
|
+
** The SQLITE_IOCAP_SUBPAGE_READ property means that it is ok to read
|
|
703
|
+
** from the database file in amounts that are not a multiple of the
|
|
704
|
+
** page size and that do not begin at a page boundary. Without this
|
|
705
|
+
** property, SQLite is careful to only do full-page reads and write
|
|
706
|
+
** on aligned pages, with the one exception that it will do a sub-page
|
|
707
|
+
** read of the first page to access the database header.
|
|
701
708
|
*/
|
|
702
709
|
#define SQLITE_IOCAP_ATOMIC 0x00000001
|
|
703
710
|
#define SQLITE_IOCAP_ATOMIC512 0x00000002
|
|
@@ -714,6 +721,7 @@ SQLITE_API int sqlite3_exec(
|
|
|
714
721
|
#define SQLITE_IOCAP_POWERSAFE_OVERWRITE 0x00001000
|
|
715
722
|
#define SQLITE_IOCAP_IMMUTABLE 0x00002000
|
|
716
723
|
#define SQLITE_IOCAP_BATCH_ATOMIC 0x00004000
|
|
724
|
+
#define SQLITE_IOCAP_SUBPAGE_READ 0x00008000
|
|
717
725
|
|
|
718
726
|
/*
|
|
719
727
|
** CAPI3REF: File Locking Levels
|
|
@@ -818,8 +826,8 @@ struct sqlite3_file {
|
|
|
818
826
|
** to xUnlock() is a no-op.
|
|
819
827
|
** The xCheckReservedLock() method checks whether any database connection,
|
|
820
828
|
** either in this process or in some other process, is holding a RESERVED,
|
|
821
|
-
** PENDING, or EXCLUSIVE lock on the file. It returns
|
|
822
|
-
** if such a lock exists and false otherwise.
|
|
829
|
+
** PENDING, or EXCLUSIVE lock on the file. It returns, via its output
|
|
830
|
+
** pointer parameter, true if such a lock exists and false otherwise.
|
|
823
831
|
**
|
|
824
832
|
** The xFileControl() method is a generic interface that allows custom
|
|
825
833
|
** VFS implementations to directly control an open file using the
|
|
@@ -860,6 +868,7 @@ struct sqlite3_file {
|
|
|
860
868
|
** <li> [SQLITE_IOCAP_POWERSAFE_OVERWRITE]
|
|
861
869
|
** <li> [SQLITE_IOCAP_IMMUTABLE]
|
|
862
870
|
** <li> [SQLITE_IOCAP_BATCH_ATOMIC]
|
|
871
|
+
** <li> [SQLITE_IOCAP_SUBPAGE_READ]
|
|
863
872
|
** </ul>
|
|
864
873
|
**
|
|
865
874
|
** The SQLITE_IOCAP_ATOMIC property means that all writes of
|
|
@@ -3616,8 +3625,8 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
|
|
|
3616
3625
|
**
|
|
3617
3626
|
** [[OPEN_EXRESCODE]] ^(<dt>[SQLITE_OPEN_EXRESCODE]</dt>
|
|
3618
3627
|
** <dd>The database connection comes up in "extended result code mode".
|
|
3619
|
-
** In other words, the database behaves
|
|
3620
|
-
** [sqlite3_extended_result_codes(db,1)]
|
|
3628
|
+
** In other words, the database behaves as if
|
|
3629
|
+
** [sqlite3_extended_result_codes(db,1)] were called on the database
|
|
3621
3630
|
** connection as soon as the connection is created. In addition to setting
|
|
3622
3631
|
** the extended result code mode, this flag also causes [sqlite3_open_v2()]
|
|
3623
3632
|
** to return an extended result code.</dd>
|
|
@@ -4268,13 +4277,17 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
|
|
|
4268
4277
|
** and sqlite3_prepare16_v3() use UTF-16.
|
|
4269
4278
|
**
|
|
4270
4279
|
** ^If the nByte argument is negative, then zSql is read up to the
|
|
4271
|
-
** first zero terminator. ^If nByte is positive, then it is the
|
|
4272
|
-
** number of bytes read from zSql.
|
|
4280
|
+
** first zero terminator. ^If nByte is positive, then it is the maximum
|
|
4281
|
+
** number of bytes read from zSql. When nByte is positive, zSql is read
|
|
4282
|
+
** up to the first zero terminator or until the nByte bytes have been read,
|
|
4283
|
+
** whichever comes first. ^If nByte is zero, then no prepared
|
|
4273
4284
|
** statement is generated.
|
|
4274
4285
|
** If the caller knows that the supplied string is nul-terminated, then
|
|
4275
4286
|
** there is a small performance advantage to passing an nByte parameter that
|
|
4276
4287
|
** is the number of bytes in the input string <i>including</i>
|
|
4277
4288
|
** the nul-terminator.
|
|
4289
|
+
** Note that nByte measure the length of the input in bytes, not
|
|
4290
|
+
** characters, even for the UTF-16 interfaces.
|
|
4278
4291
|
**
|
|
4279
4292
|
** ^If pzTail is not NULL then *pzTail is made to point to the first byte
|
|
4280
4293
|
** past the end of the first SQL statement in zSql. These routines only
|
|
@@ -5645,7 +5658,7 @@ SQLITE_API int sqlite3_create_window_function(
|
|
|
5645
5658
|
** This flag instructs SQLite to omit some corner-case optimizations that
|
|
5646
5659
|
** might disrupt the operation of the [sqlite3_value_subtype()] function,
|
|
5647
5660
|
** causing it to return zero rather than the correct subtype().
|
|
5648
|
-
** SQL functions that
|
|
5661
|
+
** All SQL functions that invoke [sqlite3_value_subtype()] should have this
|
|
5649
5662
|
** property. If the SQLITE_SUBTYPE property is omitted, then the return
|
|
5650
5663
|
** value from [sqlite3_value_subtype()] might sometimes be zero even though
|
|
5651
5664
|
** a non-zero subtype was specified by the function argument expression.
|
|
@@ -5661,6 +5674,15 @@ SQLITE_API int sqlite3_create_window_function(
|
|
|
5661
5674
|
** [sqlite3_result_subtype()] should avoid setting this property, as the
|
|
5662
5675
|
** purpose of this property is to disable certain optimizations that are
|
|
5663
5676
|
** incompatible with subtypes.
|
|
5677
|
+
**
|
|
5678
|
+
** [[SQLITE_SELFORDER1]] <dt>SQLITE_SELFORDER1</dt><dd>
|
|
5679
|
+
** The SQLITE_SELFORDER1 flag indicates that the function is an aggregate
|
|
5680
|
+
** that internally orders the values provided to the first argument. The
|
|
5681
|
+
** ordered-set aggregate SQL notation with a single ORDER BY term can be
|
|
5682
|
+
** used to invoke this function. If the ordered-set aggregate notation is
|
|
5683
|
+
** used on a function that lacks this flag, then an error is raised. Note
|
|
5684
|
+
** that the ordered-set aggregate syntax is only available if SQLite is
|
|
5685
|
+
** built using the -DSQLITE_ENABLE_ORDERED_SET_AGGREGATES compile-time option.
|
|
5664
5686
|
** </dd>
|
|
5665
5687
|
** </dl>
|
|
5666
5688
|
*/
|
|
@@ -5669,6 +5691,7 @@ SQLITE_API int sqlite3_create_window_function(
|
|
|
5669
5691
|
#define SQLITE_SUBTYPE 0x000100000
|
|
5670
5692
|
#define SQLITE_INNOCUOUS 0x000200000
|
|
5671
5693
|
#define SQLITE_RESULT_SUBTYPE 0x001000000
|
|
5694
|
+
#define SQLITE_SELFORDER1 0x002000000
|
|
5672
5695
|
|
|
5673
5696
|
/*
|
|
5674
5697
|
** CAPI3REF: Deprecated Functions
|
|
@@ -5866,7 +5889,7 @@ SQLITE_API int sqlite3_value_encoding(sqlite3_value*);
|
|
|
5866
5889
|
** one SQL function to another. Use the [sqlite3_result_subtype()]
|
|
5867
5890
|
** routine to set the subtype for the return value of an SQL function.
|
|
5868
5891
|
**
|
|
5869
|
-
** Every [application-defined SQL function] that
|
|
5892
|
+
** Every [application-defined SQL function] that invokes this interface
|
|
5870
5893
|
** should include the [SQLITE_SUBTYPE] property in the text
|
|
5871
5894
|
** encoding argument when the function is [sqlite3_create_function|registered].
|
|
5872
5895
|
** If the [SQLITE_SUBTYPE] property is omitted, then sqlite3_value_subtype()
|
|
@@ -7473,9 +7496,11 @@ struct sqlite3_module {
|
|
|
7473
7496
|
** will be returned by the strategy.
|
|
7474
7497
|
**
|
|
7475
7498
|
** The xBestIndex method may optionally populate the idxFlags field with a
|
|
7476
|
-
** mask of SQLITE_INDEX_SCAN_* flags.
|
|
7477
|
-
**
|
|
7478
|
-
**
|
|
7499
|
+
** mask of SQLITE_INDEX_SCAN_* flags. One such flag is
|
|
7500
|
+
** [SQLITE_INDEX_SCAN_HEX], which if set causes the [EXPLAIN QUERY PLAN]
|
|
7501
|
+
** output to show the idxNum has hex instead of as decimal. Another flag is
|
|
7502
|
+
** SQLITE_INDEX_SCAN_UNIQUE, which if set indicates that the query plan will
|
|
7503
|
+
** return at most one row.
|
|
7479
7504
|
**
|
|
7480
7505
|
** Additionally, if xBestIndex sets the SQLITE_INDEX_SCAN_UNIQUE flag, then
|
|
7481
7506
|
** SQLite also assumes that if a call to the xUpdate() method is made as
|
|
@@ -7539,7 +7564,9 @@ struct sqlite3_index_info {
|
|
|
7539
7564
|
** [sqlite3_index_info].idxFlags field to some combination of
|
|
7540
7565
|
** these bits.
|
|
7541
7566
|
*/
|
|
7542
|
-
#define SQLITE_INDEX_SCAN_UNIQUE
|
|
7567
|
+
#define SQLITE_INDEX_SCAN_UNIQUE 0x00000001 /* Scan visits at most 1 row */
|
|
7568
|
+
#define SQLITE_INDEX_SCAN_HEX 0x00000002 /* Display idxNum as hex */
|
|
7569
|
+
/* in EXPLAIN QUERY PLAN */
|
|
7543
7570
|
|
|
7544
7571
|
/*
|
|
7545
7572
|
** CAPI3REF: Virtual Table Constraint Operator Codes
|
|
@@ -8376,6 +8403,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
|
|
|
8376
8403
|
#define SQLITE_TESTCTRL_JSON_SELFCHECK 14
|
|
8377
8404
|
#define SQLITE_TESTCTRL_OPTIMIZATIONS 15
|
|
8378
8405
|
#define SQLITE_TESTCTRL_ISKEYWORD 16 /* NOT USED */
|
|
8406
|
+
#define SQLITE_TESTCTRL_GETOPT 16
|
|
8379
8407
|
#define SQLITE_TESTCTRL_SCRATCHMALLOC 17 /* NOT USED */
|
|
8380
8408
|
#define SQLITE_TESTCTRL_INTERNAL_FUNCTIONS 17
|
|
8381
8409
|
#define SQLITE_TESTCTRL_LOCALTIME_FAULT 18
|
|
@@ -8395,7 +8423,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
|
|
|
8395
8423
|
#define SQLITE_TESTCTRL_TRACEFLAGS 31
|
|
8396
8424
|
#define SQLITE_TESTCTRL_TUNE 32
|
|
8397
8425
|
#define SQLITE_TESTCTRL_LOGEST 33
|
|
8398
|
-
#define SQLITE_TESTCTRL_USELONGDOUBLE 34
|
|
8426
|
+
#define SQLITE_TESTCTRL_USELONGDOUBLE 34 /* NOT USED */
|
|
8399
8427
|
#define SQLITE_TESTCTRL_LAST 34 /* Largest TESTCTRL */
|
|
8400
8428
|
|
|
8401
8429
|
/*
|
|
@@ -9371,6 +9399,16 @@ typedef struct sqlite3_backup sqlite3_backup;
|
|
|
9371
9399
|
** APIs are not strictly speaking threadsafe. If they are invoked at the
|
|
9372
9400
|
** same time as another thread is invoking sqlite3_backup_step() it is
|
|
9373
9401
|
** possible that they return invalid values.
|
|
9402
|
+
**
|
|
9403
|
+
** <b>Alternatives To Using The Backup API</b>
|
|
9404
|
+
**
|
|
9405
|
+
** Other techniques for safely creating a consistent backup of an SQLite
|
|
9406
|
+
** database include:
|
|
9407
|
+
**
|
|
9408
|
+
** <ul>
|
|
9409
|
+
** <li> The [VACUUM INTO] command.
|
|
9410
|
+
** <li> The [sqlite3_rsync] utility program.
|
|
9411
|
+
** </ul>
|
|
9374
9412
|
*/
|
|
9375
9413
|
SQLITE_API sqlite3_backup *sqlite3_backup_init(
|
|
9376
9414
|
sqlite3 *pDest, /* Destination database handle */
|
|
@@ -10570,6 +10608,14 @@ typedef struct sqlite3_snapshot {
|
|
|
10570
10608
|
** If there is not already a read-transaction open on schema S when
|
|
10571
10609
|
** this function is called, one is opened automatically.
|
|
10572
10610
|
**
|
|
10611
|
+
** If a read-transaction is opened by this function, then it is guaranteed
|
|
10612
|
+
** that the returned snapshot object may not be invalidated by a database
|
|
10613
|
+
** writer or checkpointer until after the read-transaction is closed. This
|
|
10614
|
+
** is not guaranteed if a read-transaction is already open when this
|
|
10615
|
+
** function is called. In that case, any subsequent write or checkpoint
|
|
10616
|
+
** operation on the database may invalidate the returned snapshot handle,
|
|
10617
|
+
** even while the read-transaction remains open.
|
|
10618
|
+
**
|
|
10573
10619
|
** The following must be true for this function to succeed. If any of
|
|
10574
10620
|
** the following statements are false when sqlite3_snapshot_get() is
|
|
10575
10621
|
** called, SQLITE_ERROR is returned. The final value of *P is undefined
|
|
@@ -10878,8 +10924,6 @@ SQLITE_API int sqlite3_deserialize(
|
|
|
10878
10924
|
#if defined(__wasi__)
|
|
10879
10925
|
# undef SQLITE_WASI
|
|
10880
10926
|
# define SQLITE_WASI 1
|
|
10881
|
-
# undef SQLITE_OMIT_WAL
|
|
10882
|
-
# define SQLITE_OMIT_WAL 1/* because it requires shared memory APIs */
|
|
10883
10927
|
# ifndef SQLITE_OMIT_LOAD_EXTENSION
|
|
10884
10928
|
# define SQLITE_OMIT_LOAD_EXTENSION
|
|
10885
10929
|
# endif
|
|
@@ -13082,6 +13126,10 @@ struct Fts5PhraseIter {
|
|
|
13082
13126
|
** (i.e. if it is a contentless table), then this API always iterates
|
|
13083
13127
|
** through an empty set (all calls to xPhraseFirst() set iCol to -1).
|
|
13084
13128
|
**
|
|
13129
|
+
** In all cases, matches are visited in (column ASC, offset ASC) order.
|
|
13130
|
+
** i.e. all those in column 0, sorted by offset, followed by those in
|
|
13131
|
+
** column 1, etc.
|
|
13132
|
+
**
|
|
13085
13133
|
** xPhraseNext()
|
|
13086
13134
|
** See xPhraseFirst above.
|
|
13087
13135
|
**
|
|
@@ -13148,9 +13196,32 @@ struct Fts5PhraseIter {
|
|
|
13148
13196
|
**
|
|
13149
13197
|
** This API can be quite slow if used with an FTS5 table created with the
|
|
13150
13198
|
** "detail=none" or "detail=column" option.
|
|
13199
|
+
**
|
|
13200
|
+
** xColumnLocale(pFts5, iIdx, pzLocale, pnLocale)
|
|
13201
|
+
** If parameter iCol is less than zero, or greater than or equal to the
|
|
13202
|
+
** number of columns in the table, SQLITE_RANGE is returned.
|
|
13203
|
+
**
|
|
13204
|
+
** Otherwise, this function attempts to retrieve the locale associated
|
|
13205
|
+
** with column iCol of the current row. Usually, there is no associated
|
|
13206
|
+
** locale, and output parameters (*pzLocale) and (*pnLocale) are set
|
|
13207
|
+
** to NULL and 0, respectively. However, if the fts5_locale() function
|
|
13208
|
+
** was used to associate a locale with the value when it was inserted
|
|
13209
|
+
** into the fts5 table, then (*pzLocale) is set to point to a nul-terminated
|
|
13210
|
+
** buffer containing the name of the locale in utf-8 encoding. (*pnLocale)
|
|
13211
|
+
** is set to the size in bytes of the buffer, not including the
|
|
13212
|
+
** nul-terminator.
|
|
13213
|
+
**
|
|
13214
|
+
** If successful, SQLITE_OK is returned. Or, if an error occurs, an
|
|
13215
|
+
** SQLite error code is returned. The final value of the output parameters
|
|
13216
|
+
** is undefined in this case.
|
|
13217
|
+
**
|
|
13218
|
+
** xTokenize_v2:
|
|
13219
|
+
** Tokenize text using the tokenizer belonging to the FTS5 table. This
|
|
13220
|
+
** API is the same as the xTokenize() API, except that it allows a tokenizer
|
|
13221
|
+
** locale to be specified.
|
|
13151
13222
|
*/
|
|
13152
13223
|
struct Fts5ExtensionApi {
|
|
13153
|
-
int iVersion; /* Currently always set to
|
|
13224
|
+
int iVersion; /* Currently always set to 4 */
|
|
13154
13225
|
|
|
13155
13226
|
void *(*xUserData)(Fts5Context*);
|
|
13156
13227
|
|
|
@@ -13192,6 +13263,15 @@ struct Fts5ExtensionApi {
|
|
|
13192
13263
|
const char **ppToken, int *pnToken
|
|
13193
13264
|
);
|
|
13194
13265
|
int (*xInstToken)(Fts5Context*, int iIdx, int iToken, const char**, int*);
|
|
13266
|
+
|
|
13267
|
+
/* Below this point are iVersion>=4 only */
|
|
13268
|
+
int (*xColumnLocale)(Fts5Context*, int iCol, const char **pz, int *pn);
|
|
13269
|
+
int (*xTokenize_v2)(Fts5Context*,
|
|
13270
|
+
const char *pText, int nText, /* Text to tokenize */
|
|
13271
|
+
const char *pLocale, int nLocale, /* Locale to pass to tokenizer */
|
|
13272
|
+
void *pCtx, /* Context passed to xToken() */
|
|
13273
|
+
int (*xToken)(void*, int, const char*, int, int, int) /* Callback */
|
|
13274
|
+
);
|
|
13195
13275
|
};
|
|
13196
13276
|
|
|
13197
13277
|
/*
|
|
@@ -13212,7 +13292,7 @@ struct Fts5ExtensionApi {
|
|
|
13212
13292
|
** A tokenizer instance is required to actually tokenize text.
|
|
13213
13293
|
**
|
|
13214
13294
|
** The first argument passed to this function is a copy of the (void*)
|
|
13215
|
-
** pointer provided by the application when the
|
|
13295
|
+
** pointer provided by the application when the fts5_tokenizer_v2 object
|
|
13216
13296
|
** was registered with FTS5 (the third argument to xCreateTokenizer()).
|
|
13217
13297
|
** The second and third arguments are an array of nul-terminated strings
|
|
13218
13298
|
** containing the tokenizer arguments, if any, specified following the
|
|
@@ -13236,7 +13316,7 @@ struct Fts5ExtensionApi {
|
|
|
13236
13316
|
** argument passed to this function is a pointer to an Fts5Tokenizer object
|
|
13237
13317
|
** returned by an earlier call to xCreate().
|
|
13238
13318
|
**
|
|
13239
|
-
** The
|
|
13319
|
+
** The third argument indicates the reason that FTS5 is requesting
|
|
13240
13320
|
** tokenization of the supplied text. This is always one of the following
|
|
13241
13321
|
** four values:
|
|
13242
13322
|
**
|
|
@@ -13260,6 +13340,13 @@ struct Fts5ExtensionApi {
|
|
|
13260
13340
|
** on a columnsize=0 database.
|
|
13261
13341
|
** </ul>
|
|
13262
13342
|
**
|
|
13343
|
+
** The sixth and seventh arguments passed to xTokenize() - pLocale and
|
|
13344
|
+
** nLocale - are a pointer to a buffer containing the locale to use for
|
|
13345
|
+
** tokenization (e.g. "en_US") and its size in bytes, respectively. The
|
|
13346
|
+
** pLocale buffer is not nul-terminated. pLocale may be passed NULL (in
|
|
13347
|
+
** which case nLocale is always 0) to indicate that the tokenizer should
|
|
13348
|
+
** use its default locale.
|
|
13349
|
+
**
|
|
13263
13350
|
** For each token in the input string, the supplied callback xToken() must
|
|
13264
13351
|
** be invoked. The first argument to it should be a copy of the pointer
|
|
13265
13352
|
** passed as the second argument to xTokenize(). The third and fourth
|
|
@@ -13283,6 +13370,30 @@ struct Fts5ExtensionApi {
|
|
|
13283
13370
|
** may abandon the tokenization and return any error code other than
|
|
13284
13371
|
** SQLITE_OK or SQLITE_DONE.
|
|
13285
13372
|
**
|
|
13373
|
+
** If the tokenizer is registered using an fts5_tokenizer_v2 object,
|
|
13374
|
+
** then the xTokenize() method has two additional arguments - pLocale
|
|
13375
|
+
** and nLocale. These specify the locale that the tokenizer should use
|
|
13376
|
+
** for the current request. If pLocale and nLocale are both 0, then the
|
|
13377
|
+
** tokenizer should use its default locale. Otherwise, pLocale points to
|
|
13378
|
+
** an nLocale byte buffer containing the name of the locale to use as utf-8
|
|
13379
|
+
** text. pLocale is not nul-terminated.
|
|
13380
|
+
**
|
|
13381
|
+
** FTS5_TOKENIZER
|
|
13382
|
+
**
|
|
13383
|
+
** There is also an fts5_tokenizer object. This is an older, deprecated,
|
|
13384
|
+
** version of fts5_tokenizer_v2. It is similar except that:
|
|
13385
|
+
**
|
|
13386
|
+
** <ul>
|
|
13387
|
+
** <li> There is no "iVersion" field, and
|
|
13388
|
+
** <li> The xTokenize() method does not take a locale argument.
|
|
13389
|
+
** </ul>
|
|
13390
|
+
**
|
|
13391
|
+
** Legacy fts5_tokenizer tokenizers must be registered using the
|
|
13392
|
+
** legacy xCreateTokenizer() function, instead of xCreateTokenizer_v2().
|
|
13393
|
+
**
|
|
13394
|
+
** Tokenizer implementations registered using either API may be retrieved
|
|
13395
|
+
** using both xFindTokenizer() and xFindTokenizer_v2().
|
|
13396
|
+
**
|
|
13286
13397
|
** SYNONYM SUPPORT
|
|
13287
13398
|
**
|
|
13288
13399
|
** Custom tokenizers may also support synonyms. Consider a case in which a
|
|
@@ -13391,6 +13502,33 @@ struct Fts5ExtensionApi {
|
|
|
13391
13502
|
** inefficient.
|
|
13392
13503
|
*/
|
|
13393
13504
|
typedef struct Fts5Tokenizer Fts5Tokenizer;
|
|
13505
|
+
typedef struct fts5_tokenizer_v2 fts5_tokenizer_v2;
|
|
13506
|
+
struct fts5_tokenizer_v2 {
|
|
13507
|
+
int iVersion; /* Currently always 2 */
|
|
13508
|
+
|
|
13509
|
+
int (*xCreate)(void*, const char **azArg, int nArg, Fts5Tokenizer **ppOut);
|
|
13510
|
+
void (*xDelete)(Fts5Tokenizer*);
|
|
13511
|
+
int (*xTokenize)(Fts5Tokenizer*,
|
|
13512
|
+
void *pCtx,
|
|
13513
|
+
int flags, /* Mask of FTS5_TOKENIZE_* flags */
|
|
13514
|
+
const char *pText, int nText,
|
|
13515
|
+
const char *pLocale, int nLocale,
|
|
13516
|
+
int (*xToken)(
|
|
13517
|
+
void *pCtx, /* Copy of 2nd argument to xTokenize() */
|
|
13518
|
+
int tflags, /* Mask of FTS5_TOKEN_* flags */
|
|
13519
|
+
const char *pToken, /* Pointer to buffer containing token */
|
|
13520
|
+
int nToken, /* Size of token in bytes */
|
|
13521
|
+
int iStart, /* Byte offset of token within input text */
|
|
13522
|
+
int iEnd /* Byte offset of end of token within input text */
|
|
13523
|
+
)
|
|
13524
|
+
);
|
|
13525
|
+
};
|
|
13526
|
+
|
|
13527
|
+
/*
|
|
13528
|
+
** New code should use the fts5_tokenizer_v2 type to define tokenizer
|
|
13529
|
+
** implementations. The following type is included for legacy applications
|
|
13530
|
+
** that still use it.
|
|
13531
|
+
*/
|
|
13394
13532
|
typedef struct fts5_tokenizer fts5_tokenizer;
|
|
13395
13533
|
struct fts5_tokenizer {
|
|
13396
13534
|
int (*xCreate)(void*, const char **azArg, int nArg, Fts5Tokenizer **ppOut);
|
|
@@ -13410,6 +13548,7 @@ struct fts5_tokenizer {
|
|
|
13410
13548
|
);
|
|
13411
13549
|
};
|
|
13412
13550
|
|
|
13551
|
+
|
|
13413
13552
|
/* Flags that may be passed as the third argument to xTokenize() */
|
|
13414
13553
|
#define FTS5_TOKENIZE_QUERY 0x0001
|
|
13415
13554
|
#define FTS5_TOKENIZE_PREFIX 0x0002
|
|
@@ -13429,7 +13568,7 @@ struct fts5_tokenizer {
|
|
|
13429
13568
|
*/
|
|
13430
13569
|
typedef struct fts5_api fts5_api;
|
|
13431
13570
|
struct fts5_api {
|
|
13432
|
-
int iVersion; /* Currently always set to
|
|
13571
|
+
int iVersion; /* Currently always set to 3 */
|
|
13433
13572
|
|
|
13434
13573
|
/* Create a new tokenizer */
|
|
13435
13574
|
int (*xCreateTokenizer)(
|
|
@@ -13456,6 +13595,25 @@ struct fts5_api {
|
|
|
13456
13595
|
fts5_extension_function xFunction,
|
|
13457
13596
|
void (*xDestroy)(void*)
|
|
13458
13597
|
);
|
|
13598
|
+
|
|
13599
|
+
/* APIs below this point are only available if iVersion>=3 */
|
|
13600
|
+
|
|
13601
|
+
/* Create a new tokenizer */
|
|
13602
|
+
int (*xCreateTokenizer_v2)(
|
|
13603
|
+
fts5_api *pApi,
|
|
13604
|
+
const char *zName,
|
|
13605
|
+
void *pUserData,
|
|
13606
|
+
fts5_tokenizer_v2 *pTokenizer,
|
|
13607
|
+
void (*xDestroy)(void*)
|
|
13608
|
+
);
|
|
13609
|
+
|
|
13610
|
+
/* Find an existing tokenizer */
|
|
13611
|
+
int (*xFindTokenizer_v2)(
|
|
13612
|
+
fts5_api *pApi,
|
|
13613
|
+
const char *zName,
|
|
13614
|
+
void **ppUserData,
|
|
13615
|
+
fts5_tokenizer_v2 **ppTokenizer
|
|
13616
|
+
);
|
|
13459
13617
|
};
|
|
13460
13618
|
|
|
13461
13619
|
/*
|
|
@@ -13684,7 +13842,7 @@ SQLITE_API unsigned char* wxsqlite3_codec_data(sqlite3* db, const char* zDbName,
|
|
|
13684
13842
|
*/
|
|
13685
13843
|
typedef struct _CipherParams
|
|
13686
13844
|
{
|
|
13687
|
-
char* m_name;
|
|
13845
|
+
const char* m_name;
|
|
13688
13846
|
int m_value;
|
|
13689
13847
|
int m_default;
|
|
13690
13848
|
int m_minValue;
|
|
@@ -13717,13 +13875,13 @@ typedef int (*GetLegacy_t)(void* cipher);
|
|
|
13717
13875
|
typedef int (*GetPageSize_t)(void* cipher);
|
|
13718
13876
|
typedef int (*GetReserved_t)(void* cipher);
|
|
13719
13877
|
typedef unsigned char* (*GetSalt_t)(void* cipher);
|
|
13720
|
-
typedef void (*GenerateKey_t)(void* cipher,
|
|
13878
|
+
typedef void (*GenerateKey_t)(void* cipher, char* userPassword, int passwordLength, int rekey, unsigned char* cipherSalt);
|
|
13721
13879
|
typedef int (*EncryptPage_t)(void* cipher, int page, unsigned char* data, int len, int reserved);
|
|
13722
13880
|
typedef int (*DecryptPage_t)(void* cipher, int page, unsigned char* data, int len, int reserved, int hmacCheck);
|
|
13723
13881
|
|
|
13724
13882
|
typedef struct _CipherDescriptor
|
|
13725
13883
|
{
|
|
13726
|
-
char*
|
|
13884
|
+
const char* m_name;
|
|
13727
13885
|
AllocateCipher_t m_allocateCipher;
|
|
13728
13886
|
FreeCipher_t m_freeCipher;
|
|
13729
13887
|
CloneCipher_t m_cloneCipher;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "better-sqlite3-multiple-ciphers",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.7.0",
|
|
4
4
|
"description": "better-sqlite3 with multiple-cipher encryption support",
|
|
5
5
|
"homepage": "https://github.com/m4heshd/better-sqlite3-multiple-ciphers",
|
|
6
6
|
"author": "Mahesh Bandara Wijerathna (m4heshd) <m4heshd@gmail.com>",
|
package/src/better_sqlite3.cpp
CHANGED
|
@@ -209,6 +209,10 @@ CS::CS (v8::Isolate * isolate)
|
|
|
209
209
|
SetCode(isolate, SQLITE_WARNING, "SQLITE_WARNING");
|
|
210
210
|
SetCode(isolate, SQLITE_ROW, "SQLITE_ROW");
|
|
211
211
|
SetCode(isolate, SQLITE_DONE, "SQLITE_DONE");
|
|
212
|
+
|
|
213
|
+
SetCode(isolate, SQLITE_ERROR_MISSING_COLLSEQ, "SQLITE_ERROR_MISSING_COLLSEQ");
|
|
214
|
+
SetCode(isolate, SQLITE_ERROR_RETRY, "SQLITE_ERROR_RETRY");
|
|
215
|
+
SetCode(isolate, SQLITE_ERROR_SNAPSHOT, "SQLITE_ERROR_SNAPSHOT");
|
|
212
216
|
SetCode(isolate, SQLITE_IOERR_READ, "SQLITE_IOERR_READ");
|
|
213
217
|
SetCode(isolate, SQLITE_IOERR_SHORT_READ, "SQLITE_IOERR_SHORT_READ");
|
|
214
218
|
SetCode(isolate, SQLITE_IOERR_WRITE, "SQLITE_IOERR_WRITE");
|
|
@@ -237,18 +241,31 @@ CS::CS (v8::Isolate * isolate)
|
|
|
237
241
|
SetCode(isolate, SQLITE_IOERR_CONVPATH, "SQLITE_IOERR_CONVPATH");
|
|
238
242
|
SetCode(isolate, SQLITE_IOERR_VNODE, "SQLITE_IOERR_VNODE");
|
|
239
243
|
SetCode(isolate, SQLITE_IOERR_AUTH, "SQLITE_IOERR_AUTH");
|
|
244
|
+
SetCode(isolate, SQLITE_IOERR_BEGIN_ATOMIC, "SQLITE_IOERR_BEGIN_ATOMIC");
|
|
245
|
+
SetCode(isolate, SQLITE_IOERR_COMMIT_ATOMIC, "SQLITE_IOERR_COMMIT_ATOMIC");
|
|
246
|
+
SetCode(isolate, SQLITE_IOERR_ROLLBACK_ATOMIC, "SQLITE_IOERR_ROLLBACK_ATOMIC");
|
|
247
|
+
SetCode(isolate, SQLITE_IOERR_DATA, "SQLITE_IOERR_DATA");
|
|
248
|
+
SetCode(isolate, SQLITE_IOERR_CORRUPTFS, "SQLITE_IOERR_CORRUPTFS");
|
|
249
|
+
SetCode(isolate, SQLITE_IOERR_IN_PAGE, "SQLITE_IOERR_IN_PAGE");
|
|
240
250
|
SetCode(isolate, SQLITE_LOCKED_SHAREDCACHE, "SQLITE_LOCKED_SHAREDCACHE");
|
|
251
|
+
SetCode(isolate, SQLITE_LOCKED_VTAB, "SQLITE_LOCKED_VTAB");
|
|
241
252
|
SetCode(isolate, SQLITE_BUSY_RECOVERY, "SQLITE_BUSY_RECOVERY");
|
|
242
253
|
SetCode(isolate, SQLITE_BUSY_SNAPSHOT, "SQLITE_BUSY_SNAPSHOT");
|
|
243
254
|
SetCode(isolate, SQLITE_CANTOPEN_NOTEMPDIR, "SQLITE_CANTOPEN_NOTEMPDIR");
|
|
244
255
|
SetCode(isolate, SQLITE_CANTOPEN_ISDIR, "SQLITE_CANTOPEN_ISDIR");
|
|
245
256
|
SetCode(isolate, SQLITE_CANTOPEN_FULLPATH, "SQLITE_CANTOPEN_FULLPATH");
|
|
246
257
|
SetCode(isolate, SQLITE_CANTOPEN_CONVPATH, "SQLITE_CANTOPEN_CONVPATH");
|
|
258
|
+
SetCode(isolate, SQLITE_CANTOPEN_DIRTYWAL, "SQLITE_CANTOPEN_DIRTYWAL");
|
|
259
|
+
SetCode(isolate, SQLITE_CANTOPEN_SYMLINK, "SQLITE_CANTOPEN_SYMLINK");
|
|
247
260
|
SetCode(isolate, SQLITE_CORRUPT_VTAB, "SQLITE_CORRUPT_VTAB");
|
|
261
|
+
SetCode(isolate, SQLITE_CORRUPT_SEQUENCE, "SQLITE_CORRUPT_SEQUENCE");
|
|
262
|
+
SetCode(isolate, SQLITE_CORRUPT_INDEX, "SQLITE_CORRUPT_INDEX");
|
|
248
263
|
SetCode(isolate, SQLITE_READONLY_RECOVERY, "SQLITE_READONLY_RECOVERY");
|
|
249
264
|
SetCode(isolate, SQLITE_READONLY_CANTLOCK, "SQLITE_READONLY_CANTLOCK");
|
|
250
265
|
SetCode(isolate, SQLITE_READONLY_ROLLBACK, "SQLITE_READONLY_ROLLBACK");
|
|
251
266
|
SetCode(isolate, SQLITE_READONLY_DBMOVED, "SQLITE_READONLY_DBMOVED");
|
|
267
|
+
SetCode(isolate, SQLITE_READONLY_CANTINIT, "SQLITE_READONLY_CANTINIT");
|
|
268
|
+
SetCode(isolate, SQLITE_READONLY_DIRECTORY, "SQLITE_READONLY_DIRECTORY");
|
|
252
269
|
SetCode(isolate, SQLITE_ABORT_ROLLBACK, "SQLITE_ABORT_ROLLBACK");
|
|
253
270
|
SetCode(isolate, SQLITE_CONSTRAINT_CHECK, "SQLITE_CONSTRAINT_CHECK");
|
|
254
271
|
SetCode(isolate, SQLITE_CONSTRAINT_COMMITHOOK, "SQLITE_CONSTRAINT_COMMITHOOK");
|
|
@@ -260,21 +277,25 @@ CS::CS (v8::Isolate * isolate)
|
|
|
260
277
|
SetCode(isolate, SQLITE_CONSTRAINT_UNIQUE, "SQLITE_CONSTRAINT_UNIQUE");
|
|
261
278
|
SetCode(isolate, SQLITE_CONSTRAINT_VTAB, "SQLITE_CONSTRAINT_VTAB");
|
|
262
279
|
SetCode(isolate, SQLITE_CONSTRAINT_ROWID, "SQLITE_CONSTRAINT_ROWID");
|
|
280
|
+
SetCode(isolate, SQLITE_CONSTRAINT_PINNED, "SQLITE_CONSTRAINT_PINNED");
|
|
281
|
+
SetCode(isolate, SQLITE_CONSTRAINT_DATATYPE, "SQLITE_CONSTRAINT_DATATYPE");
|
|
263
282
|
SetCode(isolate, SQLITE_NOTICE_RECOVER_WAL, "SQLITE_NOTICE_RECOVER_WAL");
|
|
264
283
|
SetCode(isolate, SQLITE_NOTICE_RECOVER_ROLLBACK, "SQLITE_NOTICE_RECOVER_ROLLBACK");
|
|
284
|
+
SetCode(isolate, SQLITE_NOTICE_RBU, "SQLITE_NOTICE_RBU");
|
|
265
285
|
SetCode(isolate, SQLITE_WARNING_AUTOINDEX, "SQLITE_WARNING_AUTOINDEX");
|
|
266
286
|
SetCode(isolate, SQLITE_AUTH_USER, "SQLITE_AUTH_USER");
|
|
267
287
|
SetCode(isolate, SQLITE_OK_LOAD_PERMANENTLY, "SQLITE_OK_LOAD_PERMANENTLY");
|
|
288
|
+
SetCode(isolate, SQLITE_OK_SYMLINK, "SQLITE_OK_SYMLINK");
|
|
268
289
|
}
|
|
269
|
-
#line
|
|
290
|
+
#line 161 "./src/util/constants.lzz"
|
|
270
291
|
void CS::SetString (v8::Isolate * isolate, v8::Global <v8::String> & constant, char const * str)
|
|
271
|
-
#line
|
|
292
|
+
#line 161 "./src/util/constants.lzz"
|
|
272
293
|
{
|
|
273
294
|
constant.Reset(isolate, InternalizedFromLatin1(isolate, str));
|
|
274
295
|
}
|
|
275
|
-
#line
|
|
296
|
+
#line 165 "./src/util/constants.lzz"
|
|
276
297
|
void CS::SetCode (v8::Isolate * isolate, int code, char const * str)
|
|
277
|
-
#line
|
|
298
|
+
#line 165 "./src/util/constants.lzz"
|
|
278
299
|
{
|
|
279
300
|
codes.emplace(std::piecewise_construct,
|
|
280
301
|
std::forward_as_tuple(code),
|
package/src/better_sqlite3.hpp
CHANGED
|
@@ -68,49 +68,49 @@ public:
|
|
|
68
68
|
v8::Local <v8::String> Code (v8::Isolate * isolate, int code);
|
|
69
69
|
#line 10 "./src/util/constants.lzz"
|
|
70
70
|
explicit CS (v8::Isolate * isolate);
|
|
71
|
-
#line
|
|
71
|
+
#line 140 "./src/util/constants.lzz"
|
|
72
72
|
v8::Global <v8::String> database;
|
|
73
|
-
#line
|
|
73
|
+
#line 141 "./src/util/constants.lzz"
|
|
74
74
|
v8::Global <v8::String> reader;
|
|
75
|
-
#line
|
|
75
|
+
#line 142 "./src/util/constants.lzz"
|
|
76
76
|
v8::Global <v8::String> source;
|
|
77
|
-
#line
|
|
77
|
+
#line 143 "./src/util/constants.lzz"
|
|
78
78
|
v8::Global <v8::String> memory;
|
|
79
|
-
#line
|
|
79
|
+
#line 144 "./src/util/constants.lzz"
|
|
80
80
|
v8::Global <v8::String> readonly;
|
|
81
|
-
#line
|
|
81
|
+
#line 145 "./src/util/constants.lzz"
|
|
82
82
|
v8::Global <v8::String> name;
|
|
83
|
-
#line
|
|
83
|
+
#line 146 "./src/util/constants.lzz"
|
|
84
84
|
v8::Global <v8::String> next;
|
|
85
|
-
#line
|
|
85
|
+
#line 147 "./src/util/constants.lzz"
|
|
86
86
|
v8::Global <v8::String> length;
|
|
87
|
-
#line
|
|
87
|
+
#line 148 "./src/util/constants.lzz"
|
|
88
88
|
v8::Global <v8::String> done;
|
|
89
|
-
#line
|
|
89
|
+
#line 149 "./src/util/constants.lzz"
|
|
90
90
|
v8::Global <v8::String> value;
|
|
91
|
-
#line
|
|
91
|
+
#line 150 "./src/util/constants.lzz"
|
|
92
92
|
v8::Global <v8::String> changes;
|
|
93
|
-
#line
|
|
93
|
+
#line 151 "./src/util/constants.lzz"
|
|
94
94
|
v8::Global <v8::String> lastInsertRowid;
|
|
95
|
-
#line
|
|
95
|
+
#line 152 "./src/util/constants.lzz"
|
|
96
96
|
v8::Global <v8::String> statement;
|
|
97
|
-
#line
|
|
97
|
+
#line 153 "./src/util/constants.lzz"
|
|
98
98
|
v8::Global <v8::String> column;
|
|
99
|
-
#line
|
|
99
|
+
#line 154 "./src/util/constants.lzz"
|
|
100
100
|
v8::Global <v8::String> table;
|
|
101
|
-
#line
|
|
101
|
+
#line 155 "./src/util/constants.lzz"
|
|
102
102
|
v8::Global <v8::String> type;
|
|
103
|
-
#line
|
|
103
|
+
#line 156 "./src/util/constants.lzz"
|
|
104
104
|
v8::Global <v8::String> totalPages;
|
|
105
|
-
#line
|
|
105
|
+
#line 157 "./src/util/constants.lzz"
|
|
106
106
|
v8::Global <v8::String> remainingPages;
|
|
107
|
-
#line
|
|
107
|
+
#line 159 "./src/util/constants.lzz"
|
|
108
108
|
private:
|
|
109
|
-
#line
|
|
109
|
+
#line 161 "./src/util/constants.lzz"
|
|
110
110
|
static void SetString (v8::Isolate * isolate, v8::Global <v8::String> & constant, char const * str);
|
|
111
|
-
#line
|
|
111
|
+
#line 165 "./src/util/constants.lzz"
|
|
112
112
|
void SetCode (v8::Isolate * isolate, int code, char const * str);
|
|
113
|
-
#line
|
|
113
|
+
#line 171 "./src/util/constants.lzz"
|
|
114
114
|
std::unordered_map <int, v8::Global<v8::String> > codes;
|
|
115
115
|
};
|
|
116
116
|
#line 1 "./src/util/bind-map.lzz"
|