better-sqlite3-multiple-ciphers 12.4.6 → 12.6.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,10 +17,10 @@ The fastest and simplest library for SQLite in Node.js. This particular fork sup
17
17
  ## Current versions
18
18
 
19
19
  - ### Stable
20
- - **better-sqlite3-multiple-ciphers** - [`12.4.6`](https://github.com/m4heshd/better-sqlite3-multiple-ciphers/releases/tag/v12.4.6)
21
- - **better-sqlite3** - [`12.4.6`](https://github.com/JoshuaWise/better-sqlite3/releases/tag/v12.4.6)
22
- - **SQLite** - [`3.51.0`](https://www.sqlite.org/releaselog/3_51_0.html)
23
- - **SQLite3 Multiple Ciphers** - [`2.2.5`](https://github.com/utelle/SQLite3MultipleCiphers/releases/tag/v2.2.5)
20
+ - **better-sqlite3-multiple-ciphers** - [`12.6.0`](https://github.com/m4heshd/better-sqlite3-multiple-ciphers/releases/tag/v12.6.0)
21
+ - **better-sqlite3** - [`12.6.0`](https://github.com/JoshuaWise/better-sqlite3/releases/tag/v12.6.0)
22
+ - **SQLite** - [`3.51.2`](https://www.sqlite.org/releaselog/3_51_2.html)
23
+ - **SQLite3 Multiple Ciphers** - [`2.2.7`](https://github.com/utelle/SQLite3MultipleCiphers/releases/tag/v2.2.7)
24
24
 
25
25
  - ### Beta
26
26
  - **better-sqlite3-multiple-ciphers** - [`11.0.0-beta.0`](https://github.com/m4heshd/better-sqlite3-multiple-ciphers/releases/tag/v11.0.0-beta.0)
@@ -123,7 +123,7 @@ SQLITE_API LPWSTR sqlite3_win32_utf8_to_unicode(const char*);
123
123
  /*** Begin of #include "sqlite3patched.c" ***/
124
124
  /******************************************************************************
125
125
  ** This file is an amalgamation of many separate C source files from SQLite
126
- ** version 3.51.0. By combining all the individual C code files into this
126
+ ** version 3.51.2. By combining all the individual C code files into this
127
127
  ** single large file, the entire code can be compiled as a single translation
128
128
  ** unit. This allows many compilers to do optimizations that would not be
129
129
  ** possible if the files were compiled separately. Performance improvements
@@ -141,7 +141,7 @@ SQLITE_API LPWSTR sqlite3_win32_utf8_to_unicode(const char*);
141
141
  ** separate file. This file contains only code for the core SQLite library.
142
142
  **
143
143
  ** The content in this amalgamation comes from Fossil check-in
144
- ** fb2c931ae597f8d00a37574ff67aeed3eced with changes in files:
144
+ ** b270f8339eb13b504d0b2ba154ebca966b7d with changes in files:
145
145
  **
146
146
  **
147
147
  */
@@ -591,12 +591,12 @@ extern "C" {
591
591
  ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
592
592
  ** [sqlite_version()] and [sqlite_source_id()].
593
593
  */
594
- #define SQLITE_VERSION "3.51.0"
595
- #define SQLITE_VERSION_NUMBER 3051000
596
- #define SQLITE_SOURCE_ID "2025-11-04 19:38:17 fb2c931ae597f8d00a37574ff67aeed3eced4e5547f9120744a-experimental"
597
- #define SQLITE_SCM_BRANCH "unknown"
598
- #define SQLITE_SCM_TAGS "unknown"
599
- #define SQLITE_SCM_DATETIME "2025-11-04T19:38:17.314Z"
594
+ #define SQLITE_VERSION "3.51.2"
595
+ #define SQLITE_VERSION_NUMBER 3051002
596
+ #define SQLITE_SOURCE_ID "2026-01-09 17:27:48 b270f8339eb13b504d0b2ba154ebca966b7dde08e40c3ed7d559749818cb2075"
597
+ #define SQLITE_SCM_BRANCH "branch-3.51"
598
+ #define SQLITE_SCM_TAGS "release version-3.51.2"
599
+ #define SQLITE_SCM_DATETIME "2026-01-09T17:27:48.405Z"
600
600
 
601
601
  /*
602
602
  ** CAPI3REF: Run-Time Library Version Numbers
@@ -10871,7 +10871,7 @@ SQLITE_API int sqlite3_vtab_in(sqlite3_index_info*, int iCons, int bHandle);
10871
10871
  **   ){
10872
10872
  **   // do something with pVal
10873
10873
  **   }
10874
- **   if( rc!=SQLITE_OK ){
10874
+ **   if( rc!=SQLITE_DONE ){
10875
10875
  **   // an error has occurred
10876
10876
  **   }
10877
10877
  ** </pre></blockquote>)^
@@ -38148,6 +38148,7 @@ SQLITE_PRIVATE void *sqlite3HashInsert(Hash *pH, const char *pKey, void *data){
38148
38148
  return 0;
38149
38149
  }
38150
38150
 
38151
+
38151
38152
  /************** End of hash.c ************************************************/
38152
38153
  /************** Begin file opcodes.c *****************************************/
38153
38154
  /* Automatically generated. Do not edit */
@@ -41375,12 +41376,18 @@ static int unixLock(sqlite3_file *id, int eFileLock){
41375
41376
  pInode->nLock++;
41376
41377
  pInode->nShared = 1;
41377
41378
  }
41378
- }else if( (eFileLock==EXCLUSIVE_LOCK && pInode->nShared>1)
41379
- || unixIsSharingShmNode(pFile)
41380
- ){
41379
+ }else if( eFileLock==EXCLUSIVE_LOCK && pInode->nShared>1 ){
41381
41380
  /* We are trying for an exclusive lock but another thread in this
41382
41381
  ** same process is still holding a shared lock. */
41383
41382
  rc = SQLITE_BUSY;
41383
+ }else if( unixIsSharingShmNode(pFile) ){
41384
+ /* We are in WAL mode and attempting to delete the SHM and WAL
41385
+ ** files due to closing the connection or changing out of WAL mode,
41386
+ ** but another process still holds locks on the SHM file, thus
41387
+ ** indicating that database locks have been broken, perhaps due
41388
+ ** to a rogue close(open(dbFile)) or similar.
41389
+ */
41390
+ rc = SQLITE_BUSY;
41384
41391
  }else{
41385
41392
  /* The request was for a RESERVED or EXCLUSIVE lock. It is
41386
41393
  ** assumed that there is a SHARED or greater lock on the file
@@ -44019,26 +44026,21 @@ static int unixFcntlExternalReader(unixFile *pFile, int *piOut){
44019
44026
  ** still not a disaster.
44020
44027
  */
44021
44028
  static int unixIsSharingShmNode(unixFile *pFile){
44022
- int rc;
44023
44029
  unixShmNode *pShmNode;
44030
+ struct flock lock;
44024
44031
  if( pFile->pShm==0 ) return 0;
44025
44032
  if( pFile->ctrlFlags & UNIXFILE_EXCL ) return 0;
44026
44033
  pShmNode = pFile->pShm->pShmNode;
44027
- rc = 1;
44028
- unixEnterMutex();
44029
- if( ALWAYS(pShmNode->nRef==1) ){
44030
- struct flock lock;
44031
- lock.l_whence = SEEK_SET;
44032
- lock.l_start = UNIX_SHM_DMS;
44033
- lock.l_len = 1;
44034
- lock.l_type = F_WRLCK;
44035
- osFcntl(pShmNode->hShm, F_GETLK, &lock);
44036
- if( lock.l_type==F_UNLCK ){
44037
- rc = 0;
44038
- }
44039
- }
44040
- unixLeaveMutex();
44041
- return rc;
44034
+ #if SQLITE_ATOMIC_INTRINSICS
44035
+ assert( AtomicLoad(&pShmNode->nRef)==1 );
44036
+ #endif
44037
+ memset(&lock, 0, sizeof(lock));
44038
+ lock.l_whence = SEEK_SET;
44039
+ lock.l_start = UNIX_SHM_DMS;
44040
+ lock.l_len = 1;
44041
+ lock.l_type = F_WRLCK;
44042
+ osFcntl(pShmNode->hShm, F_GETLK, &lock);
44043
+ return (lock.l_type!=F_UNLCK);
44042
44044
  }
44043
44045
 
44044
44046
  /*
@@ -115470,9 +115472,22 @@ SQLITE_PRIVATE int sqlite3CodeSubselect(Parse *pParse, Expr *pExpr){
115470
115472
  pParse->nMem += nReg;
115471
115473
  if( pExpr->op==TK_SELECT ){
115472
115474
  dest.eDest = SRT_Mem;
115473
- dest.iSdst = dest.iSDParm;
115475
+ if( (pSel->selFlags&SF_Distinct) && pSel->pLimit && pSel->pLimit->pRight ){
115476
+ /* If there is both a DISTINCT and an OFFSET clause, then allocate
115477
+ ** a separate dest.iSdst array for sqlite3Select() and other
115478
+ ** routines to populate. In this case results will be copied over
115479
+ ** into the dest.iSDParm array only after OFFSET processing. This
115480
+ ** ensures that in the case where OFFSET excludes all rows, the
115481
+ ** dest.iSDParm array is not left populated with the contents of the
115482
+ ** last row visited - it should be all NULLs if all rows were
115483
+ ** excluded by OFFSET. */
115484
+ dest.iSdst = pParse->nMem+1;
115485
+ pParse->nMem += nReg;
115486
+ }else{
115487
+ dest.iSdst = dest.iSDParm;
115488
+ }
115474
115489
  dest.nSdst = nReg;
115475
- sqlite3VdbeAddOp3(v, OP_Null, 0, dest.iSDParm, dest.iSDParm+nReg-1);
115490
+ sqlite3VdbeAddOp3(v, OP_Null, 0, dest.iSDParm, pParse->nMem);
115476
115491
  VdbeComment((v, "Init subquery result"));
115477
115492
  }else{
115478
115493
  dest.eDest = SRT_Exists;
@@ -130815,6 +130830,7 @@ SQLITE_PRIVATE void sqlite3SchemaClear(void *p){
130815
130830
  for(pElem=sqliteHashFirst(&temp2); pElem; pElem=sqliteHashNext(pElem)){
130816
130831
  sqlite3DeleteTrigger(&xdb, (Trigger*)sqliteHashData(pElem));
130817
130832
  }
130833
+
130818
130834
  sqlite3HashClear(&temp2);
130819
130835
  sqlite3HashInit(&pSchema->tblHash);
130820
130836
  for(pElem=sqliteHashFirst(&temp1); pElem; pElem=sqliteHashNext(pElem)){
@@ -148344,9 +148360,14 @@ static void selectInnerLoop(
148344
148360
  assert( nResultCol<=pDest->nSdst );
148345
148361
  pushOntoSorter(
148346
148362
  pParse, pSort, p, regResult, regOrig, nResultCol, nPrefixReg);
148363
+ pDest->iSDParm = regResult;
148347
148364
  }else{
148348
148365
  assert( nResultCol==pDest->nSdst );
148349
- assert( regResult==iParm );
148366
+ if( regResult!=iParm ){
148367
+ /* This occurs in cases where the SELECT had both a DISTINCT and
148368
+ ** an OFFSET clause. */
148369
+ sqlite3VdbeAddOp3(v, OP_Copy, regResult, iParm, nResultCol-1);
148370
+ }
148350
148371
  /* The LIMIT clause will jump out of the loop for us */
148351
148372
  }
148352
148373
  break;
@@ -154361,12 +154382,24 @@ static SQLITE_NOINLINE void existsToJoin(
154361
154382
  && (pSub->selFlags & SF_Aggregate)==0
154362
154383
  && !pSub->pSrc->a[0].fg.isSubquery
154363
154384
  && pSub->pLimit==0
154385
+ && pSub->pPrior==0
154364
154386
  ){
154387
+ /* Before combining the sub-select with the parent, renumber the
154388
+ ** cursor used by the subselect. This is because the EXISTS expression
154389
+ ** might be a copy of another EXISTS expression from somewhere
154390
+ ** else in the tree, and in this case it is important that it use
154391
+ ** a unique cursor number. */
154392
+ sqlite3 *db = pParse->db;
154393
+ int *aCsrMap = sqlite3DbMallocZero(db, (pParse->nTab+2)*sizeof(int));
154394
+ if( aCsrMap==0 ) return;
154395
+ aCsrMap[0] = (pParse->nTab+1);
154396
+ renumberCursors(pParse, pSub, -1, aCsrMap);
154397
+ sqlite3DbFree(db, aCsrMap);
154398
+
154365
154399
  memset(pWhere, 0, sizeof(*pWhere));
154366
154400
  pWhere->op = TK_INTEGER;
154367
154401
  pWhere->u.iValue = 1;
154368
154402
  ExprSetProperty(pWhere, EP_IntValue);
154369
-
154370
154403
  assert( p->pWhere!=0 );
154371
154404
  pSub->pSrc->a[0].fg.fromExists = 1;
154372
154405
  pSub->pSrc->a[0].fg.jointype |= JT_CROSS;
@@ -161145,9 +161178,12 @@ SQLITE_PRIVATE int sqlite3VtabEponymousTableInit(Parse *pParse, Module *pMod){
161145
161178
  addModuleArgument(pParse, pTab, sqlite3DbStrDup(db, pTab->zName));
161146
161179
  addModuleArgument(pParse, pTab, 0);
161147
161180
  addModuleArgument(pParse, pTab, sqlite3DbStrDup(db, pTab->zName));
161181
+ db->nSchemaLock++;
161148
161182
  rc = vtabCallConstructor(db, pTab, pMod, pModule->xConnect, &zErr);
161183
+ db->nSchemaLock--;
161149
161184
  if( rc ){
161150
161185
  sqlite3ErrorMsg(pParse, "%s", zErr);
161186
+ pParse->rc = rc;
161151
161187
  sqlite3DbFree(db, zErr);
161152
161188
  sqlite3VtabEponymousTableClear(db, pMod);
161153
161189
  }
@@ -174165,6 +174201,9 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){
174165
174201
  sqlite3 *db = pParse->db;
174166
174202
  int iEnd = sqlite3VdbeCurrentAddr(v);
174167
174203
  int nRJ = 0;
174204
+ #ifndef SQLITE_DISABLE_SKIPAHEAD_DISTINCT
174205
+ int addrSeek = 0;
174206
+ #endif
174168
174207
 
174169
174208
  /* Generate loop termination code.
174170
174209
  */
@@ -174177,7 +174216,10 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){
174177
174216
  ** the RIGHT JOIN table */
174178
174217
  WhereRightJoin *pRJ = pLevel->pRJ;
174179
174218
  sqlite3VdbeResolveLabel(v, pLevel->addrCont);
174180
- pLevel->addrCont = 0;
174219
+ /* Replace addrCont with a new label that will never be used, just so
174220
+ ** the subsequent call to resolve pLevel->addrCont will have something
174221
+ ** to resolve. */
174222
+ pLevel->addrCont = sqlite3VdbeMakeLabel(pParse);
174181
174223
  pRJ->endSubrtn = sqlite3VdbeCurrentAddr(v);
174182
174224
  sqlite3VdbeAddOp3(v, OP_Return, pRJ->regReturn, pRJ->addrSubrtn, 1);
174183
174225
  VdbeCoverage(v);
@@ -174186,7 +174228,6 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){
174186
174228
  pLoop = pLevel->pWLoop;
174187
174229
  if( pLevel->op!=OP_Noop ){
174188
174230
  #ifndef SQLITE_DISABLE_SKIPAHEAD_DISTINCT
174189
- int addrSeek = 0;
174190
174231
  Index *pIdx;
174191
174232
  int n;
174192
174233
  if( pWInfo->eDistinct==WHERE_DISTINCT_ORDERED
@@ -174209,11 +174250,26 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){
174209
174250
  sqlite3VdbeAddOp2(v, OP_Goto, 1, pLevel->p2);
174210
174251
  }
174211
174252
  #endif /* SQLITE_DISABLE_SKIPAHEAD_DISTINCT */
174212
- if( pTabList->a[pLevel->iFrom].fg.fromExists ){
174213
- sqlite3VdbeAddOp2(v, OP_Goto, 0, sqlite3VdbeCurrentAddr(v)+2);
174214
- }
174215
- /* The common case: Advance to the next row */
174216
- if( pLevel->addrCont ) sqlite3VdbeResolveLabel(v, pLevel->addrCont);
174253
+ }
174254
+ if( pTabList->a[pLevel->iFrom].fg.fromExists && i==pWInfo->nLevel-1 ){
174255
+ /* If the EXISTS-to-JOIN optimization was applied, then the EXISTS
174256
+ ** loop(s) will be the inner-most loops of the join. There might be
174257
+ ** multiple EXISTS loops, but they will all be nested, and the join
174258
+ ** order will not have been changed by the query planner. If the
174259
+ ** inner-most EXISTS loop sees a single successful row, it should
174260
+ ** break out of *all* EXISTS loops. But only the inner-most of the
174261
+ ** nested EXISTS loops should do this breakout. */
174262
+ int nOuter = 0; /* Nr of outer EXISTS that this one is nested within */
174263
+ while( nOuter<i ){
174264
+ if( !pTabList->a[pLevel[-nOuter-1].iFrom].fg.fromExists ) break;
174265
+ nOuter++;
174266
+ }
174267
+ testcase( nOuter>0 );
174268
+ sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel[-nOuter].addrBrk);
174269
+ VdbeComment((v, "EXISTS break"));
174270
+ }
174271
+ sqlite3VdbeResolveLabel(v, pLevel->addrCont);
174272
+ if( pLevel->op!=OP_Noop ){
174217
174273
  sqlite3VdbeAddOp3(v, pLevel->op, pLevel->p1, pLevel->p2, pLevel->p3);
174218
174274
  sqlite3VdbeChangeP5(v, pLevel->p5);
174219
174275
  VdbeCoverage(v);
@@ -174226,10 +174282,11 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){
174226
174282
  VdbeCoverage(v);
174227
174283
  }
174228
174284
  #ifndef SQLITE_DISABLE_SKIPAHEAD_DISTINCT
174229
- if( addrSeek ) sqlite3VdbeJumpHere(v, addrSeek);
174285
+ if( addrSeek ){
174286
+ sqlite3VdbeJumpHere(v, addrSeek);
174287
+ addrSeek = 0;
174288
+ }
174230
174289
  #endif
174231
- }else if( pLevel->addrCont ){
174232
- sqlite3VdbeResolveLabel(v, pLevel->addrCont);
174233
174290
  }
174234
174291
  if( (pLoop->wsFlags & WHERE_IN_ABLE)!=0 && pLevel->u.in.nIn>0 ){
174235
174292
  struct InLoop *pIn;
@@ -186415,6 +186472,7 @@ SQLITE_PRIVATE void sqlite3LeaveMutexAndCloseZombie(sqlite3 *db){
186415
186472
  /* Clear the TEMP schema separately and last */
186416
186473
  if( db->aDb[1].pSchema ){
186417
186474
  sqlite3SchemaClear(db->aDb[1].pSchema);
186475
+ assert( db->aDb[1].pSchema->trigHash.count==0 );
186418
186476
  }
186419
186477
  sqlite3VtabUnlockList(db);
186420
186478
 
@@ -187743,7 +187801,7 @@ SQLITE_API const char *sqlite3_errmsg(sqlite3 *db){
187743
187801
  */
187744
187802
  SQLITE_API int sqlite3_set_errmsg(sqlite3 *db, int errcode, const char *zMsg){
187745
187803
  int rc = SQLITE_OK;
187746
- if( !sqlite3SafetyCheckSickOrOk(db) ){
187804
+ if( !sqlite3SafetyCheckOk(db) ){
187747
187805
  return SQLITE_MISUSE_BKPT;
187748
187806
  }
187749
187807
  sqlite3_mutex_enter(db->mutex);
@@ -219631,7 +219689,7 @@ static void rtreenode(sqlite3_context *ctx, int nArg, sqlite3_value **apArg){
219631
219689
  if( node.zData==0 ) return;
219632
219690
  nData = sqlite3_value_bytes(apArg[1]);
219633
219691
  if( nData<4 ) return;
219634
- if( nData<NCELL(&node)*tree.nBytesPerCell ) return;
219692
+ if( nData<4+NCELL(&node)*tree.nBytesPerCell ) return;
219635
219693
 
219636
219694
  pOut = sqlite3_str_new(0);
219637
219695
  for(ii=0; ii<NCELL(&node); ii++){
@@ -238712,7 +238770,13 @@ typedef sqlite3_uint64 u64;
238712
238770
  # define FLEXARRAY 1
238713
238771
  #endif
238714
238772
 
238715
- #endif
238773
+ #endif /* SQLITE_AMALGAMATION */
238774
+
238775
+ /*
238776
+ ** Constants for the largest and smallest possible 32-bit signed integers.
238777
+ */
238778
+ # define LARGEST_INT32 ((int)(0x7fffffff))
238779
+ # define SMALLEST_INT32 ((int)((-1) - LARGEST_INT32))
238716
238780
 
238717
238781
  /* Truncate very long tokens to this many bytes. Hard limit is
238718
238782
  ** (65536-1-1-4-9)==65521 bytes. The limiting factor is the 16-bit offset
@@ -249418,6 +249482,7 @@ static void fts5SegIterReverseInitPage(Fts5Index *p, Fts5SegIter *pIter){
249418
249482
  while( 1 ){
249419
249483
  u64 iDelta = 0;
249420
249484
 
249485
+ if( i>=n ) break;
249421
249486
  if( eDetail==FTS5_DETAIL_NONE ){
249422
249487
  /* todo */
249423
249488
  if( i<n && a[i]==0 ){
@@ -253274,7 +253339,7 @@ static int sqlite3Fts5IndexMerge(Fts5Index *p, int nMerge){
253274
253339
  fts5StructureRelease(pStruct);
253275
253340
  pStruct = pNew;
253276
253341
  nMin = 1;
253277
- nMerge = nMerge*-1;
253342
+ nMerge = (nMerge==SMALLEST_INT32 ? LARGEST_INT32 : (nMerge*-1));
253278
253343
  }
253279
253344
  if( pStruct && pStruct->nLevel ){
253280
253345
  if( fts5IndexMerge(p, &pStruct, nMerge, nMin) ){
@@ -260481,7 +260546,7 @@ static void fts5SourceIdFunc(
260481
260546
  ){
260482
260547
  assert( nArg==0 );
260483
260548
  UNUSED_PARAM2(nArg, apUnused);
260484
- sqlite3_result_text(pCtx, "fts5: 2025-11-04 19:38:17 fb2c931ae597f8d00a37574ff67aeed3eced4e5547f9120744ae4bfa8e74527b", -1, SQLITE_TRANSIENT);
260549
+ sqlite3_result_text(pCtx, "fts5: 2026-01-09 17:27:48 b270f8339eb13b504d0b2ba154ebca966b7dde08e40c3ed7d559749818cb2075", -1, SQLITE_TRANSIENT);
260485
260550
  }
260486
260551
 
260487
260552
  /*
@@ -265302,7 +265367,12 @@ static int fts5VocabOpenMethod(
265302
265367
  return rc;
265303
265368
  }
265304
265369
 
265370
+ /*
265371
+ ** Restore cursor pCsr to the state it was in immediately after being
265372
+ ** created by the xOpen() method.
265373
+ */
265305
265374
  static void fts5VocabResetCursor(Fts5VocabCursor *pCsr){
265375
+ int nCol = pCsr->pFts5->pConfig->nCol;
265306
265376
  pCsr->rowid = 0;
265307
265377
  sqlite3Fts5IterClose(pCsr->pIter);
265308
265378
  sqlite3Fts5StructureRelease(pCsr->pStruct);
@@ -265312,6 +265382,12 @@ static void fts5VocabResetCursor(Fts5VocabCursor *pCsr){
265312
265382
  pCsr->nLeTerm = -1;
265313
265383
  pCsr->zLeTerm = 0;
265314
265384
  pCsr->bEof = 0;
265385
+ pCsr->iCol = 0;
265386
+ pCsr->iInstPos = 0;
265387
+ pCsr->iInstOff = 0;
265388
+ pCsr->colUsed = 0;
265389
+ memset(pCsr->aCnt, 0, sizeof(i64)*nCol);
265390
+ memset(pCsr->aDoc, 0, sizeof(i64)*nCol);
265315
265391
  }
265316
265392
 
265317
265393
  /*
@@ -266310,7 +266386,7 @@ SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
266310
266386
  ** Purpose: SQLite3 Multiple Ciphers version numbers
266311
266387
  ** Author: Ulrich Telle
266312
266388
  ** Created: 2020-08-05
266313
- ** Copyright: (c) 2020-2025 Ulrich Telle
266389
+ ** Copyright: (c) 2020-2026 Ulrich Telle
266314
266390
  ** License: MIT
266315
266391
  */
266316
266392
 
@@ -266321,9 +266397,9 @@ SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
266321
266397
 
266322
266398
  #define SQLITE3MC_VERSION_MAJOR 2
266323
266399
  #define SQLITE3MC_VERSION_MINOR 2
266324
- #define SQLITE3MC_VERSION_RELEASE 5
266400
+ #define SQLITE3MC_VERSION_RELEASE 7
266325
266401
  #define SQLITE3MC_VERSION_SUBRELEASE 0
266326
- #define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 2.2.5"
266402
+ #define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 2.2.7"
266327
266403
 
266328
266404
  #endif /* SQLITE3MC_VERSION_H_ */
266329
266405
  /*** End of #include "sqlite3mc_version.h" ***/
@@ -266482,12 +266558,12 @@ extern "C" {
266482
266558
  ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
266483
266559
  ** [sqlite_version()] and [sqlite_source_id()].
266484
266560
  */
266485
- #define SQLITE_VERSION "3.51.0"
266486
- #define SQLITE_VERSION_NUMBER 3051000
266487
- #define SQLITE_SOURCE_ID "2025-11-04 19:38:17 fb2c931ae597f8d00a37574ff67aeed3eced4e5547f9120744a-experimental"
266488
- #define SQLITE_SCM_BRANCH "unknown"
266489
- #define SQLITE_SCM_TAGS "unknown"
266490
- #define SQLITE_SCM_DATETIME "2025-11-04T19:38:17.314Z"
266561
+ #define SQLITE_VERSION "3.51.2"
266562
+ #define SQLITE_VERSION_NUMBER 3051002
266563
+ #define SQLITE_SOURCE_ID "2026-01-09 17:27:48 b270f8339eb13b504d0b2ba154ebca966b7dde08e40c3ed7d559749818cb2075"
266564
+ #define SQLITE_SCM_BRANCH "branch-3.51"
266565
+ #define SQLITE_SCM_TAGS "release version-3.51.2"
266566
+ #define SQLITE_SCM_DATETIME "2026-01-09T17:27:48.405Z"
266491
266567
 
266492
266568
  /*
266493
266569
  ** CAPI3REF: Run-Time Library Version Numbers
@@ -276762,7 +276838,7 @@ SQLITE_API int sqlite3_vtab_in(sqlite3_index_info*, int iCons, int bHandle);
276762
276838
  ** &nbsp; ){
276763
276839
  ** &nbsp; // do something with pVal
276764
276840
  ** &nbsp; }
276765
- ** &nbsp; if( rc!=SQLITE_OK ){
276841
+ ** &nbsp; if( rc!=SQLITE_DONE ){
276766
276842
  ** &nbsp; // an error has occurred
276767
276843
  ** &nbsp; }
276768
276844
  ** </pre></blockquote>)^
@@ -334508,7 +334584,7 @@ sqlite3mcBtreeSetPageSize(Btree* p, int pageSize, int nReserve, int iFix)
334508
334584
  ** Change 4: Call sqlite3mcBtreeSetPageSize instead of sqlite3BtreeSetPageSize for main database
334509
334585
  ** (sqlite3mcBtreeSetPageSize allows to reduce the number of reserved bytes)
334510
334586
  **
334511
- ** This code is generated by the script rekeyvacuum.sh from SQLite version 3.51.0 amalgamation.
334587
+ ** This code is generated by the script rekeyvacuum.sh from SQLite version 3.51.2 amalgamation.
334512
334588
  */
334513
334589
  SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3mcRunVacuumForRekey(
334514
334590
  char **pzErrMsg, /* Write error message here */
@@ -338431,6 +338507,9 @@ SQLITE_EXTENSION_INIT1
338431
338507
  # define CSV_NOINLINE
338432
338508
  #endif
338433
338509
 
338510
+ #ifndef SQLITEINT_H
338511
+ typedef sqlite3_int64 i64;
338512
+ #endif
338434
338513
 
338435
338514
  /* Max size of the error message in a CsvReader */
338436
338515
  #define CSV_MXERR 200
@@ -338443,9 +338522,9 @@ typedef struct CsvReader CsvReader;
338443
338522
  struct CsvReader {
338444
338523
  FILE *in; /* Read the CSV text from this input stream */
338445
338524
  char *z; /* Accumulated text for a field */
338446
- int n; /* Number of bytes in z */
338447
- int nAlloc; /* Space allocated for z[] */
338448
- int nLine; /* Current line number */
338525
+ i64 n; /* Number of bytes in z */
338526
+ i64 nAlloc; /* Space allocated for z[] */
338527
+ i64 nLine; /* Current line number */
338449
338528
  int bNotFirst; /* True if prior text has been seen */
338450
338529
  int cTerm; /* Character that terminated the most recent field */
338451
338530
  size_t iIn; /* Next unread character in the input buffer */
@@ -338543,7 +338622,7 @@ static int csv_getc(CsvReader *p){
338543
338622
  ** Return 0 on success and non-zero if there is an OOM error */
338544
338623
  static CSV_NOINLINE int csv_resize_and_append(CsvReader *p, char c){
338545
338624
  char *zNew;
338546
- int nNew = p->nAlloc*2 + 100;
338625
+ i64 nNew = p->nAlloc*2 + 100;
338547
338626
  zNew = sqlite3_realloc64(p->z, nNew);
338548
338627
  if( zNew ){
338549
338628
  p->z = zNew;
@@ -338879,7 +338958,6 @@ static int csvtabConnect(
338879
338958
  # define CSV_DATA (azPValue[1])
338880
338959
  # define CSV_SCHEMA (azPValue[2])
338881
338960
 
338882
-
338883
338961
  assert( sizeof(azPValue)==sizeof(azParam) );
338884
338962
  memset(&sRdr, 0, sizeof(sRdr));
338885
338963
  memset(azPValue, 0, sizeof(azPValue));
@@ -342780,6 +342858,7 @@ static int fileStat(
342780
342858
  b1[sz] = 0;
342781
342859
  rc = _wstat(b1, pStatBuf);
342782
342860
  if( rc==0 ) statTimesToUtc(zPath, pStatBuf);
342861
+ sqlite3_free(b1);
342783
342862
  return rc;
342784
342863
  #else
342785
342864
  return stat(zPath, pStatBuf);
@@ -354898,7 +354977,7 @@ static void compressFunc(
354898
354977
  pIn = sqlite3_value_blob(argv[0]);
354899
354978
  nIn = sqlite3_value_bytes(argv[0]);
354900
354979
  nOut = 13 + nIn + (nIn+999)/1000;
354901
- pOut = sqlite3_malloc( nOut+5 );
354980
+ pOut = sqlite3_malloc64( nOut+5 );
354902
354981
  for(i=4; i>=0; i--){
354903
354982
  x[i] = (nIn >> (7*(4-i)))&0x7f;
354904
354983
  }
@@ -354937,7 +355016,7 @@ static void uncompressFunc(
354937
355016
  nOut = (nOut<<7) | (pIn[i]&0x7f);
354938
355017
  if( (pIn[i]&0x80)!=0 ){ i++; break; }
354939
355018
  }
354940
- pOut = sqlite3_malloc( nOut+1 );
355019
+ pOut = sqlite3_malloc64( nOut+1 );
354941
355020
  rc = uncompress(pOut, &nOut, &pIn[i], nIn-i);
354942
355021
  if( rc==Z_OK ){
354943
355022
  sqlite3_result_blob(context, pOut, nOut, sqlite3_free);
@@ -356000,7 +356079,7 @@ static int zipfileGetEntry(
356000
356079
  );
356001
356080
  }else{
356002
356081
  aRead = (u8*)&aBlob[iOff + ZIPFILE_CDS_FIXED_SZ];
356003
- if( (iOff + ZIPFILE_LFH_FIXED_SZ + nFile + nExtra)>nBlob ){
356082
+ if( (iOff + ZIPFILE_CDS_FIXED_SZ + nFile + nExtra)>nBlob ){
356004
356083
  rc = zipfileCorrupt(pzErr);
356005
356084
  }
356006
356085
  }
@@ -20,7 +20,7 @@
20
20
  ** Purpose: SQLite3 Multiple Ciphers version numbers
21
21
  ** Author: Ulrich Telle
22
22
  ** Created: 2020-08-05
23
- ** Copyright: (c) 2020-2025 Ulrich Telle
23
+ ** Copyright: (c) 2020-2026 Ulrich Telle
24
24
  ** License: MIT
25
25
  */
26
26
 
@@ -31,9 +31,9 @@
31
31
 
32
32
  #define SQLITE3MC_VERSION_MAJOR 2
33
33
  #define SQLITE3MC_VERSION_MINOR 2
34
- #define SQLITE3MC_VERSION_RELEASE 5
34
+ #define SQLITE3MC_VERSION_RELEASE 7
35
35
  #define SQLITE3MC_VERSION_SUBRELEASE 0
36
- #define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 2.2.5"
36
+ #define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 2.2.7"
37
37
 
38
38
  #endif /* SQLITE3MC_VERSION_H_ */
39
39
  /*** End of #include "sqlite3mc_version.h" ***/
@@ -192,12 +192,12 @@ extern "C" {
192
192
  ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
193
193
  ** [sqlite_version()] and [sqlite_source_id()].
194
194
  */
195
- #define SQLITE_VERSION "3.51.0"
196
- #define SQLITE_VERSION_NUMBER 3051000
197
- #define SQLITE_SOURCE_ID "2025-11-04 19:38:17 fb2c931ae597f8d00a37574ff67aeed3eced4e5547f9120744a-experimental"
198
- #define SQLITE_SCM_BRANCH "unknown"
199
- #define SQLITE_SCM_TAGS "unknown"
200
- #define SQLITE_SCM_DATETIME "2025-11-04T19:38:17.314Z"
195
+ #define SQLITE_VERSION "3.51.2"
196
+ #define SQLITE_VERSION_NUMBER 3051002
197
+ #define SQLITE_SOURCE_ID "2026-01-09 17:27:48 b270f8339eb13b504d0b2ba154ebca966b7dde08e40c3ed7d559749818cb2075"
198
+ #define SQLITE_SCM_BRANCH "branch-3.51"
199
+ #define SQLITE_SCM_TAGS "release version-3.51.2"
200
+ #define SQLITE_SCM_DATETIME "2026-01-09T17:27:48.405Z"
201
201
 
202
202
  /*
203
203
  ** CAPI3REF: Run-Time Library Version Numbers
@@ -10472,7 +10472,7 @@ SQLITE_API int sqlite3_vtab_in(sqlite3_index_info*, int iCons, int bHandle);
10472
10472
  ** &nbsp; ){
10473
10473
  ** &nbsp; // do something with pVal
10474
10474
  ** &nbsp; }
10475
- ** &nbsp; if( rc!=SQLITE_OK ){
10475
+ ** &nbsp; if( rc!=SQLITE_DONE ){
10476
10476
  ** &nbsp; // an error has occurred
10477
10477
  ** &nbsp; }
10478
10478
  ** </pre></blockquote>)^
@@ -20,9 +20,9 @@
20
20
  # 4. node-gyp links the two resulting binaries to generate better_sqlite3.node.
21
21
  # ===
22
22
 
23
- YEAR="2025"
24
- VERSION="3510000"
25
- SQLITE3MC_VERSION="v2.2.5"
23
+ YEAR="2026"
24
+ VERSION="3510200"
25
+ SQLITE3MC_VERSION="v2.2.7"
26
26
 
27
27
  # Defines below are sorted alphabetically
28
28
  DEFINES="
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-sqlite3-multiple-ciphers",
3
- "version": "12.4.6",
3
+ "version": "12.6.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>",