koffi 2.2.1 → 2.2.2-beta.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.
Files changed (74) hide show
  1. package/package.json +1 -1
  2. package/src/koffi/build/2.2.2-beta.1/koffi_darwin_arm64.tar.gz +0 -0
  3. package/src/koffi/build/2.2.2-beta.1/koffi_darwin_x64.tar.gz +0 -0
  4. package/src/koffi/build/2.2.2-beta.1/koffi_freebsd_arm64.tar.gz +0 -0
  5. package/src/koffi/build/2.2.2-beta.1/koffi_freebsd_ia32.tar.gz +0 -0
  6. package/src/koffi/build/2.2.2-beta.1/koffi_freebsd_x64.tar.gz +0 -0
  7. package/src/koffi/build/2.2.2-beta.1/koffi_linux_arm32hf.tar.gz +0 -0
  8. package/src/koffi/build/2.2.2-beta.1/koffi_linux_arm64.tar.gz +0 -0
  9. package/src/koffi/build/2.2.2-beta.1/koffi_linux_ia32.tar.gz +0 -0
  10. package/src/koffi/build/2.2.2-beta.1/koffi_linux_riscv64hf64.tar.gz +0 -0
  11. package/src/koffi/build/2.2.2-beta.1/koffi_linux_x64.tar.gz +0 -0
  12. package/src/koffi/build/2.2.2-beta.1/koffi_openbsd_ia32.tar.gz +0 -0
  13. package/src/koffi/build/2.2.2-beta.1/koffi_openbsd_x64.tar.gz +0 -0
  14. package/src/koffi/build/2.2.2-beta.1/koffi_win32_arm64.tar.gz +0 -0
  15. package/src/koffi/build/2.2.2-beta.1/koffi_win32_ia32.tar.gz +0 -0
  16. package/src/koffi/build/2.2.2-beta.1/koffi_win32_x64.tar.gz +0 -0
  17. package/src/koffi/qemu/qemu.js +12 -10
  18. package/src/koffi/src/abi_arm32.cc +7 -12
  19. package/src/koffi/src/abi_arm64.cc +7 -12
  20. package/src/koffi/src/abi_riscv64.cc +7 -12
  21. package/src/koffi/src/abi_x64_sysv.cc +7 -12
  22. package/src/koffi/src/abi_x64_win.cc +7 -12
  23. package/src/koffi/src/abi_x86.cc +7 -12
  24. package/src/koffi/src/call.cc +51 -2
  25. package/src/koffi/src/call.hh +6 -1
  26. package/src/koffi/src/ffi.cc +61 -7
  27. package/src/koffi/src/ffi.hh +2 -0
  28. package/src/koffi/src/index.js +6 -2
  29. package/src/koffi/test/CMakeLists.txt +1 -1
  30. package/src/koffi/test/async.js +3 -0
  31. package/src/koffi/test/callbacks.js +11 -0
  32. package/vendor/{sqlite3mc → sqlite3}/sqlite3.c +139 -43
  33. package/vendor/{sqlite3mc → sqlite3}/sqlite3.h +10 -3
  34. package/vendor/{sqlite3mc → sqlite3}/sqlite3ext.h +0 -0
  35. package/vendor/{sqlite3mc → sqlite3}/sqlite3mc.c +156 -53
  36. package/vendor/{sqlite3mc → sqlite3}/sqlite3mc.def +0 -0
  37. package/vendor/{sqlite3mc → sqlite3}/sqlite3mc.h +12 -5
  38. package/vendor/sqlite3/wasm/README.txt +23 -0
  39. package/vendor/sqlite3/wasm/common/SqliteTestUtil.js +236 -0
  40. package/vendor/sqlite3/wasm/common/emscripten.css +24 -0
  41. package/vendor/sqlite3/wasm/common/testing.css +63 -0
  42. package/vendor/sqlite3/wasm/demo-123-worker.html +44 -0
  43. package/vendor/sqlite3/wasm/demo-123.html +24 -0
  44. package/vendor/sqlite3/wasm/demo-123.js +289 -0
  45. package/vendor/sqlite3/wasm/demo-jsstorage.html +49 -0
  46. package/vendor/sqlite3/wasm/demo-jsstorage.js +114 -0
  47. package/vendor/sqlite3/wasm/demo-worker1-promiser.html +34 -0
  48. package/vendor/sqlite3/wasm/demo-worker1-promiser.js +270 -0
  49. package/vendor/sqlite3/wasm/demo-worker1.html +34 -0
  50. package/vendor/sqlite3/wasm/demo-worker1.js +345 -0
  51. package/vendor/sqlite3/wasm/index.html +90 -0
  52. package/vendor/sqlite3/wasm/jswasm/sqlite3-opfs-async-proxy.js +830 -0
  53. package/vendor/sqlite3/wasm/jswasm/sqlite3-worker1-promiser.js +259 -0
  54. package/vendor/sqlite3/wasm/jswasm/sqlite3-worker1.js +49 -0
  55. package/vendor/sqlite3/wasm/jswasm/sqlite3.js +10119 -0
  56. package/vendor/sqlite3/wasm/jswasm/sqlite3.wasm +0 -0
  57. package/vendor/sqlite3/wasm/tester1-worker.html +63 -0
  58. package/vendor/sqlite3/wasm/tester1.html +28 -0
  59. package/vendor/sqlite3/wasm/tester1.js +1864 -0
  60. package/src/koffi/build/2.2.1/koffi_darwin_arm64.tar.gz +0 -0
  61. package/src/koffi/build/2.2.1/koffi_darwin_x64.tar.gz +0 -0
  62. package/src/koffi/build/2.2.1/koffi_freebsd_arm64.tar.gz +0 -0
  63. package/src/koffi/build/2.2.1/koffi_freebsd_ia32.tar.gz +0 -0
  64. package/src/koffi/build/2.2.1/koffi_freebsd_x64.tar.gz +0 -0
  65. package/src/koffi/build/2.2.1/koffi_linux_arm32hf.tar.gz +0 -0
  66. package/src/koffi/build/2.2.1/koffi_linux_arm64.tar.gz +0 -0
  67. package/src/koffi/build/2.2.1/koffi_linux_ia32.tar.gz +0 -0
  68. package/src/koffi/build/2.2.1/koffi_linux_riscv64hf64.tar.gz +0 -0
  69. package/src/koffi/build/2.2.1/koffi_linux_x64.tar.gz +0 -0
  70. package/src/koffi/build/2.2.1/koffi_openbsd_ia32.tar.gz +0 -0
  71. package/src/koffi/build/2.2.1/koffi_openbsd_x64.tar.gz +0 -0
  72. package/src/koffi/build/2.2.1/koffi_win32_arm64.tar.gz +0 -0
  73. package/src/koffi/build/2.2.1/koffi_win32_ia32.tar.gz +0 -0
  74. package/src/koffi/build/2.2.1/koffi_win32_x64.tar.gz +0 -0
