better-sqlite3-multiple-ciphers 9.3.0 → 9.4.1
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 +7 -5
- package/deps/setup.ps1 +1 -1
- package/deps/sqlite3/sqlite3.c +138 -94
- package/deps/sqlite3/sqlite3.h +5 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,10 +17,10 @@ The fastest and simplest library for SQLite3 in Node.js. This particular fork su
|
|
|
17
17
|
## Current versions
|
|
18
18
|
|
|
19
19
|
- ### Stable
|
|
20
|
-
- **better-sqlite3-multiple-ciphers** - [`9.
|
|
21
|
-
- **better-sqlite3** - [`9.
|
|
22
|
-
- **SQLite** - [`3.45.
|
|
23
|
-
- **SQLite3 Multiple Ciphers** - [`1.8.
|
|
20
|
+
- **better-sqlite3-multiple-ciphers** - [`9.4.1`](https://github.com/m4heshd/better-sqlite3-multiple-ciphers/releases/tag/v9.4.1)
|
|
21
|
+
- **better-sqlite3** - [`9.4.1`](https://github.com/JoshuaWise/better-sqlite3/releases/tag/v9.4.1)
|
|
22
|
+
- **SQLite** - [`3.45.1`](https://www.sqlite.org/releaselog/3_45_1.html)
|
|
23
|
+
- **SQLite3 Multiple Ciphers** - [`1.8.3`](https://github.com/utelle/SQLite3MultipleCiphers/releases/tag/v1.8.3)
|
|
24
24
|
|
|
25
25
|
- ### Beta
|
|
26
26
|
- **better-sqlite3-multiple-ciphers** - [`v9.1.2-beta.0`](https://github.com/m4heshd/better-sqlite3-multiple-ciphers/releases/tag/v9.1.2-beta.0)
|
|
@@ -40,7 +40,9 @@ Also head over to [SQLite3MultipleCiphers](https://github.com/utelle/SQLite3Mult
|
|
|
40
40
|
|
|
41
41
|
You can also support me (the maintainer of this fork) by buying me a coffee. 😊
|
|
42
42
|
|
|
43
|
-
[](https://ko-fi.
|
|
43
|
+
[](https://ko-fi.variatix.net/)
|
|
44
|
+
|
|
45
|
+
[](https://paypal.variatix.net/)
|
|
44
46
|
|
|
45
47
|
## How other libraries compare
|
|
46
48
|
|
package/deps/setup.ps1
CHANGED
package/deps/sqlite3/sqlite3.c
CHANGED
|
@@ -133,7 +133,7 @@ extern SQLITE_API LPWSTR sqlite3_win32_utf8_to_unicode(const char*);
|
|
|
133
133
|
/*** Begin of #include "sqlite3patched.c" ***/
|
|
134
134
|
/******************************************************************************
|
|
135
135
|
** This file is an amalgamation of many separate C source files from SQLite
|
|
136
|
-
** version 3.45.
|
|
136
|
+
** version 3.45.1. By combining all the individual C code files into this
|
|
137
137
|
** single large file, the entire code can be compiled as a single translation
|
|
138
138
|
** unit. This allows many compilers to do optimizations that would not be
|
|
139
139
|
** possible if the files were compiled separately. Performance improvements
|
|
@@ -151,7 +151,7 @@ extern SQLITE_API LPWSTR sqlite3_win32_utf8_to_unicode(const char*);
|
|
|
151
151
|
** separate file. This file contains only code for the core SQLite library.
|
|
152
152
|
**
|
|
153
153
|
** The content in this amalgamation comes from Fossil check-in
|
|
154
|
-
**
|
|
154
|
+
** e876e51a0ed5c5b3126f52e532044363a014.
|
|
155
155
|
*/
|
|
156
156
|
#define SQLITE_CORE 1
|
|
157
157
|
#define SQLITE_AMALGAMATION 1
|
|
@@ -592,9 +592,9 @@ extern "C" {
|
|
|
592
592
|
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
|
593
593
|
** [sqlite_version()] and [sqlite_source_id()].
|
|
594
594
|
*/
|
|
595
|
-
#define SQLITE_VERSION "3.45.
|
|
596
|
-
#define SQLITE_VERSION_NUMBER
|
|
597
|
-
#define SQLITE_SOURCE_ID "2024-01-
|
|
595
|
+
#define SQLITE_VERSION "3.45.1"
|
|
596
|
+
#define SQLITE_VERSION_NUMBER 3045001
|
|
597
|
+
#define SQLITE_SOURCE_ID "2024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257cc467a"
|
|
598
598
|
|
|
599
599
|
/*
|
|
600
600
|
** CAPI3REF: Run-Time Library Version Numbers
|
|
@@ -43562,11 +43562,16 @@ static int unixFetch(sqlite3_file *fd, i64 iOff, int nAmt, void **pp){
|
|
|
43562
43562
|
|
|
43563
43563
|
#if SQLITE_MAX_MMAP_SIZE>0
|
|
43564
43564
|
if( pFd->mmapSizeMax>0 ){
|
|
43565
|
+
/* Ensure that there is always at least a 256 byte buffer of addressable
|
|
43566
|
+
** memory following the returned page. If the database is corrupt,
|
|
43567
|
+
** SQLite may overread the page slightly (in practice only a few bytes,
|
|
43568
|
+
** but 256 is safe, round, number). */
|
|
43569
|
+
const int nEofBuffer = 256;
|
|
43565
43570
|
if( pFd->pMapRegion==0 ){
|
|
43566
43571
|
int rc = unixMapfile(pFd, -1);
|
|
43567
43572
|
if( rc!=SQLITE_OK ) return rc;
|
|
43568
43573
|
}
|
|
43569
|
-
if( pFd->mmapSize >= iOff+nAmt ){
|
|
43574
|
+
if( pFd->mmapSize >= (iOff+nAmt+nEofBuffer) ){
|
|
43570
43575
|
*pp = &((u8 *)pFd->pMapRegion)[iOff];
|
|
43571
43576
|
pFd->nFetchOut++;
|
|
43572
43577
|
}
|
|
@@ -50919,6 +50924,11 @@ static int winFetch(sqlite3_file *fd, i64 iOff, int nAmt, void **pp){
|
|
|
50919
50924
|
|
|
50920
50925
|
#if SQLITE_MAX_MMAP_SIZE>0
|
|
50921
50926
|
if( pFd->mmapSizeMax>0 ){
|
|
50927
|
+
/* Ensure that there is always at least a 256 byte buffer of addressable
|
|
50928
|
+
** memory following the returned page. If the database is corrupt,
|
|
50929
|
+
** SQLite may overread the page slightly (in practice only a few bytes,
|
|
50930
|
+
** but 256 is safe, round, number). */
|
|
50931
|
+
const int nEofBuffer = 256;
|
|
50922
50932
|
if( pFd->pMapRegion==0 ){
|
|
50923
50933
|
int rc = winMapfile(pFd, -1);
|
|
50924
50934
|
if( rc!=SQLITE_OK ){
|
|
@@ -50927,7 +50937,7 @@ static int winFetch(sqlite3_file *fd, i64 iOff, int nAmt, void **pp){
|
|
|
50927
50937
|
return rc;
|
|
50928
50938
|
}
|
|
50929
50939
|
}
|
|
50930
|
-
if( pFd->mmapSize >= iOff+nAmt ){
|
|
50940
|
+
if( pFd->mmapSize >= (iOff+nAmt+nEofBuffer) ){
|
|
50931
50941
|
assert( pFd->pMapRegion!=0 );
|
|
50932
50942
|
*pp = &((u8 *)pFd->pMapRegion)[iOff];
|
|
50933
50943
|
pFd->nFetchOut++;
|
|
@@ -76557,7 +76567,10 @@ static SQLITE_NOINLINE int btreePrevious(BtCursor *pCur){
|
|
|
76557
76567
|
}
|
|
76558
76568
|
|
|
76559
76569
|
pPage = pCur->pPage;
|
|
76560
|
-
|
|
76570
|
+
if( sqlite3FaultSim(412) ) pPage->isInit = 0;
|
|
76571
|
+
if( !pPage->isInit ){
|
|
76572
|
+
return SQLITE_CORRUPT_BKPT;
|
|
76573
|
+
}
|
|
76561
76574
|
if( !pPage->leaf ){
|
|
76562
76575
|
int idx = pCur->ix;
|
|
76563
76576
|
rc = moveToChild(pCur, get4byte(findCell(pPage, idx)));
|
|
@@ -166972,7 +166985,10 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(
|
|
|
166972
166985
|
|
|
166973
166986
|
/* An ORDER/GROUP BY clause of more than 63 terms cannot be optimized */
|
|
166974
166987
|
testcase( pOrderBy && pOrderBy->nExpr==BMS-1 );
|
|
166975
|
-
if( pOrderBy && pOrderBy->nExpr>=BMS )
|
|
166988
|
+
if( pOrderBy && pOrderBy->nExpr>=BMS ){
|
|
166989
|
+
pOrderBy = 0;
|
|
166990
|
+
wctrlFlags &= ~WHERE_WANT_DISTINCT;
|
|
166991
|
+
}
|
|
166976
166992
|
|
|
166977
166993
|
/* The number of tables in the FROM clause is limited by the number of
|
|
166978
166994
|
** bits in a Bitmask
|
|
@@ -184917,6 +184933,8 @@ SQLITE_PRIVATE int sqlite3FtsUnicodeIsdiacritic(int);
|
|
|
184917
184933
|
|
|
184918
184934
|
SQLITE_PRIVATE int sqlite3Fts3ExprIterate(Fts3Expr*, int (*x)(Fts3Expr*,int,void*), void*);
|
|
184919
184935
|
|
|
184936
|
+
SQLITE_PRIVATE int sqlite3Fts3IntegrityCheck(Fts3Table *p, int *pbOk);
|
|
184937
|
+
|
|
184920
184938
|
#endif /* !SQLITE_CORE || SQLITE_ENABLE_FTS3 */
|
|
184921
184939
|
#endif /* _FTSINT_H */
|
|
184922
184940
|
|
|
@@ -188639,7 +188657,7 @@ static int fts3ShadowName(const char *zName){
|
|
|
188639
188657
|
** Implementation of the xIntegrity() method on the FTS3/FTS4 virtual
|
|
188640
188658
|
** table.
|
|
188641
188659
|
*/
|
|
188642
|
-
static int
|
|
188660
|
+
static int fts3IntegrityMethod(
|
|
188643
188661
|
sqlite3_vtab *pVtab, /* The virtual table to be checked */
|
|
188644
188662
|
const char *zSchema, /* Name of schema in which pVtab lives */
|
|
188645
188663
|
const char *zTabname, /* Name of the pVTab table */
|
|
@@ -188647,30 +188665,21 @@ static int fts3Integrity(
|
|
|
188647
188665
|
char **pzErr /* Write error message here */
|
|
188648
188666
|
){
|
|
188649
188667
|
Fts3Table *p = (Fts3Table*)pVtab;
|
|
188650
|
-
char *zSql;
|
|
188651
188668
|
int rc;
|
|
188652
|
-
|
|
188669
|
+
int bOk = 0;
|
|
188653
188670
|
|
|
188654
|
-
assert( pzErr!=0 );
|
|
188655
|
-
assert( *pzErr==0 );
|
|
188656
188671
|
UNUSED_PARAMETER(isQuick);
|
|
188657
|
-
|
|
188658
|
-
|
|
188659
|
-
|
|
188660
|
-
if( zSql==0 ){
|
|
188661
|
-
return SQLITE_NOMEM;
|
|
188662
|
-
}
|
|
188663
|
-
rc = sqlite3_exec(p->db, zSql, 0, 0, &zErr);
|
|
188664
|
-
sqlite3_free(zSql);
|
|
188665
|
-
if( (rc&0xff)==SQLITE_CORRUPT ){
|
|
188666
|
-
*pzErr = sqlite3_mprintf("malformed inverted index for FTS%d table %s.%s",
|
|
188667
|
-
p->bFts4 ? 4 : 3, zSchema, zTabname);
|
|
188668
|
-
}else if( rc!=SQLITE_OK ){
|
|
188672
|
+
rc = sqlite3Fts3IntegrityCheck(p, &bOk);
|
|
188673
|
+
assert( rc!=SQLITE_CORRUPT_VTAB || bOk==0 );
|
|
188674
|
+
if( rc!=SQLITE_OK && rc!=SQLITE_CORRUPT_VTAB ){
|
|
188669
188675
|
*pzErr = sqlite3_mprintf("unable to validate the inverted index for"
|
|
188670
188676
|
" FTS%d table %s.%s: %s",
|
|
188671
|
-
p->bFts4 ? 4 : 3, zSchema, zTabname,
|
|
188677
|
+
p->bFts4 ? 4 : 3, zSchema, zTabname, sqlite3_errstr(rc));
|
|
188678
|
+
}else if( bOk==0 ){
|
|
188679
|
+
*pzErr = sqlite3_mprintf("malformed inverted index for FTS%d table %s.%s",
|
|
188680
|
+
p->bFts4 ? 4 : 3, zSchema, zTabname);
|
|
188672
188681
|
}
|
|
188673
|
-
|
|
188682
|
+
sqlite3Fts3SegmentsClose(p);
|
|
188674
188683
|
return SQLITE_OK;
|
|
188675
188684
|
}
|
|
188676
188685
|
|
|
@@ -188701,7 +188710,7 @@ static const sqlite3_module fts3Module = {
|
|
|
188701
188710
|
/* xRelease */ fts3ReleaseMethod,
|
|
188702
188711
|
/* xRollbackTo */ fts3RollbackToMethod,
|
|
188703
188712
|
/* xShadowName */ fts3ShadowName,
|
|
188704
|
-
/* xIntegrity */
|
|
188713
|
+
/* xIntegrity */ fts3IntegrityMethod,
|
|
188705
188714
|
};
|
|
188706
188715
|
|
|
188707
188716
|
/*
|
|
@@ -200255,7 +200264,7 @@ static u64 fts3ChecksumIndex(
|
|
|
200255
200264
|
** If an error occurs (e.g. an OOM or IO error), return an SQLite error
|
|
200256
200265
|
** code. The final value of *pbOk is undefined in this case.
|
|
200257
200266
|
*/
|
|
200258
|
-
|
|
200267
|
+
SQLITE_PRIVATE int sqlite3Fts3IntegrityCheck(Fts3Table *p, int *pbOk){
|
|
200259
200268
|
int rc = SQLITE_OK; /* Return code */
|
|
200260
200269
|
u64 cksum1 = 0; /* Checksum based on FTS index contents */
|
|
200261
200270
|
u64 cksum2 = 0; /* Checksum based on %_content contents */
|
|
@@ -200333,7 +200342,7 @@ static int fts3IntegrityCheck(Fts3Table *p, int *pbOk){
|
|
|
200333
200342
|
sqlite3_finalize(pStmt);
|
|
200334
200343
|
}
|
|
200335
200344
|
|
|
200336
|
-
*pbOk = (cksum1==cksum2);
|
|
200345
|
+
*pbOk = (rc==SQLITE_OK && cksum1==cksum2);
|
|
200337
200346
|
return rc;
|
|
200338
200347
|
}
|
|
200339
200348
|
|
|
@@ -200373,7 +200382,7 @@ static int fts3DoIntegrityCheck(
|
|
|
200373
200382
|
){
|
|
200374
200383
|
int rc;
|
|
200375
200384
|
int bOk = 0;
|
|
200376
|
-
rc =
|
|
200385
|
+
rc = sqlite3Fts3IntegrityCheck(p, &bOk);
|
|
200377
200386
|
if( rc==SQLITE_OK && bOk==0 ) rc = FTS_CORRUPT_VTAB;
|
|
200378
200387
|
return rc;
|
|
200379
200388
|
}
|
|
@@ -203926,6 +203935,16 @@ static void jsonAppendChar(JsonString *p, char c){
|
|
|
203926
203935
|
}
|
|
203927
203936
|
}
|
|
203928
203937
|
|
|
203938
|
+
/* Remove a single character from the end of the string
|
|
203939
|
+
*/
|
|
203940
|
+
static void jsonStringTrimOneChar(JsonString *p){
|
|
203941
|
+
if( p->eErr==0 ){
|
|
203942
|
+
assert( p->nUsed>0 );
|
|
203943
|
+
p->nUsed--;
|
|
203944
|
+
}
|
|
203945
|
+
}
|
|
203946
|
+
|
|
203947
|
+
|
|
203929
203948
|
/* Make sure there is a zero terminator on p->zBuf[]
|
|
203930
203949
|
**
|
|
203931
203950
|
** Return true on success. Return false if an OOM prevents this
|
|
@@ -203933,7 +203952,7 @@ static void jsonAppendChar(JsonString *p, char c){
|
|
|
203933
203952
|
*/
|
|
203934
203953
|
static int jsonStringTerminate(JsonString *p){
|
|
203935
203954
|
jsonAppendChar(p, 0);
|
|
203936
|
-
p
|
|
203955
|
+
jsonStringTrimOneChar(p);
|
|
203937
203956
|
return p->eErr==0;
|
|
203938
203957
|
}
|
|
203939
203958
|
|
|
@@ -205399,8 +205418,8 @@ static u32 jsonbPayloadSize(const JsonParse *pParse, u32 i, u32 *pSz){
|
|
|
205399
205418
|
(pParse->aBlob[i+7]<<8) + pParse->aBlob[i+8];
|
|
205400
205419
|
n = 9;
|
|
205401
205420
|
}
|
|
205402
|
-
if( i+sz+n > pParse->nBlob
|
|
205403
|
-
&& i+sz+n > pParse->nBlob-pParse->delta
|
|
205421
|
+
if( (i64)i+sz+n > pParse->nBlob
|
|
205422
|
+
&& (i64)i+sz+n > pParse->nBlob-pParse->delta
|
|
205404
205423
|
){
|
|
205405
205424
|
sz = 0;
|
|
205406
205425
|
n = 0;
|
|
@@ -205450,6 +205469,7 @@ static u32 jsonTranslateBlobToText(
|
|
|
205450
205469
|
}
|
|
205451
205470
|
case JSONB_INT:
|
|
205452
205471
|
case JSONB_FLOAT: {
|
|
205472
|
+
if( sz==0 ) goto malformed_jsonb;
|
|
205453
205473
|
jsonAppendRaw(pOut, (const char*)&pParse->aBlob[i+n], sz);
|
|
205454
205474
|
break;
|
|
205455
205475
|
}
|
|
@@ -205458,6 +205478,7 @@ static u32 jsonTranslateBlobToText(
|
|
|
205458
205478
|
sqlite3_uint64 u = 0;
|
|
205459
205479
|
const char *zIn = (const char*)&pParse->aBlob[i+n];
|
|
205460
205480
|
int bOverflow = 0;
|
|
205481
|
+
if( sz==0 ) goto malformed_jsonb;
|
|
205461
205482
|
if( zIn[0]=='-' ){
|
|
205462
205483
|
jsonAppendChar(pOut, '-');
|
|
205463
205484
|
k++;
|
|
@@ -205480,6 +205501,7 @@ static u32 jsonTranslateBlobToText(
|
|
|
205480
205501
|
case JSONB_FLOAT5: { /* Float literal missing digits beside "." */
|
|
205481
205502
|
u32 k = 0;
|
|
205482
205503
|
const char *zIn = (const char*)&pParse->aBlob[i+n];
|
|
205504
|
+
if( sz==0 ) goto malformed_jsonb;
|
|
205483
205505
|
if( zIn[0]=='-' ){
|
|
205484
205506
|
jsonAppendChar(pOut, '-');
|
|
205485
205507
|
k++;
|
|
@@ -205593,11 +205615,12 @@ static u32 jsonTranslateBlobToText(
|
|
|
205593
205615
|
jsonAppendChar(pOut, '[');
|
|
205594
205616
|
j = i+n;
|
|
205595
205617
|
iEnd = j+sz;
|
|
205596
|
-
while( j<iEnd ){
|
|
205618
|
+
while( j<iEnd && pOut->eErr==0 ){
|
|
205597
205619
|
j = jsonTranslateBlobToText(pParse, j, pOut);
|
|
205598
205620
|
jsonAppendChar(pOut, ',');
|
|
205599
205621
|
}
|
|
205600
|
-
if(
|
|
205622
|
+
if( j>iEnd ) pOut->eErr |= JSTRING_MALFORMED;
|
|
205623
|
+
if( sz>0 ) jsonStringTrimOneChar(pOut);
|
|
205601
205624
|
jsonAppendChar(pOut, ']');
|
|
205602
205625
|
break;
|
|
205603
205626
|
}
|
|
@@ -205606,17 +205629,18 @@ static u32 jsonTranslateBlobToText(
|
|
|
205606
205629
|
jsonAppendChar(pOut, '{');
|
|
205607
205630
|
j = i+n;
|
|
205608
205631
|
iEnd = j+sz;
|
|
205609
|
-
while( j<iEnd ){
|
|
205632
|
+
while( j<iEnd && pOut->eErr==0 ){
|
|
205610
205633
|
j = jsonTranslateBlobToText(pParse, j, pOut);
|
|
205611
205634
|
jsonAppendChar(pOut, (x++ & 1) ? ',' : ':');
|
|
205612
205635
|
}
|
|
205613
|
-
if( x & 1 ) pOut->eErr |= JSTRING_MALFORMED;
|
|
205614
|
-
if( sz>0 ) pOut
|
|
205636
|
+
if( (x & 1)!=0 || j>iEnd ) pOut->eErr |= JSTRING_MALFORMED;
|
|
205637
|
+
if( sz>0 ) jsonStringTrimOneChar(pOut);
|
|
205615
205638
|
jsonAppendChar(pOut, '}');
|
|
205616
205639
|
break;
|
|
205617
205640
|
}
|
|
205618
205641
|
|
|
205619
205642
|
default: {
|
|
205643
|
+
malformed_jsonb:
|
|
205620
205644
|
pOut->eErr |= JSTRING_MALFORMED;
|
|
205621
205645
|
break;
|
|
205622
205646
|
}
|
|
@@ -206543,6 +206567,38 @@ jsonInsertIntoBlob_patherror:
|
|
|
206543
206567
|
return;
|
|
206544
206568
|
}
|
|
206545
206569
|
|
|
206570
|
+
/*
|
|
206571
|
+
** If pArg is a blob that seems like a JSONB blob, then initialize
|
|
206572
|
+
** p to point to that JSONB and return TRUE. If pArg does not seem like
|
|
206573
|
+
** a JSONB blob, then return FALSE;
|
|
206574
|
+
**
|
|
206575
|
+
** This routine is only called if it is already known that pArg is a
|
|
206576
|
+
** blob. The only open question is whether or not the blob appears
|
|
206577
|
+
** to be a JSONB blob.
|
|
206578
|
+
*/
|
|
206579
|
+
static int jsonArgIsJsonb(sqlite3_value *pArg, JsonParse *p){
|
|
206580
|
+
u32 n, sz = 0;
|
|
206581
|
+
p->aBlob = (u8*)sqlite3_value_blob(pArg);
|
|
206582
|
+
p->nBlob = (u32)sqlite3_value_bytes(pArg);
|
|
206583
|
+
if( p->nBlob==0 ){
|
|
206584
|
+
p->aBlob = 0;
|
|
206585
|
+
return 0;
|
|
206586
|
+
}
|
|
206587
|
+
if( NEVER(p->aBlob==0) ){
|
|
206588
|
+
return 0;
|
|
206589
|
+
}
|
|
206590
|
+
if( (p->aBlob[0] & 0x0f)<=JSONB_OBJECT
|
|
206591
|
+
&& (n = jsonbPayloadSize(p, 0, &sz))>0
|
|
206592
|
+
&& sz+n==p->nBlob
|
|
206593
|
+
&& ((p->aBlob[0] & 0x0f)>JSONB_FALSE || sz==0)
|
|
206594
|
+
){
|
|
206595
|
+
return 1;
|
|
206596
|
+
}
|
|
206597
|
+
p->aBlob = 0;
|
|
206598
|
+
p->nBlob = 0;
|
|
206599
|
+
return 0;
|
|
206600
|
+
}
|
|
206601
|
+
|
|
206546
206602
|
/*
|
|
206547
206603
|
** Generate a JsonParse object, containing valid JSONB in aBlob and nBlob,
|
|
206548
206604
|
** from the SQL function argument pArg. Return a pointer to the new
|
|
@@ -206599,29 +206655,24 @@ rebuild_from_cache:
|
|
|
206599
206655
|
return p;
|
|
206600
206656
|
}
|
|
206601
206657
|
if( eType==SQLITE_BLOB ){
|
|
206602
|
-
|
|
206603
|
-
|
|
206604
|
-
|
|
206605
|
-
|
|
206606
|
-
|
|
206607
|
-
}
|
|
206608
|
-
if( NEVER(p->aBlob==0) ){
|
|
206609
|
-
goto json_pfa_oom;
|
|
206610
|
-
}
|
|
206611
|
-
if( (p->aBlob[0] & 0x0f)>JSONB_OBJECT ){
|
|
206612
|
-
goto json_pfa_malformed;
|
|
206613
|
-
}
|
|
206614
|
-
n = jsonbPayloadSize(p, 0, &sz);
|
|
206615
|
-
if( n==0
|
|
206616
|
-
|| sz+n!=p->nBlob
|
|
206617
|
-
|| ((p->aBlob[0] & 0x0f)<=JSONB_FALSE && sz>0)
|
|
206618
|
-
){
|
|
206619
|
-
goto json_pfa_malformed;
|
|
206620
|
-
}
|
|
206621
|
-
if( (flgs & JSON_EDITABLE)!=0 && jsonBlobMakeEditable(p, 0)==0 ){
|
|
206622
|
-
goto json_pfa_oom;
|
|
206658
|
+
if( jsonArgIsJsonb(pArg,p) ){
|
|
206659
|
+
if( (flgs & JSON_EDITABLE)!=0 && jsonBlobMakeEditable(p, 0)==0 ){
|
|
206660
|
+
goto json_pfa_oom;
|
|
206661
|
+
}
|
|
206662
|
+
return p;
|
|
206623
206663
|
}
|
|
206624
|
-
|
|
206664
|
+
/* If the blob is not valid JSONB, fall through into trying to cast
|
|
206665
|
+
** the blob into text which is then interpreted as JSON. (tag-20240123-a)
|
|
206666
|
+
**
|
|
206667
|
+
** This goes against all historical documentation about how the SQLite
|
|
206668
|
+
** JSON functions were suppose to work. From the beginning, blob was
|
|
206669
|
+
** reserved for expansion and a blob value should have raised an error.
|
|
206670
|
+
** But it did not, due to a bug. And many applications came to depend
|
|
206671
|
+
** upon this buggy behavior, espeically when using the CLI and reading
|
|
206672
|
+
** JSON text using readfile(), which returns a blob. For this reason
|
|
206673
|
+
** we will continue to support the bug moving forward.
|
|
206674
|
+
** See for example https://sqlite.org/forum/forumpost/012136abd5292b8d
|
|
206675
|
+
*/
|
|
206625
206676
|
}
|
|
206626
206677
|
p->zJson = (char*)sqlite3_value_text(pArg);
|
|
206627
206678
|
p->nJson = sqlite3_value_bytes(pArg);
|
|
@@ -207597,12 +207648,12 @@ static void jsonValidFunc(
|
|
|
207597
207648
|
return;
|
|
207598
207649
|
}
|
|
207599
207650
|
case SQLITE_BLOB: {
|
|
207600
|
-
if(
|
|
207651
|
+
if( jsonFuncArgMightBeBinary(argv[0]) ){
|
|
207601
207652
|
if( flags & 0x04 ){
|
|
207602
207653
|
/* Superficial checking only - accomplished by the
|
|
207603
207654
|
** jsonFuncArgMightBeBinary() call above. */
|
|
207604
207655
|
res = 1;
|
|
207605
|
-
}else{
|
|
207656
|
+
}else if( flags & 0x08 ){
|
|
207606
207657
|
/* Strict checking. Check by translating BLOB->TEXT->BLOB. If
|
|
207607
207658
|
** no errors occur, call that a "strict check". */
|
|
207608
207659
|
JsonParse px;
|
|
@@ -207613,8 +207664,11 @@ static void jsonValidFunc(
|
|
|
207613
207664
|
iErr = jsonbValidityCheck(&px, 0, px.nBlob, 1);
|
|
207614
207665
|
res = iErr==0;
|
|
207615
207666
|
}
|
|
207667
|
+
break;
|
|
207616
207668
|
}
|
|
207617
|
-
|
|
207669
|
+
/* Fall through into interpreting the input as text. See note
|
|
207670
|
+
** above at tag-20240123-a. */
|
|
207671
|
+
/* no break */ deliberate_fall_through
|
|
207618
207672
|
}
|
|
207619
207673
|
default: {
|
|
207620
207674
|
JsonParse px;
|
|
@@ -207739,7 +207793,7 @@ static void jsonArrayCompute(sqlite3_context *ctx, int isFinal){
|
|
|
207739
207793
|
if( isFinal ){
|
|
207740
207794
|
if( !pStr->bStatic ) sqlite3RCStrUnref(pStr->zBuf);
|
|
207741
207795
|
}else{
|
|
207742
|
-
pStr
|
|
207796
|
+
jsonStringTrimOneChar(pStr);
|
|
207743
207797
|
}
|
|
207744
207798
|
return;
|
|
207745
207799
|
}else if( isFinal ){
|
|
@@ -207749,7 +207803,7 @@ static void jsonArrayCompute(sqlite3_context *ctx, int isFinal){
|
|
|
207749
207803
|
pStr->bStatic = 1;
|
|
207750
207804
|
}else{
|
|
207751
207805
|
sqlite3_result_text(ctx, pStr->zBuf, (int)pStr->nUsed, SQLITE_TRANSIENT);
|
|
207752
|
-
pStr
|
|
207806
|
+
jsonStringTrimOneChar(pStr);
|
|
207753
207807
|
}
|
|
207754
207808
|
}else{
|
|
207755
207809
|
sqlite3_result_text(ctx, "[]", 2, SQLITE_STATIC);
|
|
@@ -207859,7 +207913,7 @@ static void jsonObjectCompute(sqlite3_context *ctx, int isFinal){
|
|
|
207859
207913
|
if( isFinal ){
|
|
207860
207914
|
if( !pStr->bStatic ) sqlite3RCStrUnref(pStr->zBuf);
|
|
207861
207915
|
}else{
|
|
207862
|
-
pStr
|
|
207916
|
+
jsonStringTrimOneChar(pStr);
|
|
207863
207917
|
}
|
|
207864
207918
|
return;
|
|
207865
207919
|
}else if( isFinal ){
|
|
@@ -207869,7 +207923,7 @@ static void jsonObjectCompute(sqlite3_context *ctx, int isFinal){
|
|
|
207869
207923
|
pStr->bStatic = 1;
|
|
207870
207924
|
}else{
|
|
207871
207925
|
sqlite3_result_text(ctx, pStr->zBuf, (int)pStr->nUsed, SQLITE_TRANSIENT);
|
|
207872
|
-
pStr
|
|
207926
|
+
jsonStringTrimOneChar(pStr);
|
|
207873
207927
|
}
|
|
207874
207928
|
}else{
|
|
207875
207929
|
sqlite3_result_text(ctx, "{}", 2, SQLITE_STATIC);
|
|
@@ -208350,13 +208404,9 @@ static int jsonEachFilter(
|
|
|
208350
208404
|
memset(&p->sParse, 0, sizeof(p->sParse));
|
|
208351
208405
|
p->sParse.nJPRef = 1;
|
|
208352
208406
|
p->sParse.db = p->db;
|
|
208353
|
-
if(
|
|
208354
|
-
|
|
208355
|
-
|
|
208356
|
-
p->sParse.aBlob = (u8*)sqlite3_value_blob(argv[0]);
|
|
208357
|
-
}else{
|
|
208358
|
-
goto json_each_malformed_input;
|
|
208359
|
-
}
|
|
208407
|
+
if( jsonFuncArgMightBeBinary(argv[0]) ){
|
|
208408
|
+
p->sParse.nBlob = sqlite3_value_bytes(argv[0]);
|
|
208409
|
+
p->sParse.aBlob = (u8*)sqlite3_value_blob(argv[0]);
|
|
208360
208410
|
}else{
|
|
208361
208411
|
p->sParse.zJson = (char*)sqlite3_value_text(argv[0]);
|
|
208362
208412
|
p->sParse.nJson = sqlite3_value_bytes(argv[0]);
|
|
@@ -250665,7 +250715,7 @@ static void fts5SourceIdFunc(
|
|
|
250665
250715
|
){
|
|
250666
250716
|
assert( nArg==0 );
|
|
250667
250717
|
UNUSED_PARAM2(nArg, apUnused);
|
|
250668
|
-
sqlite3_result_text(pCtx, "fts5: 2024-01-
|
|
250718
|
+
sqlite3_result_text(pCtx, "fts5: 2024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257cc467a", -1, SQLITE_TRANSIENT);
|
|
250669
250719
|
}
|
|
250670
250720
|
|
|
250671
250721
|
/*
|
|
@@ -250696,27 +250746,21 @@ static int fts5IntegrityMethod(
|
|
|
250696
250746
|
char **pzErr /* Write error message here */
|
|
250697
250747
|
){
|
|
250698
250748
|
Fts5FullTable *pTab = (Fts5FullTable*)pVtab;
|
|
250699
|
-
Fts5Config *pConfig = pTab->p.pConfig;
|
|
250700
|
-
char *zSql;
|
|
250701
|
-
char *zErr = 0;
|
|
250702
250749
|
int rc;
|
|
250750
|
+
|
|
250703
250751
|
assert( pzErr!=0 && *pzErr==0 );
|
|
250704
250752
|
UNUSED_PARAM(isQuick);
|
|
250705
|
-
|
|
250706
|
-
"INSERT INTO \"%w\".\"%w\"(\"%w\") VALUES('integrity-check');",
|
|
250707
|
-
zSchema, zTabname, pConfig->zName);
|
|
250708
|
-
if( zSql==0 ) return SQLITE_NOMEM;
|
|
250709
|
-
rc = sqlite3_exec(pConfig->db, zSql, 0, 0, &zErr);
|
|
250710
|
-
sqlite3_free(zSql);
|
|
250753
|
+
rc = sqlite3Fts5StorageIntegrity(pTab->pStorage, 0);
|
|
250711
250754
|
if( (rc&0xff)==SQLITE_CORRUPT ){
|
|
250712
250755
|
*pzErr = sqlite3_mprintf("malformed inverted index for FTS5 table %s.%s",
|
|
250713
250756
|
zSchema, zTabname);
|
|
250714
250757
|
}else if( rc!=SQLITE_OK ){
|
|
250715
250758
|
*pzErr = sqlite3_mprintf("unable to validate the inverted index for"
|
|
250716
250759
|
" FTS5 table %s.%s: %s",
|
|
250717
|
-
zSchema, zTabname,
|
|
250760
|
+
zSchema, zTabname, sqlite3_errstr(rc));
|
|
250718
250761
|
}
|
|
250719
|
-
|
|
250762
|
+
sqlite3Fts5IndexCloseReader(pTab->p.pIndex);
|
|
250763
|
+
|
|
250720
250764
|
return SQLITE_OK;
|
|
250721
250765
|
}
|
|
250722
250766
|
|
|
@@ -256018,9 +256062,9 @@ SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
|
|
|
256018
256062
|
|
|
256019
256063
|
#define SQLITE3MC_VERSION_MAJOR 1
|
|
256020
256064
|
#define SQLITE3MC_VERSION_MINOR 8
|
|
256021
|
-
#define SQLITE3MC_VERSION_RELEASE
|
|
256065
|
+
#define SQLITE3MC_VERSION_RELEASE 3
|
|
256022
256066
|
#define SQLITE3MC_VERSION_SUBRELEASE 0
|
|
256023
|
-
#define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 1.8.
|
|
256067
|
+
#define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 1.8.3"
|
|
256024
256068
|
|
|
256025
256069
|
#endif /* SQLITE3MC_VERSION_H_ */
|
|
256026
256070
|
/*** End of #include "sqlite3mc_version.h" ***/
|
|
@@ -256179,9 +256223,9 @@ extern "C" {
|
|
|
256179
256223
|
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
|
256180
256224
|
** [sqlite_version()] and [sqlite_source_id()].
|
|
256181
256225
|
*/
|
|
256182
|
-
#define SQLITE_VERSION "3.45.
|
|
256183
|
-
#define SQLITE_VERSION_NUMBER
|
|
256184
|
-
#define SQLITE_SOURCE_ID "2024-01-
|
|
256226
|
+
#define SQLITE_VERSION "3.45.1"
|
|
256227
|
+
#define SQLITE_VERSION_NUMBER 3045001
|
|
256228
|
+
#define SQLITE_SOURCE_ID "2024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257cc467a"
|
|
256185
256229
|
|
|
256186
256230
|
/*
|
|
256187
256231
|
** CAPI3REF: Run-Time Library Version Numbers
|
|
@@ -281379,7 +281423,7 @@ sqlite3mcBtreeSetPageSize(Btree* p, int pageSize, int nReserve, int iFix)
|
|
|
281379
281423
|
** Change 4: Call sqlite3mcBtreeSetPageSize instead of sqlite3BtreeSetPageSize for main database
|
|
281380
281424
|
** (sqlite3mcBtreeSetPageSize allows to reduce the number of reserved bytes)
|
|
281381
281425
|
**
|
|
281382
|
-
** This code is generated by the script rekeyvacuum.sh from SQLite version 3.45.
|
|
281426
|
+
** This code is generated by the script rekeyvacuum.sh from SQLite version 3.45.1 amalgamation.
|
|
281383
281427
|
*/
|
|
281384
281428
|
SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3mcRunVacuumForRekey(
|
|
281385
281429
|
char **pzErrMsg, /* Write error message here */
|
package/deps/sqlite3/sqlite3.h
CHANGED
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
|
|
32
32
|
#define SQLITE3MC_VERSION_MAJOR 1
|
|
33
33
|
#define SQLITE3MC_VERSION_MINOR 8
|
|
34
|
-
#define SQLITE3MC_VERSION_RELEASE
|
|
34
|
+
#define SQLITE3MC_VERSION_RELEASE 3
|
|
35
35
|
#define SQLITE3MC_VERSION_SUBRELEASE 0
|
|
36
|
-
#define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 1.8.
|
|
36
|
+
#define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 1.8.3"
|
|
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.45.
|
|
196
|
-
#define SQLITE_VERSION_NUMBER
|
|
197
|
-
#define SQLITE_SOURCE_ID "2024-01-
|
|
195
|
+
#define SQLITE_VERSION "3.45.1"
|
|
196
|
+
#define SQLITE_VERSION_NUMBER 3045001
|
|
197
|
+
#define SQLITE_SOURCE_ID "2024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257cc467a"
|
|
198
198
|
|
|
199
199
|
/*
|
|
200
200
|
** CAPI3REF: Run-Time Library Version Numbers
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "better-sqlite3-multiple-ciphers",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.4.1",
|
|
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>",
|