better-sqlite3-multiple-ciphers 8.6.0 → 8.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 CHANGED
@@ -17,16 +17,16 @@ 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** - [`8.6.0`](https://github.com/m4heshd/better-sqlite3-multiple-ciphers/releases/tag/v8.6.0)
21
- - **better-sqlite3** - [`8.6.0`](https://github.com/JoshuaWise/better-sqlite3/releases/tag/v8.6.0)
22
- - **SQLite** - [`3.43.0`](https://www.sqlite.org/releaselog/3_43_0.html)
23
- - **SQLite3 Multiple Ciphers** - [`1.6.4`](https://github.com/utelle/SQLite3MultipleCiphers/releases/tag/v1.6.4)
20
+ - **better-sqlite3-multiple-ciphers** - [`8.7.0`](https://github.com/m4heshd/better-sqlite3-multiple-ciphers/releases/tag/v8.7.0)
21
+ - **better-sqlite3** - [`8.7.0`](https://github.com/JoshuaWise/better-sqlite3/releases/tag/v8.7.0)
22
+ - **SQLite** - [`3.43.1`](https://www.sqlite.org/releaselog/3_43_1.html)
23
+ - **SQLite3 Multiple Ciphers** - [`1.6.5`](https://github.com/utelle/SQLite3MultipleCiphers/releases/tag/v1.6.5)
24
24
 
25
25
  - ### Beta
26
- - **better-sqlite3-multiple-ciphers** - [`8.5.3-beta.0`](https://github.com/m4heshd/better-sqlite3-multiple-ciphers/releases/tag/v8.5.3-beta.0)
27
- - **better-sqlite3** - [`8.5.2`](https://github.com/JoshuaWise/better-sqlite3/releases/tag/v8.5.2)
28
- - **SQLite** - [`3.43.0`](https://www.sqlite.org/releaselog/3_43_0.html)
29
- - **SQLite3 Multiple Ciphers** - [`1.6.4`](https://github.com/utelle/SQLite3MultipleCiphers/releases/tag/v1.6.4)
26
+ - **better-sqlite3-multiple-ciphers** - [`v8.6.1-beta.0`](https://github.com/m4heshd/better-sqlite3-multiple-ciphers/releases/tag/v8.6.1-beta.0)
27
+ - **better-sqlite3** - [`8.6.0`](https://github.com/JoshuaWise/better-sqlite3/releases/tag/v8.6.0)
28
+ - **SQLite** - [`3.43.1`](https://www.sqlite.org/releaselog/3_43_1.html)
29
+ - **SQLite3 Multiple Ciphers** - [`1.6.5`](https://github.com/utelle/SQLite3MultipleCiphers/releases/tag/v1.6.5)
30
30
 
31
31
  ## Help this project stay strong! 💪
32
32
 
package/deps/setup.ps1 CHANGED
@@ -2,7 +2,7 @@
2
2
  $ErrorActionPreference = "Stop"
3
3
 
4
4
  # SQLite Info
5
- $SQLITEMC_VER = "v1.6.4"
5
+ $SQLITEMC_VER = "v1.6.5"
6
6
  $API_URL = "https://api.github.com/repos/utelle/SQLite3MultipleCiphers/releases/tags/" + $SQLITEMC_VER
7
7
 
8
8
  # Paths
@@ -92,7 +92,7 @@ extern SQLITE_API LPWSTR sqlite3_win32_utf8_to_unicode(const char*);
92
92
  /*** Begin of #include "sqlite3patched.c" ***/
93
93
  /******************************************************************************
94
94
  ** This file is an amalgamation of many separate C source files from SQLite
95
- ** version 3.43.0. By combining all the individual C code files into this
95
+ ** version 3.43.1. By combining all the individual C code files into this
96
96
  ** single large file, the entire code can be compiled as a single translation
97
97
  ** unit. This allows many compilers to do optimizations that would not be
98
98
  ** possible if the files were compiled separately. Performance improvements
@@ -110,7 +110,7 @@ extern SQLITE_API LPWSTR sqlite3_win32_utf8_to_unicode(const char*);
110
110
  ** separate file. This file contains only code for the core SQLite library.
111
111
  **
112
112
  ** The content in this amalgamation comes from Fossil check-in
113
- ** f80b798b3f4b81a7bb4233c58294edd0f11.
113
+ ** d3a40c05c49e1a49264912b1a05bc2143ac.
114
114
  */
115
115
  #define SQLITE_CORE 1
116
116
  #define SQLITE_AMALGAMATION 1
@@ -551,9 +551,9 @@ extern "C" {
551
551
  ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
552
552
  ** [sqlite_version()] and [sqlite_source_id()].
553
553
  */
554
- #define SQLITE_VERSION "3.43.0"
555
- #define SQLITE_VERSION_NUMBER 3043000
556
- #define SQLITE_SOURCE_ID "2023-08-24 12:36:59 0f80b798b3f4b81a7bb4233c58294edd0f1156f36b6ecf5ab8e83631d468778c"
554
+ #define SQLITE_VERSION "3.43.1"
555
+ #define SQLITE_VERSION_NUMBER 3043001
556
+ #define SQLITE_SOURCE_ID "2023-09-11 12:01:27 2d3a40c05c49e1a49264912b1a05bc2143ac0e7c3df588276ce80a4cbc9bd1b0"
557
557
 
558
558
  /*
559
559
  ** CAPI3REF: Run-Time Library Version Numbers
@@ -128570,8 +128570,10 @@ static void sumFinalize(sqlite3_context *context){
128570
128570
  if( p->approx ){
128571
128571
  if( p->ovrfl ){
128572
128572
  sqlite3_result_error(context,"integer overflow",-1);
128573
- }else{
128573
+ }else if( !sqlite3IsNaN(p->rErr) ){
128574
128574
  sqlite3_result_double(context, p->rSum+p->rErr);
128575
+ }else{
128576
+ sqlite3_result_double(context, p->rSum);
128575
128577
  }
128576
128578
  }else{
128577
128579
  sqlite3_result_int64(context, p->iSum);
@@ -128584,7 +128586,8 @@ static void avgFinalize(sqlite3_context *context){
128584
128586
  if( p && p->cnt>0 ){
128585
128587
  double r;
128586
128588
  if( p->approx ){
128587
- r = p->rSum+p->rErr;
128589
+ r = p->rSum;
128590
+ if( !sqlite3IsNaN(p->rErr) ) r += p->rErr;
128588
128591
  }else{
128589
128592
  r = (double)(p->iSum);
128590
128593
  }
@@ -128597,7 +128600,8 @@ static void totalFinalize(sqlite3_context *context){
128597
128600
  p = sqlite3_aggregate_context(context, 0);
128598
128601
  if( p ){
128599
128602
  if( p->approx ){
128600
- r = p->rSum+p->rErr;
128603
+ r = p->rSum;
128604
+ if( !sqlite3IsNaN(p->rErr) ) r += p->rErr;
128601
128605
  }else{
128602
128606
  r = (double)(p->iSum);
128603
128607
  }
@@ -145800,12 +145804,12 @@ static int disableUnusedSubqueryResultColumns(SrcItem *pItem){
145800
145804
  assert( pItem->pSelect!=0 );
145801
145805
  pSub = pItem->pSelect;
145802
145806
  assert( pSub->pEList->nExpr==pTab->nCol );
145803
- if( (pSub->selFlags & (SF_Distinct|SF_Aggregate))!=0 ){
145804
- testcase( pSub->selFlags & SF_Distinct );
145805
- testcase( pSub->selFlags & SF_Aggregate );
145806
- return 0;
145807
- }
145808
145807
  for(pX=pSub; pX; pX=pX->pPrior){
145808
+ if( (pX->selFlags & (SF_Distinct|SF_Aggregate))!=0 ){
145809
+ testcase( pX->selFlags & SF_Distinct );
145810
+ testcase( pX->selFlags & SF_Aggregate );
145811
+ return 0;
145812
+ }
145809
145813
  if( pX->pPrior && pX->op!=TK_ALL ){
145810
145814
  /* This optimization does not work for compound subqueries that
145811
145815
  ** use UNION, INTERSECT, or EXCEPT. Only UNION ALL is allowed. */
@@ -198201,7 +198205,7 @@ static u64 fts3ChecksumIndex(
198201
198205
  int rc;
198202
198206
  u64 cksum = 0;
198203
198207
 
198204
- assert( *pRc==SQLITE_OK );
198208
+ if( *pRc ) return 0;
198205
198209
 
198206
198210
  memset(&filter, 0, sizeof(filter));
198207
198211
  memset(&csr, 0, sizeof(csr));
@@ -203831,7 +203835,9 @@ static void jsonArrayLengthFunc(
203831
203835
  }
203832
203836
  if( pNode->eType==JSON_ARRAY ){
203833
203837
  while( 1 /*exit-by-break*/ ){
203834
- for(i=1; i<=pNode->n; n++){
203838
+ i = 1;
203839
+ while( i<=pNode->n ){
203840
+ if( (pNode[i].jnFlags & JNODE_REMOVE)==0 ) n++;
203835
203841
  i += jsonNodeSize(&pNode[i]);
203836
203842
  }
203837
203843
  if( (pNode->jnFlags & JNODE_APPEND)==0 ) break;
@@ -223103,15 +223109,19 @@ static int sessionReadRecord(
223103
223109
  }
223104
223110
  }
223105
223111
  if( eType==SQLITE_INTEGER || eType==SQLITE_FLOAT ){
223106
- sqlite3_int64 v = sessionGetI64(aVal);
223107
- if( eType==SQLITE_INTEGER ){
223108
- sqlite3VdbeMemSetInt64(apOut[i], v);
223112
+ if( (pIn->nData-pIn->iNext)<8 ){
223113
+ rc = SQLITE_CORRUPT_BKPT;
223109
223114
  }else{
223110
- double d;
223111
- memcpy(&d, &v, 8);
223112
- sqlite3VdbeMemSetDouble(apOut[i], d);
223115
+ sqlite3_int64 v = sessionGetI64(aVal);
223116
+ if( eType==SQLITE_INTEGER ){
223117
+ sqlite3VdbeMemSetInt64(apOut[i], v);
223118
+ }else{
223119
+ double d;
223120
+ memcpy(&d, &v, 8);
223121
+ sqlite3VdbeMemSetDouble(apOut[i], d);
223122
+ }
223123
+ pIn->iNext += 8;
223113
223124
  }
223114
- pIn->iNext += 8;
223115
223125
  }
223116
223126
  }
223117
223127
  }
@@ -239937,80 +239947,79 @@ static void fts5DoSecureDelete(
239937
239947
  }
239938
239948
  }
239939
239949
  }else if( iStart==4 ){
239940
- int iPgno;
239941
-
239942
- assert_nc( pSeg->iLeafPgno>pSeg->iTermLeafPgno );
239943
- /* The entry being removed may be the only position list in
239944
- ** its doclist. */
239945
- for(iPgno=pSeg->iLeafPgno-1; iPgno>pSeg->iTermLeafPgno; iPgno-- ){
239946
- Fts5Data *pPg = fts5DataRead(p, FTS5_SEGMENT_ROWID(iSegid, iPgno));
239947
- int bEmpty = (pPg && pPg->nn==4);
239948
- fts5DataRelease(pPg);
239949
- if( bEmpty==0 ) break;
239950
- }
239951
-
239952
- if( iPgno==pSeg->iTermLeafPgno ){
239953
- i64 iId = FTS5_SEGMENT_ROWID(iSegid, pSeg->iTermLeafPgno);
239954
- Fts5Data *pTerm = fts5DataRead(p, iId);
239955
- if( pTerm && pTerm->szLeaf==pSeg->iTermLeafOffset ){
239956
- u8 *aTermIdx = &pTerm->p[pTerm->szLeaf];
239957
- int nTermIdx = pTerm->nn - pTerm->szLeaf;
239958
- int iTermIdx = 0;
239959
- int iTermOff = 0;
239960
-
239961
- while( 1 ){
239962
- u32 iVal = 0;
239963
- int nByte = fts5GetVarint32(&aTermIdx[iTermIdx], iVal);
239964
- iTermOff += iVal;
239965
- if( (iTermIdx+nByte)>=nTermIdx ) break;
239966
- iTermIdx += nByte;
239967
- }
239968
- nTermIdx = iTermIdx;
239950
+ int iPgno;
239951
+
239952
+ assert_nc( pSeg->iLeafPgno>pSeg->iTermLeafPgno );
239953
+ /* The entry being removed may be the only position list in
239954
+ ** its doclist. */
239955
+ for(iPgno=pSeg->iLeafPgno-1; iPgno>pSeg->iTermLeafPgno; iPgno-- ){
239956
+ Fts5Data *pPg = fts5DataRead(p, FTS5_SEGMENT_ROWID(iSegid, iPgno));
239957
+ int bEmpty = (pPg && pPg->nn==4);
239958
+ fts5DataRelease(pPg);
239959
+ if( bEmpty==0 ) break;
239960
+ }
239969
239961
 
239970
- memmove(&pTerm->p[iTermOff], &pTerm->p[pTerm->szLeaf], nTermIdx);
239971
- fts5PutU16(&pTerm->p[2], iTermOff);
239962
+ if( iPgno==pSeg->iTermLeafPgno ){
239963
+ i64 iId = FTS5_SEGMENT_ROWID(iSegid, pSeg->iTermLeafPgno);
239964
+ Fts5Data *pTerm = fts5DataRead(p, iId);
239965
+ if( pTerm && pTerm->szLeaf==pSeg->iTermLeafOffset ){
239966
+ u8 *aTermIdx = &pTerm->p[pTerm->szLeaf];
239967
+ int nTermIdx = pTerm->nn - pTerm->szLeaf;
239968
+ int iTermIdx = 0;
239969
+ int iTermOff = 0;
239972
239970
 
239973
- fts5DataWrite(p, iId, pTerm->p, iTermOff+nTermIdx);
239974
- if( nTermIdx==0 ){
239975
- fts5SecureDeleteIdxEntry(p, iSegid, pSeg->iTermLeafPgno);
239976
- }
239971
+ while( 1 ){
239972
+ u32 iVal = 0;
239973
+ int nByte = fts5GetVarint32(&aTermIdx[iTermIdx], iVal);
239974
+ iTermOff += iVal;
239975
+ if( (iTermIdx+nByte)>=nTermIdx ) break;
239976
+ iTermIdx += nByte;
239977
239977
  }
239978
- fts5DataRelease(pTerm);
239979
- }
239980
- }
239978
+ nTermIdx = iTermIdx;
239981
239979
 
239982
- if( p->rc==SQLITE_OK ){
239983
- const int nMove = nPg - iNextOff;
239984
- int nShift = 0;
239985
-
239986
- memmove(&aPg[iOff], &aPg[iNextOff], nMove);
239987
- iPgIdx -= (iNextOff - iOff);
239988
- nPg = iPgIdx;
239989
- fts5PutU16(&aPg[2], iPgIdx);
239990
-
239991
- nShift = iNextOff - iOff;
239992
- for(iIdx=0, iKeyOff=0, iPrevKeyOff=0; iIdx<nIdx; /* no-op */){
239993
- u32 iVal = 0;
239994
- iIdx += fts5GetVarint32(&aIdx[iIdx], iVal);
239995
- iKeyOff += iVal;
239996
- if( iKeyOff!=iDelKeyOff ){
239997
- if( iKeyOff>iOff ){
239998
- iKeyOff -= nShift;
239999
- nShift = 0;
240000
- }
240001
- nPg += sqlite3Fts5PutVarint(&aPg[nPg], iKeyOff - iPrevKeyOff);
240002
- iPrevKeyOff = iKeyOff;
239980
+ memmove(&pTerm->p[iTermOff], &pTerm->p[pTerm->szLeaf], nTermIdx);
239981
+ fts5PutU16(&pTerm->p[2], iTermOff);
239982
+
239983
+ fts5DataWrite(p, iId, pTerm->p, iTermOff+nTermIdx);
239984
+ if( nTermIdx==0 ){
239985
+ fts5SecureDeleteIdxEntry(p, iSegid, pSeg->iTermLeafPgno);
240003
239986
  }
240004
239987
  }
239988
+ fts5DataRelease(pTerm);
239989
+ }
239990
+ }
239991
+
239992
+ if( p->rc==SQLITE_OK ){
239993
+ const int nMove = nPg - iNextOff; /* Number of bytes to move */
239994
+ int nShift = iNextOff - iOff; /* Distance to move them */
240005
239995
 
240006
- if( iPgIdx==nPg && nIdx>0 && pSeg->iLeafPgno!=1 ){
240007
- fts5SecureDeleteIdxEntry(p, iSegid, pSeg->iLeafPgno);
239996
+ int iPrevKeyOut = 0;
239997
+ int iKeyIn = 0;
239998
+
239999
+ memmove(&aPg[iOff], &aPg[iNextOff], nMove);
240000
+ iPgIdx -= nShift;
240001
+ nPg = iPgIdx;
240002
+ fts5PutU16(&aPg[2], iPgIdx);
240003
+
240004
+ for(iIdx=0; iIdx<nIdx; /* no-op */){
240005
+ u32 iVal = 0;
240006
+ iIdx += fts5GetVarint32(&aIdx[iIdx], iVal);
240007
+ iKeyIn += iVal;
240008
+ if( iKeyIn!=iDelKeyOff ){
240009
+ int iKeyOut = (iKeyIn - (iKeyIn>iOff ? nShift : 0));
240010
+ nPg += sqlite3Fts5PutVarint(&aPg[nPg], iKeyOut - iPrevKeyOut);
240011
+ iPrevKeyOut = iKeyOut;
240008
240012
  }
240013
+ }
240009
240014
 
240010
- assert_nc( nPg>4 || fts5GetU16(aPg)==0 );
240011
- fts5DataWrite(p, FTS5_SEGMENT_ROWID(iSegid,pSeg->iLeafPgno), aPg,nPg);
240015
+ if( iPgIdx==nPg && nIdx>0 && pSeg->iLeafPgno!=1 ){
240016
+ fts5SecureDeleteIdxEntry(p, iSegid, pSeg->iLeafPgno);
240012
240017
  }
240013
- sqlite3_free(aIdx);
240018
+
240019
+ assert_nc( nPg>4 || fts5GetU16(aPg)==0 );
240020
+ fts5DataWrite(p, FTS5_SEGMENT_ROWID(iSegid,pSeg->iLeafPgno), aPg, nPg);
240021
+ }
240022
+ sqlite3_free(aIdx);
240014
240023
  }
240015
240024
 
240016
240025
  /*
@@ -245862,7 +245871,7 @@ static void fts5SourceIdFunc(
245862
245871
  ){
245863
245872
  assert( nArg==0 );
245864
245873
  UNUSED_PARAM2(nArg, apUnused);
245865
- sqlite3_result_text(pCtx, "fts5: 2023-08-24 12:36:59 0f80b798b3f4b81a7bb4233c58294edd0f1156f36b6ecf5ab8e83631d468778c", -1, SQLITE_TRANSIENT);
245874
+ sqlite3_result_text(pCtx, "fts5: 2023-09-11 12:01:27 2d3a40c05c49e1a49264912b1a05bc2143ac0e7c3df588276ce80a4cbc9bd1b0", -1, SQLITE_TRANSIENT);
245866
245875
  }
245867
245876
 
245868
245877
  /*
@@ -251120,9 +251129,9 @@ SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
251120
251129
 
251121
251130
  #define SQLITE3MC_VERSION_MAJOR 1
251122
251131
  #define SQLITE3MC_VERSION_MINOR 6
251123
- #define SQLITE3MC_VERSION_RELEASE 4
251132
+ #define SQLITE3MC_VERSION_RELEASE 5
251124
251133
  #define SQLITE3MC_VERSION_SUBRELEASE 0
251125
- #define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 1.6.4"
251134
+ #define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 1.6.5"
251126
251135
 
251127
251136
  #endif /* SQLITE3MC_VERSION_H_ */
251128
251137
  /*** End of #include "sqlite3mc_version.h" ***/
@@ -251281,9 +251290,9 @@ extern "C" {
251281
251290
  ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
251282
251291
  ** [sqlite_version()] and [sqlite_source_id()].
251283
251292
  */
251284
- #define SQLITE_VERSION "3.43.0"
251285
- #define SQLITE_VERSION_NUMBER 3043000
251286
- #define SQLITE_SOURCE_ID "2023-08-24 12:36:59 0f80b798b3f4b81a7bb4233c58294edd0f1156f36b6ecf5ab8e83631d468778c"
251293
+ #define SQLITE_VERSION "3.43.1"
251294
+ #define SQLITE_VERSION_NUMBER 3043001
251295
+ #define SQLITE_SOURCE_ID "2023-09-11 12:01:27 2d3a40c05c49e1a49264912b1a05bc2143ac0e7c3df588276ce80a4cbc9bd1b0"
251287
251296
 
251288
251297
  /*
251289
251298
  ** CAPI3REF: Run-Time Library Version Numbers
@@ -274560,7 +274569,7 @@ sqlite3mcBtreeSetPageSize(Btree* p, int pageSize, int nReserve, int iFix)
274560
274569
  ** Change 4: Call sqlite3mcBtreeSetPageSize instead of sqlite3BtreeSetPageSize for main database
274561
274570
  ** (sqlite3mcBtreeSetPageSize allows to reduce the number of reserved bytes)
274562
274571
  **
274563
- ** This code is generated by the script rekeyvacuum.sh from SQLite version 3.43.0 amalgamation.
274572
+ ** This code is generated by the script rekeyvacuum.sh from SQLite version 3.43.1 amalgamation.
274564
274573
  */
274565
274574
  SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3mcRunVacuumForRekey(
274566
274575
  char **pzErrMsg, /* Write error message here */
@@ -31,9 +31,9 @@
31
31
 
32
32
  #define SQLITE3MC_VERSION_MAJOR 1
33
33
  #define SQLITE3MC_VERSION_MINOR 6
34
- #define SQLITE3MC_VERSION_RELEASE 4
34
+ #define SQLITE3MC_VERSION_RELEASE 5
35
35
  #define SQLITE3MC_VERSION_SUBRELEASE 0
36
- #define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 1.6.4"
36
+ #define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 1.6.5"
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.43.0"
196
- #define SQLITE_VERSION_NUMBER 3043000
197
- #define SQLITE_SOURCE_ID "2023-08-24 12:36:59 0f80b798b3f4b81a7bb4233c58294edd0f1156f36b6ecf5ab8e83631d468778c"
195
+ #define SQLITE_VERSION "3.43.1"
196
+ #define SQLITE_VERSION_NUMBER 3043001
197
+ #define SQLITE_SOURCE_ID "2023-09-11 12:01:27 2d3a40c05c49e1a49264912b1a05bc2143ac0e7c3df588276ce80a4cbc9bd1b0"
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": "8.6.0",
3
+ "version": "8.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>",