@@ -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
 
@@ -37449,6 +37462,9 @@ static int robust_open(const char *z, int f, mode_t m){
37449
37462
  break;
37450
37463
  }
37451
37464
  if( fd>=SQLITE_MINIMUM_FILE_DESCRIPTOR ) break;
37465
+ if( (f & (O_EXCL|O_CREAT))==(O_EXCL|O_CREAT) ){
37466
+ (void)osUnlink(z);
37467
+ }
37452
37468
  osClose(fd);
37453
37469
  sqlite3_log(SQLITE_WARNING,
37454
37470
  "attempt to open \"%s\" as file descriptor %d", z, fd);
@@ -51182,6 +51198,7 @@ static int memdbTruncate(sqlite3_file*, sqlite3_int64 size);
51182
51198
  static int memdbSync(sqlite3_file*, int flags);
51183
51199
  static int memdbFileSize(sqlite3_file*, sqlite3_int64 *pSize);
51184
51200
  static int memdbLock(sqlite3_file*, int);
51201
+ static int memdbUnlock(sqlite3_file*, int);
51185
51202
  /* static int memdbCheckReservedLock(sqlite3_file*, int *pResOut);// not used */
51186
51203
  static int memdbFileControl(sqlite3_file*, int op, void *pArg);
51187
51204
  /* static int memdbSectorSize(sqlite3_file*); // not used */
