better-sqlite3-multiple-ciphers 8.0.1-beta.0 → 8.0.2-beta.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
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![NPM version](https://img.shields.io/npm/v/better-sqlite3-multiple-ciphers?logo=npm&color=cc3838&style=for-the-badge)](https://www.npmjs.com/package/better-sqlite3-multiple-ciphers)
4
4
  [![Downloads](https://img.shields.io/npm/dt/better-sqlite3-multiple-ciphers?logo=DocuSign&logoColor=FFF&color=2757c4&style=for-the-badge)](https://www.npmjs.com/package/better-sqlite3-multiple-ciphers)
5
- [![Build status](https://img.shields.io/github/workflow/status/m4heshd/better-sqlite3-multiple-ciphers/test?label=Build%2FTest&logo=github&style=for-the-badge)](https://github.com/m4heshd/better-sqlite3-multiple-ciphers/actions/workflows/test.yml)
5
+ [![Build status](https://img.shields.io/github/actions/workflow/status/m4heshd/better-sqlite3-multiple-ciphers/test.yml?branch=master&label=Build%2FTest&logo=github&style=for-the-badge)](https://github.com/m4heshd/better-sqlite3-multiple-ciphers/actions/workflows/test.yml)
6
6
 
7
7
  The fastest and simplest library for SQLite3 in Node.js. This particular fork supports multiple-cipher encryption using [SQLite3MultipleCiphers](https://github.com/utelle/SQLite3MultipleCiphers). Check [usage](#usage) to learn more.
8
8
 
@@ -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.0.0`](https://github.com/m4heshd/better-sqlite3-multiple-ciphers/releases/tag/v8.0.0)
21
- - **better-sqlite3** - [`8.0.0`](https://github.com/JoshuaWise/better-sqlite3/releases/tag/v8.0.0)
20
+ - **better-sqlite3-multiple-ciphers** - [`8.0.1`](https://github.com/m4heshd/better-sqlite3-multiple-ciphers/releases/tag/v8.0.1)
21
+ - **better-sqlite3** - [`8.0.1`](https://github.com/JoshuaWise/better-sqlite3/releases/tag/v8.0.1)
22
22
  - **SQLite** - [`3.40.0`](https://www.sqlite.org/releaselog/3_40_0.html)
23
23
  - **SQLite3 Multiple Ciphers** - [`1.5.4`](https://github.com/utelle/SQLite3MultipleCiphers/releases/tag/v1.5.4)
24
24
 
25
25
  - ### Beta
26
- - **better-sqlite3-multiple-ciphers** - [`8.0.1-beta.0`](https://github.com/m4heshd/better-sqlite3-multiple-ciphers/releases/tag/v8.0.1-beta.0)
27
- - **better-sqlite3** - [`8.0.0`](https://github.com/JoshuaWise/better-sqlite3/releases/tag/v8.0.0)
28
- - **SQLite** - [`3.40.0`](https://www.sqlite.org/releaselog/3_40_0.html)
29
- - **SQLite3 Multiple Ciphers** - [`1.5.4`](https://github.com/utelle/SQLite3MultipleCiphers/releases/tag/v1.5.4)
26
+ - **better-sqlite3-multiple-ciphers** - [`8.0.2-beta.0`](https://github.com/m4heshd/better-sqlite3-multiple-ciphers/releases/tag/v8.0.2-beta.0)
27
+ - **better-sqlite3** - [`8.0.1`](https://github.com/JoshuaWise/better-sqlite3/releases/tag/v8.0.1)
28
+ - **SQLite** - [`3.40.1`](https://www.sqlite.org/releaselog/3_40_1.html)
29
+ - **SQLite3 Multiple Ciphers** - [`1.5.5`](https://github.com/utelle/SQLite3MultipleCiphers/releases/tag/v1.5.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.5.4"
5
+ $SQLITEMC_VER = "v1.5.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.40.0. By combining all the individual C code files into this
95
+ ** version 3.40.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
@@ -544,9 +544,9 @@ extern "C" {
544
544
  ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
545
545
  ** [sqlite_version()] and [sqlite_source_id()].
546
546
  */
547
- #define SQLITE_VERSION "3.40.0"
548
- #define SQLITE_VERSION_NUMBER 3040000
549
- #define SQLITE_SOURCE_ID "2022-11-16 12:10:08 89c459e766ea7e9165d0beeb124708b955a4950d0f4792f457465d71b158d318"
547
+ #define SQLITE_VERSION "3.40.1"
548
+ #define SQLITE_VERSION_NUMBER 3040001
549
+ #define SQLITE_SOURCE_ID "2022-12-28 14:03:47 df5c253c0b3dd24916e4ec7cf77d3db5294cc9fd45ae7b9c5e82ad8197f38a24"
550
550
 
551
551
  /*
552
552
  ** CAPI3REF: Run-Time Library Version Numbers
@@ -1590,6 +1590,12 @@ struct sqlite3_io_methods {
1590
1590
  **
1591
1591
  ** <li>[[SQLITE_FCNTL_CKSM_FILE]]
1592
1592
  ** Used by the cksmvfs VFS module only.
1593
+ **
1594
+ ** <li>[[SQLITE_FCNTL_RESET_CACHE]]
1595
+ ** If there is currently no transaction open on the database, and the
1596
+ ** database is not a temp db, then this file-control purges the contents
1597
+ ** of the in-memory page cache. If there is an open transaction, or if
1598
+ ** the db is a temp-db, it is a no-op, not an error.
1593
1599
  ** </ul>
1594
1600
  */
1595
1601
  #define SQLITE_FCNTL_LOCKSTATE 1
@@ -1632,6 +1638,7 @@ struct sqlite3_io_methods {
1632
1638
  #define SQLITE_FCNTL_CKPT_START 39
1633
1639
  #define SQLITE_FCNTL_EXTERNAL_READER 40
1634
1640
  #define SQLITE_FCNTL_CKSM_FILE 41
1641
+ #define SQLITE_FCNTL_RESET_CACHE 42
1635
1642
 
1636
1643
  /* deprecated names */
1637
1644
  #define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
@@ -15813,6 +15820,8 @@ SQLITE_PRIVATE int sqlite3BtreeCheckpoint(Btree*, int, int *, int *);
15813
15820
 
15814
15821
  SQLITE_PRIVATE int sqlite3BtreeTransferRow(BtCursor*, BtCursor*, i64);
15815
15822
 
15823
+ SQLITE_PRIVATE void sqlite3BtreeClearCache(Btree*);
15824
+
15816
15825
  /*
15817
15826
  ** If we are not using shared cache, then there is no need to
15818
15827
  ** use mutexes to access the BtShared structures. So make the
@@ -27389,9 +27398,13 @@ static int memsys5Roundup(int n){
27389
27398
  if( n<=mem5.szAtom ) return mem5.szAtom;
27390
27399
  return mem5.szAtom*2;
27391
27400
  }
27392
- if( n>0x40000000 ) return 0;
27401
+ if( n>0x10000000 ){
27402
+ if( n>0x40000000 ) return 0;
27403
+ if( n>0x20000000 ) return 0x40000000;
27404
+ return 0x20000000;
27405
+ }
27393
27406
  for(iFullSz=mem5.szAtom*8; iFullSz<n; iFullSz *= 4);
27394
- if( (iFullSz/2)>=n ) return iFullSz/2;
27407
+ if( (iFullSz/2)>=(i64)n ) return iFullSz/2;
27395
27408
  return iFullSz;
27396
27409
  }
27397
27410
 
@@ -37437,6 +37450,9 @@ static int robust_open(const char *z, int f, mode_t m){
37437
37450
  break;
37438
37451
  }
37439
37452
  if( fd>=SQLITE_MINIMUM_FILE_DESCRIPTOR ) break;
37453
+ if( (f & (O_EXCL|O_CREAT))==(O_EXCL|O_CREAT) ){
37454
+ (void)osUnlink(z);
37455
+ }
37440
37456
  osClose(fd);
37441
37457
  sqlite3_log(SQLITE_WARNING,
37442
37458
  "attempt to open \"%s\" as file descriptor %d", z, fd);
@@ -51170,6 +51186,7 @@ static int memdbTruncate(sqlite3_file*, sqlite3_int64 size);
51170
51186
  static int memdbSync(sqlite3_file*, int flags);
51171
51187
  static int memdbFileSize(sqlite3_file*, sqlite3_int64 *pSize);
51172
51188
  static int memdbLock(sqlite3_file*, int);
51189
+ static int memdbUnlock(sqlite3_file*, int);
51173
51190
  /* static int memdbCheckReservedLock(sqlite3_file*, int *pResOut);// not used */
51174
51191
  static int memdbFileControl(sqlite3_file*, int op, void *pArg);
51175
51192
  /* static int memdbSectorSize(sqlite3_file*); // not used */
@@ -51228,7 +51245,7 @@ static const sqlite3_io_methods memdb_io_methods = {
51228
51245
  memdbSync, /* xSync */
51229
51246
  memdbFileSize, /* xFileSize */
51230
51247
  memdbLock, /* xLock */
51231
- memdbLock, /* xUnlock - same as xLock in this case */
51248
+ memdbUnlock, /* xUnlock */
51232
51249
  0, /* memdbCheckReservedLock, */ /* xCheckReservedLock */
51233
51250
  memdbFileControl, /* xFileControl */
51234
51251
  0, /* memdbSectorSize,*/ /* xSectorSize */
@@ -51429,39 +51446,81 @@ static int memdbLock(sqlite3_file *pFile, int eLock){
51429
51446
  MemFile *pThis = (MemFile*)pFile;
51430
51447
  MemStore *p = pThis->pStore;
51431
51448
  int rc = SQLITE_OK;
51432
- if( eLock==pThis->eLock ) return SQLITE_OK;
51449
+ if( eLock<=pThis->eLock ) return SQLITE_OK;
51433
51450
  memdbEnter(p);
51434
- if( eLock>SQLITE_LOCK_SHARED ){
51435
- if( p->mFlags & SQLITE_DESERIALIZE_READONLY ){
51436
- rc = SQLITE_READONLY;
51437
- }else if( pThis->eLock<=SQLITE_LOCK_SHARED ){
51438
- if( p->nWrLock ){
51439
- rc = SQLITE_BUSY;
51440
- }else{
51441
- p->nWrLock = 1;
51451
+
51452
+ assert( p->nWrLock==0 || p->nWrLock==1 );
51453
+ assert( pThis->eLock<=SQLITE_LOCK_SHARED || p->nWrLock==1 );
51454
+ assert( pThis->eLock==SQLITE_LOCK_NONE || p->nRdLock>=1 );
51455
+
51456
+ if( eLock>SQLITE_LOCK_SHARED && (p->mFlags & SQLITE_DESERIALIZE_READONLY) ){
51457
+ rc = SQLITE_READONLY;
51458
+ }else{
51459
+ switch( eLock ){
51460
+ case SQLITE_LOCK_SHARED: {
51461
+ assert( pThis->eLock==SQLITE_LOCK_NONE );
51462
+ if( p->nWrLock>0 ){
51463
+ rc = SQLITE_BUSY;
51464
+ }else{
51465
+ p->nRdLock++;
51466
+ }
51467
+ break;
51468
+ };
51469
+
51470
+ case SQLITE_LOCK_RESERVED:
51471
+ case SQLITE_LOCK_PENDING: {
51472
+ assert( pThis->eLock>=SQLITE_LOCK_SHARED );
51473
+ if( ALWAYS(pThis->eLock==SQLITE_LOCK_SHARED) ){
51474
+ if( p->nWrLock>0 ){
51475
+ rc = SQLITE_BUSY;
51476
+ }else{
51477
+ p->nWrLock = 1;
51478
+ }
51479
+ }
51480
+ break;
51481
+ }
51482
+
51483
+ default: {
51484
+ assert( eLock==SQLITE_LOCK_EXCLUSIVE );
51485
+ assert( pThis->eLock>=SQLITE_LOCK_SHARED );
51486
+ if( p->nRdLock>1 ){
51487
+ rc = SQLITE_BUSY;
51488
+ }else if( pThis->eLock==SQLITE_LOCK_SHARED ){
51489
+ p->nWrLock = 1;
51490
+ }
51491
+ break;
51442
51492
  }
51443
51493
  }
51444
- }else if( eLock==SQLITE_LOCK_SHARED ){
51445
- if( pThis->eLock > SQLITE_LOCK_SHARED ){
51446
- assert( p->nWrLock==1 );
51447
- p->nWrLock = 0;
51448
- }else if( p->nWrLock ){
51449
- rc = SQLITE_BUSY;
51450
- }else{
51451
- p->nRdLock++;
51494
+ }
51495
+ if( rc==SQLITE_OK ) pThis->eLock = eLock;
51496
+ memdbLeave(p);
51497
+ return rc;
51498
+ }
51499
+
51500
+ /*
51501
+ ** Unlock an memdb-file.
51502
+ */
51503
+ static int memdbUnlock(sqlite3_file *pFile, int eLock){
51504
+ MemFile *pThis = (MemFile*)pFile;
51505
+ MemStore *p = pThis->pStore;
51506
+ if( eLock>=pThis->eLock ) return SQLITE_OK;
51507
+ memdbEnter(p);
51508
+
51509
+ assert( eLock==SQLITE_LOCK_SHARED || eLock==SQLITE_LOCK_NONE );
51510
+ if( eLock==SQLITE_LOCK_SHARED ){
51511
+ if( ALWAYS(pThis->eLock>SQLITE_LOCK_SHARED) ){
51512
+ p->nWrLock--;
51452
51513
  }
51453
51514
  }else{
51454
- assert( eLock==SQLITE_LOCK_NONE );
51455
51515
  if( pThis->eLock>SQLITE_LOCK_SHARED ){
51456
- assert( p->nWrLock==1 );
51457
- p->nWrLock = 0;
51516
+ p->nWrLock--;
51458
51517
  }
51459
- assert( p->nRdLock>0 );
51460
51518
  p->nRdLock--;
51461
51519
  }
51462
- if( rc==SQLITE_OK ) pThis->eLock = eLock;
51520
+
51521
+ pThis->eLock = eLock;
51463
51522
  memdbLeave(p);
51464
- return rc;
51523
+ return SQLITE_OK;
51465
51524
  }
51466
51525
 
51467
51526
  #if 0
@@ -51571,7 +51630,7 @@ static int memdbOpen(
51571
51630
 
51572
51631
  memset(pFile, 0, sizeof(*pFile));
51573
51632
  szName = sqlite3Strlen30(zName);
51574
- if( szName>1 && zName[0]=='/' ){
51633
+ if( szName>1 && (zName[0]=='/' || zName[0]=='\\') ){
51575
51634
  int i;
51576
51635
  #ifndef SQLITE_MUTEX_OMIT
51577
51636
  sqlite3_mutex *pVfsMutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_VFS1);
@@ -51918,6 +51977,13 @@ end_deserialize:
51918
51977
  return rc;
51919
51978
  }
51920
51979
 
51980
+ /*
51981
+ ** Return true if the VFS is the memvfs.
51982
+ */
51983
+ SQLITE_PRIVATE int sqlite3IsMemdb(const sqlite3_vfs *pVfs){
51984
+ return pVfs==&memdb_vfs;
51985
+ }
51986
+
51921
51987
  /*
51922
51988
  ** This routine is called when the extension is loaded.
51923
51989
  ** Register the new VFS.
@@ -79246,6 +79312,17 @@ SQLITE_PRIVATE int sqlite3BtreeIsReadonly(Btree *p){
79246
79312
  */
79247
79313
  SQLITE_PRIVATE int sqlite3HeaderSizeBtree(void){ return ROUND8(sizeof(MemPage)); }
79248
79314
 
79315
+ /*
79316
+ ** If no transaction is active and the database is not a temp-db, clear
79317
+ ** the in-memory pager cache.
79318
+ */
79319
+ SQLITE_PRIVATE void sqlite3BtreeClearCache(Btree *p){
79320
+ BtShared *pBt = p->pBt;
79321
+ if( pBt->inTransaction==TRANS_NONE ){
79322
+ sqlite3PagerClearCache(pBt->pPager);
79323
+ }
79324
+ }
79325
+
79249
79326
  #if !defined(SQLITE_OMIT_SHARED_CACHE)
79250
79327
  /*
79251
79328
  ** Return true if the Btree passed as the only argument is sharable.
@@ -83485,7 +83562,7 @@ SQLITE_PRIVATE void sqlite3VdbeAppendP4(Vdbe *p, void *pP4, int n){
83485
83562
  if( p->db->mallocFailed ){
83486
83563
  freeP4(p->db, n, pP4);
83487
83564
  }else{
83488
- assert( pP4!=0 );
83565
+ assert( pP4!=0 || n==P4_DYNAMIC );
83489
83566
  assert( p->nOp>0 );
83490
83567
  pOp = &p->aOp[p->nOp-1];
83491
83568
  assert( pOp->p4type==P4_NOTUSED );
@@ -132402,7 +132479,7 @@ static const sqlite3_api_routines sqlite3Apis = {
132402
132479
  #endif
132403
132480
  sqlite3_db_name,
132404
132481
  /* Version 3.40.0 and later */
132405
- sqlite3_value_type
132482
+ sqlite3_value_encoding
132406
132483
  };
132407
132484
 
132408
132485
  /* True if x is the directory separator character
@@ -145543,7 +145620,7 @@ SQLITE_PRIVATE Trigger *sqlite3TriggerList(Parse *pParse, Table *pTab){
145543
145620
  if( pTrig->pTabSchema==pTab->pSchema
145544
145621
  && pTrig->table
145545
145622
  && 0==sqlite3StrICmp(pTrig->table, pTab->zName)
145546
- && pTrig->pTabSchema!=pTmpSchema
145623
+ && (pTrig->pTabSchema!=pTmpSchema || pTrig->bReturning)
145547
145624
  ){
145548
145625
  pTrig->pNext = pList;
145549
145626
  pList = pTrig;
@@ -155727,7 +155804,7 @@ SQLITE_PRIVATE int sqlite3WhereIsDistinct(WhereInfo *pWInfo){
155727
155804
  ** block sorting is required.
155728
155805
  */
155729
155806
  SQLITE_PRIVATE int sqlite3WhereIsOrdered(WhereInfo *pWInfo){
155730
- return pWInfo->nOBSat;
155807
+ return pWInfo->nOBSat<0 ? 0 : pWInfo->nOBSat;
155731
155808
  }
155732
155809
 
155733
155810
  /*
@@ -174635,7 +174712,7 @@ SQLITE_API int sqlite3_overload_function(
174635
174712
  rc = sqlite3FindFunction(db, zName, nArg, SQLITE_UTF8, 0)!=0;
174636
174713
  sqlite3_mutex_leave(db->mutex);
174637
174714
  if( rc ) return SQLITE_OK;
174638
- zCopy = sqlite3_mprintf(zName);
174715
+ zCopy = sqlite3_mprintf("%s", zName);
174639
174716
  if( zCopy==0 ) return SQLITE_NOMEM;
174640
174717
  return sqlite3_create_function_v2(db, zName, nArg, SQLITE_UTF8,
174641
174718
  zCopy, sqlite3InvalidFunction, 0, 0, sqlite3_free);
@@ -176472,6 +176549,9 @@ SQLITE_API int sqlite3_file_control(sqlite3 *db, const char *zDbName, int op, vo
176472
176549
  sqlite3BtreeSetPageSize(pBtree, 0, iNew, 0);
176473
176550
  }
176474
176551
  rc = SQLITE_OK;
176552
+ }else if( op==SQLITE_FCNTL_RESET_CACHE ){
176553
+ sqlite3BtreeClearCache(pBtree);
176554
+ rc = SQLITE_OK;
176475
176555
  }else{
176476
176556
  int nSave = db->busyHandler.nBusy;
176477
176557
  rc = sqlite3OsFileControl(fd, op, pArg);
@@ -217887,6 +217967,22 @@ static int sessionChangesetNextOne(
217887
217967
  if( p->op==SQLITE_INSERT ) p->op = SQLITE_DELETE;
217888
217968
  else if( p->op==SQLITE_DELETE ) p->op = SQLITE_INSERT;
217889
217969
  }
217970
+
217971
+ /* If this is an UPDATE that is part of a changeset, then check that
217972
+ ** there are no fields in the old.* record that are not (a) PK fields,
217973
+ ** or (b) also present in the new.* record.
217974
+ **
217975
+ ** Such records are technically corrupt, but the rebaser was at one
217976
+ ** point generating them. Under most circumstances this is benign, but
217977
+ ** can cause spurious SQLITE_RANGE errors when applying the changeset. */
217978
+ if( p->bPatchset==0 && p->op==SQLITE_UPDATE){
217979
+ for(i=0; i<p->nCol; i++){
217980
+ if( p->abPK[i]==0 && p->apValue[i+p->nCol]==0 ){
217981
+ sqlite3ValueFree(p->apValue[i]);
217982
+ p->apValue[i] = 0;
217983
+ }
217984
+ }
217985
+ }
217890
217986
  }
217891
217987
 
217892
217988
  return SQLITE_ROW;
@@ -220083,7 +220179,7 @@ static void sessionAppendPartialUpdate(
220083
220179
  if( !pIter->abPK[i] && a1[0] ) bData = 1;
220084
220180
  memcpy(pOut, a1, n1);
220085
220181
  pOut += n1;
220086
- }else if( a2[0]!=0xFF ){
220182
+ }else if( a2[0]!=0xFF && a1[0] ){
220087
220183
  bData = 1;
220088
220184
  memcpy(pOut, a2, n2);
220089
220185
  pOut += n2;
@@ -236113,7 +236209,7 @@ static void fts5CheckTransactionState(Fts5FullTable *p, int op, int iSavepoint){
236113
236209
  break;
236114
236210
 
236115
236211
  case FTS5_SYNC:
236116
- assert( p->ts.eState==1 );
236212
+ assert( p->ts.eState==1 || p->ts.eState==2 );
236117
236213
  p->ts.eState = 2;
236118
236214
  break;
236119
236215
 
@@ -236128,21 +236224,21 @@ static void fts5CheckTransactionState(Fts5FullTable *p, int op, int iSavepoint){
236128
236224
  break;
236129
236225
 
236130
236226
  case FTS5_SAVEPOINT:
236131
- assert( p->ts.eState==1 );
236227
+ assert( p->ts.eState>=1 );
236132
236228
  assert( iSavepoint>=0 );
236133
236229
  assert( iSavepoint>=p->ts.iSavepoint );
236134
236230
  p->ts.iSavepoint = iSavepoint;
236135
236231
  break;
236136
236232
 
236137
236233
  case FTS5_RELEASE:
236138
- assert( p->ts.eState==1 );
236234
+ assert( p->ts.eState>=1 );
236139
236235
  assert( iSavepoint>=0 );
236140
236236
  assert( iSavepoint<=p->ts.iSavepoint );
236141
236237
  p->ts.iSavepoint = iSavepoint-1;
236142
236238
  break;
236143
236239
 
236144
236240
  case FTS5_ROLLBACKTO:
236145
- assert( p->ts.eState==1 );
236241
+ assert( p->ts.eState>=1 );
236146
236242
  assert( iSavepoint>=-1 );
236147
236243
  /* The following assert() can fail if another vtab strikes an error
236148
236244
  ** within an xSavepoint() call then SQLite calls xRollbackTo() - without
@@ -237478,7 +237574,7 @@ static int fts5UpdateMethod(
237478
237574
  int rc = SQLITE_OK; /* Return code */
237479
237575
 
237480
237576
  /* A transaction must be open when this is called. */
237481
- assert( pTab->ts.eState==1 );
237577
+ assert( pTab->ts.eState==1 || pTab->ts.eState==2 );
237482
237578
 
237483
237579
  assert( pVtab->zErrMsg==0 );
237484
237580
  assert( nArg==1 || nArg==(2+pConfig->nCol+2) );
@@ -238646,7 +238742,7 @@ static void fts5SourceIdFunc(
238646
238742
  ){
238647
238743
  assert( nArg==0 );
238648
238744
  UNUSED_PARAM2(nArg, apUnused);
238649
- sqlite3_result_text(pCtx, "fts5: 2022-11-16 12:10:08 89c459e766ea7e9165d0beeb124708b955a4950d0f4792f457465d71b158d318", -1, SQLITE_TRANSIENT);
238745
+ sqlite3_result_text(pCtx, "fts5: 2022-12-28 14:03:47 df5c253c0b3dd24916e4ec7cf77d3db5294cc9fd45ae7b9c5e82ad8197f38a24", -1, SQLITE_TRANSIENT);
238650
238746
  }
238651
238747
 
238652
238748
  /*
@@ -243833,9 +243929,9 @@ SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
243833
243929
 
243834
243930
  #define SQLITE3MC_VERSION_MAJOR 1
243835
243931
  #define SQLITE3MC_VERSION_MINOR 5
243836
- #define SQLITE3MC_VERSION_RELEASE 4
243932
+ #define SQLITE3MC_VERSION_RELEASE 5
243837
243933
  #define SQLITE3MC_VERSION_SUBRELEASE 0
243838
- #define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 1.5.4"
243934
+ #define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 1.5.5"
243839
243935
 
243840
243936
  #endif /* SQLITE3MC_VERSION_H_ */
243841
243937
  /*** End of #include "sqlite3mc_version.h" ***/
@@ -243994,9 +244090,9 @@ extern "C" {
243994
244090
  ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
243995
244091
  ** [sqlite_version()] and [sqlite_source_id()].
243996
244092
  */
243997
- #define SQLITE_VERSION "3.40.0"
243998
- #define SQLITE_VERSION_NUMBER 3040000
243999
- #define SQLITE_SOURCE_ID "2022-11-16 12:10:08 89c459e766ea7e9165d0beeb124708b955a4950d0f4792f457465d71b158d318"
244093
+ #define SQLITE_VERSION "3.40.1"
244094
+ #define SQLITE_VERSION_NUMBER 3040001
244095
+ #define SQLITE_SOURCE_ID "2022-12-28 14:03:47 df5c253c0b3dd24916e4ec7cf77d3db5294cc9fd45ae7b9c5e82ad8197f38a24"
244000
244096
 
244001
244097
  /*
244002
244098
  ** CAPI3REF: Run-Time Library Version Numbers
@@ -245040,6 +245136,12 @@ struct sqlite3_io_methods {
245040
245136
  **
245041
245137
  ** <li>[[SQLITE_FCNTL_CKSM_FILE]]
245042
245138
  ** Used by the cksmvfs VFS module only.
245139
+ **
245140
+ ** <li>[[SQLITE_FCNTL_RESET_CACHE]]
245141
+ ** If there is currently no transaction open on the database, and the
245142
+ ** database is not a temp db, then this file-control purges the contents
245143
+ ** of the in-memory page cache. If there is an open transaction, or if
245144
+ ** the db is a temp-db, it is a no-op, not an error.
245043
245145
  ** </ul>
245044
245146
  */
245045
245147
  #define SQLITE_FCNTL_LOCKSTATE 1
@@ -245082,6 +245184,7 @@ struct sqlite3_io_methods {
245082
245184
  #define SQLITE_FCNTL_CKPT_START 39
245083
245185
  #define SQLITE_FCNTL_EXTERNAL_READER 40
245084
245186
  #define SQLITE_FCNTL_CKSM_FILE 41
245187
+ #define SQLITE_FCNTL_RESET_CACHE 42
245085
245188
 
245086
245189
  /* deprecated names */
245087
245190
  #define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
@@ -267035,7 +267138,7 @@ sqlite3mcBtreeSetPageSize(Btree* p, int pageSize, int nReserve, int iFix)
267035
267138
  ** Change 4: Call sqlite3mcBtreeSetPageSize instead of sqlite3BtreeSetPageSize for main database
267036
267139
  ** (sqlite3mcBtreeSetPageSize allows to reduce the number of reserved bytes)
267037
267140
  **
267038
- ** This code is generated by the script rekeyvacuum.sh from SQLite version 3.40.0 amalgamation.
267141
+ ** This code is generated by the script rekeyvacuum.sh from SQLite version 3.40.1 amalgamation.
267039
267142
  */
267040
267143
  SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3mcRunVacuumForRekey(
267041
267144
  char **pzErrMsg, /* Write error message here */
@@ -277233,7 +277336,7 @@ static unsigned re_next_char(ReInput *p){
277233
277336
  c = (c&0x0f)<<12 | ((p->z[p->i]&0x3f)<<6) | (p->z[p->i+1]&0x3f);
277234
277337
  p->i += 2;
277235
277338
  if( c<=0x7ff || (c>=0xd800 && c<=0xdfff) ) c = 0xfffd;
277236
- }else if( (c&0xf8)==0xf0 && p->i+3<p->mx && (p->z[p->i]&0xc0)==0x80
277339
+ }else if( (c&0xf8)==0xf0 && p->i+2<p->mx && (p->z[p->i]&0xc0)==0x80
277237
277340
  && (p->z[p->i+1]&0xc0)==0x80 && (p->z[p->i+2]&0xc0)==0x80 ){
277238
277341
  c = (c&0x07)<<18 | ((p->z[p->i]&0x3f)<<12) | ((p->z[p->i+1]&0x3f)<<6)
277239
277342
  | (p->z[p->i+2]&0x3f);
@@ -277760,15 +277863,15 @@ static const char *re_compile(ReCompiled **ppRe, const char *zIn, int noCase){
277760
277863
  ** one or more matching characters, enter those matching characters into
277761
277864
  ** zInit[]. The re_match() routine can then search ahead in the input
277762
277865
  ** string looking for the initial match without having to run the whole
277763
- ** regex engine over the string. Do not worry able trying to match
277866
+ ** regex engine over the string. Do not worry about trying to match
277764
277867
  ** unicode characters beyond plane 0 - those are very rare and this is
277765
277868
  ** just an optimization. */
277766
277869
  if( pRe->aOp[0]==RE_OP_ANYSTAR && !noCase ){
277767
277870
  for(j=0, i=1; j<(int)sizeof(pRe->zInit)-2 && pRe->aOp[i]==RE_OP_MATCH; i++){
277768
277871
  unsigned x = pRe->aArg[i];
277769
- if( x<=127 ){
277872
+ if( x<=0x7f ){
277770
277873
  pRe->zInit[j++] = (unsigned char)x;
277771
- }else if( x<=0xfff ){
277874
+ }else if( x<=0x7ff ){
277772
277875
  pRe->zInit[j++] = (unsigned char)(0xc0 | (x>>6));
277773
277876
  pRe->zInit[j++] = 0x80 | (x&0x3f);
277774
277877
  }else if( x<=0xffff ){
@@ -31,9 +31,9 @@
31
31
 
32
32
  #define SQLITE3MC_VERSION_MAJOR 1
33
33
  #define SQLITE3MC_VERSION_MINOR 5
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.5.4"
36
+ #define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 1.5.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.40.0"
196
- #define SQLITE_VERSION_NUMBER 3040000
197
- #define SQLITE_SOURCE_ID "2022-11-16 12:10:08 89c459e766ea7e9165d0beeb124708b955a4950d0f4792f457465d71b158d318"
195
+ #define SQLITE_VERSION "3.40.1"
196
+ #define SQLITE_VERSION_NUMBER 3040001
197
+ #define SQLITE_SOURCE_ID "2022-12-28 14:03:47 df5c253c0b3dd24916e4ec7cf77d3db5294cc9fd45ae7b9c5e82ad8197f38a24"
198
198
 
199
199
  /*
200
200
  ** CAPI3REF: Run-Time Library Version Numbers
@@ -1238,6 +1238,12 @@ struct sqlite3_io_methods {
1238
1238
  **
1239
1239
  ** <li>[[SQLITE_FCNTL_CKSM_FILE]]
1240
1240
  ** Used by the cksmvfs VFS module only.
1241
+ **
1242
+ ** <li>[[SQLITE_FCNTL_RESET_CACHE]]
1243
+ ** If there is currently no transaction open on the database, and the
1244
+ ** database is not a temp db, then this file-control purges the contents
1245
+ ** of the in-memory page cache. If there is an open transaction, or if
1246
+ ** the db is a temp-db, it is a no-op, not an error.
1241
1247
  ** </ul>
1242
1248
  */
1243
1249
  #define SQLITE_FCNTL_LOCKSTATE 1
@@ -1280,6 +1286,7 @@ struct sqlite3_io_methods {
1280
1286
  #define SQLITE_FCNTL_CKPT_START 39
1281
1287
  #define SQLITE_FCNTL_EXTERNAL_READER 40
1282
1288
  #define SQLITE_FCNTL_CKSM_FILE 41
1289
+ #define SQLITE_FCNTL_RESET_CACHE 42
1283
1290
 
1284
1291
  /* deprecated names */
1285
1292
  #define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-sqlite3-multiple-ciphers",
3
- "version": "8.0.1-beta.0",
3
+ "version": "8.0.2-beta.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>",