@@ -51240,7 +51257,7 @@ static const sqlite3_io_methods memdb_io_methods = {
51240
51257
  memdbSync, /* xSync */
51241
51258
  memdbFileSize, /* xFileSize */
51242
51259
  memdbLock, /* xLock */
51243
- memdbLock, /* xUnlock - same as xLock in this case */
51260
+ memdbUnlock, /* xUnlock */
51244
51261
  0, /* memdbCheckReservedLock, */ /* xCheckReservedLock */
51245
51262
  memdbFileControl, /* xFileControl */
51246
51263
  0, /* memdbSectorSize,*/ /* xSectorSize */
@@ -51441,39 +51458,81 @@ static int memdbLock(sqlite3_file *pFile, int eLock){
51441
51458
  MemFile *pThis = (MemFile*)pFile;
51442
51459
  MemStore *p = pThis->pStore;
51443
51460
  int rc = SQLITE_OK;
51444
- if( eLock==pThis->eLock ) return SQLITE_OK;
51461
+ if( eLock<=pThis->eLock ) return SQLITE_OK;
51445
51462
  memdbEnter(p);
51446
- if( eLock>SQLITE_LOCK_SHARED ){
51447
- if( p->mFlags & SQLITE_DESERIALIZE_READONLY ){
51448
- rc = SQLITE_READONLY;
51449
- }else if( pThis->eLock<=SQLITE_LOCK_SHARED ){
51450
- if( p->nWrLock ){
51451
- rc = SQLITE_BUSY;
51452
- }else{
51453
- p->nWrLock = 1;
51463
+
51464
+ assert( p->nWrLock==0 || p->nWrLock==1 );
51465
+ assert( pThis->eLock<=SQLITE_LOCK_SHARED || p->nWrLock==1 );
51466
+ assert( pThis->eLock==SQLITE_LOCK_NONE || p->nRdLock>=1 );
51467
+
51468
+ if( eLock>SQLITE_LOCK_SHARED && (p->mFlags & SQLITE_DESERIALIZE_READONLY) ){
51469
+ rc = SQLITE_READONLY;
51470
+ }else{
51471
+ switch( eLock ){
51472
+ case SQLITE_LOCK_SHARED: {
51473
+ assert( pThis->eLock==SQLITE_LOCK_NONE );
51474
+ if( p->nWrLock>0 ){
51475
+ rc = SQLITE_BUSY;
51476
+ }else{
51477
+ p->nRdLock++;
51478
+ }
51479
+ break;
51480
+ };
51481
+
51482
+ case SQLITE_LOCK_RESERVED:
51483
+ case SQLITE_LOCK_PENDING: {
51484
+ assert( pThis->eLock>=SQLITE_LOCK_SHARED );
51485
+ if( ALWAYS(pThis->eLock==SQLITE_LOCK_SHARED) ){
51486
+ if( p->nWrLock>0 ){
51487
+ rc = SQLITE_BUSY;
51488
+ }else{
51489
+ p->nWrLock = 1;
51490
+ }
51491
+ }
51492
+ break;
51493
+ }
51494
+
51495
+ default: {
51496
+ assert( eLock==SQLITE_LOCK_EXCLUSIVE );
51497
+ assert( pThis->eLock>=SQLITE_LOCK_SHARED );
51498
+ if( p->nRdLock>1 ){
51499
+ rc = SQLITE_BUSY;
51500
+ }else if( pThis->eLock==SQLITE_LOCK_SHARED ){
51501
+ p->nWrLock = 1;
51502
+ }
51503
+ break;
51454
51504
  }
51455
51505
  }
51456
- }else if( eLock==SQLITE_LOCK_SHARED ){
51457
- if( pThis->eLock > SQLITE_LOCK_SHARED ){
51458
- assert( p->nWrLock==1 );
51459
- p->nWrLock = 0;
51460
- }else if( p->nWrLock ){
51461
- rc = SQLITE_BUSY;
51462
- }else{
51463
- p->nRdLock++;
51506
+ }
51507
+ if( rc==SQLITE_OK ) pThis->eLock = eLock;
51508
+ memdbLeave(p);
51509
+ return rc;
51510
+ }
51511
+
51512
+ /*
51513
+ ** Unlock an memdb-file.
51514
+ */
51515
+ static int memdbUnlock(sqlite3_file *pFile, int eLock){
51516
+ MemFile *pThis = (MemFile*)pFile;
51517
+ MemStore *p = pThis->pStore;
51518
+ if( eLock>=pThis->eLock ) return SQLITE_OK;
51519
+ memdbEnter(p);
51520
+
51521
+ assert( eLock==SQLITE_LOCK_SHARED || eLock==SQLITE_LOCK_NONE );
51522
+ if( eLock==SQLITE_LOCK_SHARED ){
51523
+ if( ALWAYS(pThis->eLock>SQLITE_LOCK_SHARED) ){
51524
+ p->nWrLock--;
51464
51525
  }
51465
51526
  }else{
51466
- assert( eLock==SQLITE_LOCK_NONE );
51467
51527
  if( pThis->eLock>SQLITE_LOCK_SHARED ){
51468
- assert( p->nWrLock==1 );
51469
- p->nWrLock = 0;
51528
+ p->nWrLock--;
51470
51529
  }
51471
- assert( p->nRdLock>0 );
51472
51530
  p->nRdLock--;
51473
51531
  }
51474
- if( rc==SQLITE_OK ) pThis->eLock = eLock;
51532
+
51533
+ pThis->eLock = eLock;
51475
51534
  memdbLeave(p);
51476
- return rc;
51535
+ return SQLITE_OK;
51477
51536
  }
51478
51537
 
51479
51538
  #if 0
@@ -51583,7 +51642,7 @@ static int memdbOpen(
51583
51642
 
51584
51643
  memset(pFile, 0, sizeof(*pFile));
51585
51644
  szName = sqlite3Strlen30(zName);
51586
- if( szName>1 && zName[0]=='/' ){
51645
+ if( szName>1 && (zName[0]=='/' || zName[0]=='\\') ){
51587
51646
  int i;
51588
51647
  #ifndef SQLITE_MUTEX_OMIT
51589
51648
  sqlite3_mutex *pVfsMutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_VFS1);
@@ -51930,6 +51989,13 @@ end_deserialize:
51930
51989
  return rc;
51931
51990
  }
51932
51991
 
51992
+ /*
51993
+ ** Return true if the VFS is the memvfs.
51994
+ */
51995
+ SQLITE_PRIVATE int sqlite3IsMemdb(const sqlite3_vfs *pVfs){
51996
+ return pVfs==&memdb_vfs;
51997
+ }
51998
+
51933
51999
  /*
51934
52000
  ** This routine is called when the extension is loaded.
51935
52001
  ** Register the new VFS.
@@ -79258,6 +79324,17 @@ SQLITE_PRIVATE int sqlite3BtreeIsReadonly(Btree *p){
79258
79324
  */
79259
79325
  SQLITE_PRIVATE int sqlite3HeaderSizeBtree(void){ return ROUND8(sizeof(MemPage)); }
79260
79326
 
79327
+ /*
79328
+ ** If no transaction is active and the database is not a temp-db, clear
79329
+ ** the in-memory pager cache.
79330
+ */
79331
+ SQLITE_PRIVATE void sqlite3BtreeClearCache(Btree *p){
79332
+ BtShared *pBt = p->pBt;
79333
+ if( pBt->inTransaction==TRANS_NONE ){
79334
+ sqlite3PagerClearCache(pBt->pPager);
79335
+ }
79336
+ }
79337
+
79261
79338
  #if !defined(SQLITE_OMIT_SHARED_CACHE)
79262
79339
  /*
79263
79340
  ** Return true if the Btree passed as the only argument is sharable.
@@ -83497,7 +83574,7 @@ SQLITE_PRIVATE void sqlite3VdbeAppendP4(Vdbe *p, void *pP4, int n){
83497
83574
  if( p->db->mallocFailed ){
83498
83575
  freeP4(p->db, n, pP4);
83499
83576
  }else{
83500
- assert( pP4!=0 );
83577
+ assert( pP4!=0 || n==P4_DYNAMIC );
83501
83578
  assert( p->nOp>0 );
83502
83579
  pOp = &p->aOp[p->nOp-1];
83503
83580
  assert( pOp->p4type==P4_NOTUSED );
@@ -132414,7 +132491,7 @@ static const sqlite3_api_routines sqlite3Apis = {
132414
132491
  #endif
132415
132492
  sqlite3_db_name,
132416
132493
  /* Version 3.40.0 and later */
132417
- sqlite3_value_type
132494
+ sqlite3_value_encoding
132418
132495
  };
132419
132496
 
132420
132497
  /* True if x is the directory separator character
@@ -145555,7 +145632,7 @@ SQLITE_PRIVATE Trigger *sqlite3TriggerList(Parse *pParse, Table *pTab){
145555
145632
  if( pTrig->pTabSchema==pTab->pSchema
145556
145633
  && pTrig->table
145557
145634
  && 0==sqlite3StrICmp(pTrig->table, pTab->zName)
145558
- && pTrig->pTabSchema!=pTmpSchema
145635
+ && (pTrig->pTabSchema!=pTmpSchema || pTrig->bReturning)
145559
145636
  ){
145560
145637
  pTrig->pNext = pList;
145561
145638
  pList = pTrig;
@@ -155739,7 +155816,7 @@ SQLITE_PRIVATE int sqlite3WhereIsDistinct(WhereInfo *pWInfo){
155739
155816
  ** block sorting is required.
155740
155817
  */
155741
155818
  SQLITE_PRIVATE int sqlite3WhereIsOrdered(WhereInfo *pWInfo){
155742
- return pWInfo->nOBSat;
155819
+ return pWInfo->nOBSat<0 ? 0 : pWInfo->nOBSat;
155743
155820
  }
155744
155821
 
155745
155822
  /*
@@ -174647,7 +174724,7 @@ SQLITE_API int sqlite3_overload_function(
174647
174724
  rc = sqlite3FindFunction(db, zName, nArg, SQLITE_UTF8, 0)!=0;
174648
174725
  sqlite3_mutex_leave(db->mutex);
174649
174726
  if( rc ) return SQLITE_OK;
174650
- zCopy = sqlite3_mprintf(zName);
174727
+ zCopy = sqlite3_mprintf("%s", zName);
174651
174728
  if( zCopy==0 ) return SQLITE_NOMEM;
174652
174729
  return sqlite3_create_function_v2(db, zName, nArg, SQLITE_UTF8,
174653
174730
  zCopy, sqlite3InvalidFunction, 0, 0, sqlite3_free);
@@ -176484,6 +176561,9 @@ SQLITE_API int sqlite3_file_control(sqlite3 *db, const char *zDbName, int op, vo
176484
176561
  sqlite3BtreeSetPageSize(pBtree, 0, iNew, 0);
176485
176562
  }
176486
176563
  rc = SQLITE_OK;
176564
+ }else if( op==SQLITE_FCNTL_RESET_CACHE ){
176565
+ sqlite3BtreeClearCache(pBtree);
176566
+ rc = SQLITE_OK;
176487
176567
  }else{
176488
176568
  int nSave = db->busyHandler.nBusy;
176489
176569
  rc = sqlite3OsFileControl(fd, op, pArg);
@@ -217899,6 +217979,22 @@ static int sessionChangesetNextOne(
217899
217979
  if( p->op==SQLITE_INSERT ) p->op = SQLITE_DELETE;
217900
217980
  else if( p->op==SQLITE_DELETE ) p->op = SQLITE_INSERT;
217901
217981
  }
217982
+
217983
+ /* If this is an UPDATE that is part of a changeset, then check that
217984
+ ** there are no fields in the old.* record that are not (a) PK fields,
217985
+ ** or (b) also present in the new.* record.
217986
+ **
217987
+ ** Such records are technically corrupt, but the rebaser was at one
217988
+ ** point generating them. Under most circumstances this is benign, but
217989
+ ** can cause spurious SQLITE_RANGE errors when applying the changeset. */
217990
+ if( p->bPatchset==0 && p->op==SQLITE_UPDATE){
217991
+ for(i=0; i<p->nCol; i++){
217992
+ if( p->abPK[i]==0 && p->apValue[i+p->nCol]==0 ){
217993
+ sqlite3ValueFree(p->apValue[i]);
217994
+ p->apValue[i] = 0;
217995
+ }
217996
+ }
217997
+ }
217902
217998
  }
217903
217999
 
217904
218000
  return SQLITE_ROW;
@@ -220095,7 +220191,7 @@ static void sessionAppendPartialUpdate(
220095
220191
  if( !pIter->abPK[i] && a1[0] ) bData = 1;
220096
220192
  memcpy(pOut, a1, n1);
220097
220193
  pOut += n1;
220098
- }else if( a2[0]!=0xFF ){
220194
+ }else if( a2[0]!=0xFF && a1[0] ){
220099
220195
  bData = 1;
220100
220196
  memcpy(pOut, a2, n2);
220101
220197
  pOut += n2;
@@ -236125,7 +236221,7 @@ static void fts5CheckTransactionState(Fts5FullTable *p, int op, int iSavepoint){
236125
236221
  break;
236126
236222
 
236127
236223
  case FTS5_SYNC:
236128
- assert( p->ts.eState==1 );
236224
+ assert( p->ts.eState==1 || p->ts.eState==2 );
236129
236225
  p->ts.eState = 2;
236130
236226
  break;
236131
236227
 
@@ -236140,21 +236236,21 @@ static void fts5CheckTransactionState(Fts5FullTable *p, int op, int iSavepoint){
236140
236236
  break;
236141
236237
 
236142
236238
  case FTS5_SAVEPOINT:
236143
- assert( p->ts.eState==1 );
236239
+ assert( p->ts.eState>=1 );
236144
236240
  assert( iSavepoint>=0 );
236145
236241
  assert( iSavepoint>=p->ts.iSavepoint );
236146
236242
  p->ts.iSavepoint = iSavepoint;
236147
236243
  break;
236148
236244
 
236149
236245
  case FTS5_RELEASE:
236150
- assert( p->ts.eState==1 );
236246
+ assert( p->ts.eState>=1 );
236151
236247
  assert( iSavepoint>=0 );
236152
236248
  assert( iSavepoint<=p->ts.iSavepoint );
236153
236249
  p->ts.iSavepoint = iSavepoint-1;
236154
236250
  break;
236155
236251
 
236156
236252
  case FTS5_ROLLBACKTO:
236157
- assert( p->ts.eState==1 );
236253
+ assert( p->ts.eState>=1 );
236158
236254
  assert( iSavepoint>=-1 );
236159
236255
  /* The following assert() can fail if another vtab strikes an error
236160
236256
  ** within an xSavepoint() call then SQLite calls xRollbackTo() - without
@@ -237490,7 +237586,7 @@ static int fts5UpdateMethod(
237490
237586
  int rc = SQLITE_OK; /* Return code */
237491
237587
 
237492
237588
  /* A transaction must be open when this is called. */
237493
- assert( pTab->ts.eState==1 );
237589
+ assert( pTab->ts.eState==1 || pTab->ts.eState==2 );
237494
237590
 
237495
237591
  assert( pVtab->zErrMsg==0 );
237496
237592
  assert( nArg==1 || nArg==(2+pConfig->nCol+2) );
@@ -238658,7 +238754,7 @@ static void fts5SourceIdFunc(
238658
238754
  ){
238659
238755
  assert( nArg==0 );
238660
238756
  UNUSED_PARAM2(nArg, apUnused);
238661
- sqlite3_result_text(pCtx, "fts5: 2022-11-16 12:10:08 89c459e766ea7e9165d0beeb124708b955a4950d0f4792f457465d71b158d318", -1, SQLITE_TRANSIENT);
238757
+ sqlite3_result_text(pCtx, "fts5: 2022-12-28 14:03:47 df5c253c0b3dd24916e4ec7cf77d3db5294cc9fd45ae7b9c5e82ad8197f38a24", -1, SQLITE_TRANSIENT);
238662
238758
  }
238663
238759
 
238664
238760
  /*
@@ -243845,9 +243941,9 @@ SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
243845
243941
 
243846
243942
  #define SQLITE3MC_VERSION_MAJOR 1
243847
243943
  #define SQLITE3MC_VERSION_MINOR 5
243848
- #define SQLITE3MC_VERSION_RELEASE 4
243944
+ #define SQLITE3MC_VERSION_RELEASE 5
243849
243945
  #define SQLITE3MC_VERSION_SUBRELEASE 0
243850
- #define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 1.5.4"
243946
+ #define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 1.5.5"
243851
243947
 
243852
243948
  #endif /* SQLITE3MC_VERSION_H_ */
243853
243949
  /*** End of #include "sqlite3mc_version.h" ***/
@@ -244006,9 +244102,9 @@ extern "C" {
244006
244102
  ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
244007
244103
  ** [sqlite_version()] and [sqlite_source_id()].
244008
244104
  */
244009
- #define SQLITE_VERSION "3.40.0"
244010
- #define SQLITE_VERSION_NUMBER 3040000
244011
- #define SQLITE_SOURCE_ID "2022-11-16 12:10:08 89c459e766ea7e9165d0beeb124708b955a4950d0f4792f457465d71b158d318"
244105
+ #define SQLITE_VERSION "3.40.1"
244106
+ #define SQLITE_VERSION_NUMBER 3040001
244107
+ #define SQLITE_SOURCE_ID "2022-12-28 14:03:47 df5c253c0b3dd24916e4ec7cf77d3db5294cc9fd45ae7b9c5e82ad8197f38a24"
244012
244108
 
244013
244109
  /*
244014
244110
  ** CAPI3REF: Run-Time Library Version Numbers
@@ -245052,6 +245148,12 @@ struct sqlite3_io_methods {
245052
245148
  **
245053
245149
  ** <li>[[SQLITE_FCNTL_CKSM_FILE]]
245054
245150
  ** Used by the cksmvfs VFS module only.
245151
+ **
245152
+ ** <li>[[SQLITE_FCNTL_RESET_CACHE]]
245153
+ ** If there is currently no transaction open on the database, and the
245154
+ ** database is not a temp db, then this file-control purges the contents
245155
+ ** of the in-memory page cache. If there is an open transaction, or if
245156
+ ** the db is a temp-db, it is a no-op, not an error.
245055
245157
  ** </ul>
245056
245158
  */
245057
245159
  #define SQLITE_FCNTL_LOCKSTATE 1
@@ -245094,6 +245196,7 @@ struct sqlite3_io_methods {
245094
245196
  #define SQLITE_FCNTL_CKPT_START 39
245095
245197
  #define SQLITE_FCNTL_EXTERNAL_READER 40
245096
245198
  #define SQLITE_FCNTL_CKSM_FILE 41
245199
+ #define SQLITE_FCNTL_RESET_CACHE 42
245097
245200
 
245098
245201
  /* deprecated names */
245099
245202
  #define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
@@ -267039,7 +267142,7 @@ sqlite3mcBtreeSetPageSize(Btree* p, int pageSize, int nReserve, int iFix)
267039
267142
  ** Change 4: Call sqlite3mcBtreeSetPageSize instead of sqlite3BtreeSetPageSize for main database
267040
267143
  ** (sqlite3mcBtreeSetPageSize allows to reduce the number of reserved bytes)
267041
267144
  **
267042
- ** This code is generated by the script rekeyvacuum.sh from SQLite version 3.40.0 amalgamation.
267145
+ ** This code is generated by the script rekeyvacuum.sh from SQLite version 3.40.1 amalgamation.
267043
267146
  */
267044
267147
  SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3mcRunVacuumForRekey(
267045
267148
  char **pzErrMsg, /* Write error message here */
@@ -277237,7 +277340,7 @@ static unsigned re_next_char(ReInput *p){
277237
277340
  c = (c&0x0f)<<12 | ((p->z[p->i]&0x3f)<<6) | (p->z[p->i+1]&0x3f);
277238
277341
  p->i += 2;
277239
277342
  if( c<=0x7ff || (c>=0xd800 && c<=0xdfff) ) c = 0xfffd;
277240
- }else if( (c&0xf8)==0xf0 && p->i+3<p->mx && (p->z[p->i]&0xc0)==0x80
277343
+ }else if( (c&0xf8)==0xf0 && p->i+2<p->mx && (p->z[p->i]&0xc0)==0x80
277241
277344
  && (p->z[p->i+1]&0xc0)==0x80 && (p->z[p->i+2]&0xc0)==0x80 ){
277242
277345
  c = (c&0x07)<<18 | ((p->z[p->i]&0x3f)<<12) | ((p->z[p->i+1]&0x3f)<<6)
277243
277346
  | (p->z[p->i+2]&0x3f);
@@ -277764,15 +277867,15 @@ static const char *re_compile(ReCompiled **ppRe, const char *zIn, int noCase){
277764
277867
  ** one or more matching characters, enter those matching characters into
277765
277868
  ** zInit[]. The re_match() routine can then search ahead in the input
277766
277869
  ** string looking for the initial match without having to run the whole
277767
- ** regex engine over the string. Do not worry able trying to match
277870
+ ** regex engine over the string. Do not worry about trying to match
277768
277871
  ** unicode characters beyond plane 0 - those are very rare and this is
277769
277872
  ** just an optimization. */
277770
277873
  if( pRe->aOp[0]==RE_OP_ANYSTAR && !noCase ){
277771
277874
  for(j=0, i=1; j<(int)sizeof(pRe->zInit)-2 && pRe->aOp[i]==RE_OP_MATCH; i++){
277772
277875
  unsigned x = pRe->aArg[i];
277773
- if( x<=127 ){
277876
+ if( x<=0x7f ){
277774
277877
  pRe->zInit[j++] = (unsigned char)x;
277775
- }else if( x<=0xfff ){
277878
+ }else if( x<=0x7ff ){
277776
277879
  pRe->zInit[j++] = (unsigned char)(0xc0 | (x>>6));
277777
277880
  pRe->zInit[j++] = 0x80 | (x&0x3f);
277778
277881
  }else if( x<=0xffff ){
File without changes
@@ -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
@@ -0,0 +1,23 @@
1
+ This is the README for the sqlite3 WASM/JS distribution.
2
+
3
+ Main project page: https://sqlite.org
4
+
5
+ Documentation: https://sqlite.org/wasm
6
+
7
+ This archive contains the sqlite3.js and sqlite3.wasm file which make
8
+ up the sqlite3 WASM/JS build.
9
+
10
+ The jswasm directory contains the core sqlite3 deliverables and the
11
+ top-level directory contains demonstration and test apps. Browsers
12
+ will not serve WASM files from file:// URLs, so the demo/test apps
13
+ require a web server and that server must include the following
14
+ headers in its response when serving the files:
15
+
16
+ Cross-Origin-Opener-Policy: same-origin
17
+ Cross-Origin-Embedder-Policy: require-corp
18
+
19
+ One simple way to get the demo apps up and running on Unix-style
20
+ systems is to install althttpd (https://sqlite.org/althttpd) and run:
21
+
22
+ althttpd --enable-sab --page index.html
23
+