Fossil SCM

Update the built-in SQLite to a new 3.54.0 beta after some important fixes, for testing.

drh 2026-10-06 18:57 UTC trunk
Commit 2d6bfabc9e6cd315f99892e525dc2749b6467d27478830d638dc93f9de6f6fbc
+18 -12
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -30903,20 +30903,24 @@
3090330903
"open";
3090430904
#else
3090530905
"xdg-open";
3090630906
#endif
3090730907
char *zCmd;
30908
+#ifdef __linux__
30909
+ zCmd = sqlite3_mprintf("%s %s 2>/dev/null", zXdgOpenCmd, p->zTempFile);
30910
+#else
3090830911
zCmd = sqlite3_mprintf("%s %s", zXdgOpenCmd, p->zTempFile);
30912
+#endif
3090930913
if( system(zCmd) ){
3091030914
cli_printf(stderr,"Failed: [%s]\n", zCmd);
3091130915
}else{
3091230916
/* Give the start/open/xdg-open command some time to get
3091330917
** going before we continue and potentially delete the
3091430918
** p->zTempFile data file out from under it */
3091530919
p->aUnlink = realloc(p->aUnlink, sizeof(Unlink)*(1+p->nUnlink));
3091630920
shell_check_oom(p->aUnlink);
30917
- p->aUnlink[p->nUnlink].tm = timeOfDay()+10000;
30921
+ p->aUnlink[p->nUnlink].tm = timeOfDay()+10000000;
3091830922
p->aUnlink[p->nUnlink].zFN = p->zTempFile;
3091930923
p->nUnlink++;
3092030924
p->zTempFile = 0;
3092130925
}
3092230926
sqlite3_free(zCmd);
@@ -31353,12 +31357,13 @@
3135331357
#endif
3135431358
if( rc && pRetry && pRetry[0] ){
3135531359
sqlite3_sleep(pRetry[0]);
3135631360
pRetry[0] = 0;
3135731361
continue;
31362
+ }else{
31363
+ break;
3135831364
}
31359
- break;
3136031365
}
3136131366
return rc;
3136231367
}
3136331368
3136431369
/*
@@ -31377,27 +31382,24 @@
3137731382
**
3137831383
** If nDelay is non-zero and a deletion attempt is not successful,
3137931384
** wait for nDelay milliseconds and try again before giving up. Only
3138031385
** a single wait occurs, even if problems are encountered with multiple
3138131386
** temp files. Only the first problem seen takes the delay. Thus
31382
-** the total delay never exceeds nDelay milliseconds. When nDelay
31383
-** is non-zero, memory used to hold the filename is reclaimed regardless
31384
-** of whether or not the temporary files were successfully deleted.
31387
+** the total delay never exceeds nDelay milliseconds.
3138531388
**
3138631389
** If bForce is true, deletion is attempted on p->aUnlink[] files
3138731390
** even if their time has not expired. However, there is a pause
31388
-** of up to nDelay milliseconds before doing the deletion.
31389
-**
31390
-** When nDelay is zero and the deletion attempt fails, memory used to
31391
-** store temporary filesnames is not reclaimed.
31391
+** of up to nDelay milliseconds before doing the deletion. Memory
31392
+** used to hold filenames is reclaimed regardless of whether or not
31393
+** the delete is successful.
3139231394
**
3139331395
** The bForce flag is used only when the process is about to exit. When
3139431396
** bForce is set, that indicates that this is our last opportunity to
3139531397
** clean up temporary files.
3139631398
*/
3139731399
static void clearTempFile(ShellState *p, int nDelay, int bForce){
31398
- int alwaysFree = (nDelay>0) || bForce;
31400
+ int alwaysFree = bForce;
3139931401
int rc = 0;
3140031402
if( p->zTempFile && (!p->doXdgOpen || bForce) ){
3140131403
rc = shellDeleteFile(p->zTempFile, &nDelay);
3140231404
if( rc==0 || alwaysFree ){
3140331405
sqlite3_free(p->zTempFile);
@@ -31409,11 +31411,15 @@
3140931411
for(i=0; i<p->nUnlink; i++){
3141031412
sqlite3_int64 tmToGo = p->aUnlink[i].tm - timeOfDay();
3141131413
int doDelete = tmToGo<=0;
3141231414
if( !doDelete && alwaysFree ){
3141331415
int tmSleep = nDelay;
31414
- if( tmSleep > tmToGo ) tmSleep = (int)tmToGo;
31416
+ if( tmSleep > tmToGo/1000 ) tmSleep = (int)(tmToGo/1000);
31417
+ if( tmSleep>=1000 ){
31418
+ cli_printf(p->out,"Waiting about %d.%d seconds to delete temp"
31419
+ " file(s)\n", tmSleep/1000, (tmSleep/100)%10);
31420
+ }
3141531421
sqlite3_sleep(tmSleep);
3141631422
nDelay -= tmSleep;
3141731423
doDelete = 1;
3141831424
}
3141931425
if( doDelete ){
@@ -39601,11 +39607,11 @@
3960139607
}
3960239608
}
3960339609
find_home_dir(1);
3960439610
output_reset(&data);
3960539611
data.doXdgOpen = 0;
39606
- clearTempFile(&data,2500,1);
39612
+ clearTempFile(&data,10000,1);
3960739613
globalShellState = 0;
3960839614
while( data.nModeStack ) modePop(&data);
3960939615
free(data.aModeStack);
3961039616
modeFree(&data.mode);
3961139617
if( data.nSavedModes ){
3961239618
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -30903,20 +30903,24 @@
30903 "open";
30904 #else
30905 "xdg-open";
30906 #endif
30907 char *zCmd;
 
 
 
30908 zCmd = sqlite3_mprintf("%s %s", zXdgOpenCmd, p->zTempFile);
 
30909 if( system(zCmd) ){
30910 cli_printf(stderr,"Failed: [%s]\n", zCmd);
30911 }else{
30912 /* Give the start/open/xdg-open command some time to get
30913 ** going before we continue and potentially delete the
30914 ** p->zTempFile data file out from under it */
30915 p->aUnlink = realloc(p->aUnlink, sizeof(Unlink)*(1+p->nUnlink));
30916 shell_check_oom(p->aUnlink);
30917 p->aUnlink[p->nUnlink].tm = timeOfDay()+10000;
30918 p->aUnlink[p->nUnlink].zFN = p->zTempFile;
30919 p->nUnlink++;
30920 p->zTempFile = 0;
30921 }
30922 sqlite3_free(zCmd);
@@ -31353,12 +31357,13 @@
31353 #endif
31354 if( rc && pRetry && pRetry[0] ){
31355 sqlite3_sleep(pRetry[0]);
31356 pRetry[0] = 0;
31357 continue;
 
 
31358 }
31359 break;
31360 }
31361 return rc;
31362 }
31363
31364 /*
@@ -31377,27 +31382,24 @@
31377 **
31378 ** If nDelay is non-zero and a deletion attempt is not successful,
31379 ** wait for nDelay milliseconds and try again before giving up. Only
31380 ** a single wait occurs, even if problems are encountered with multiple
31381 ** temp files. Only the first problem seen takes the delay. Thus
31382 ** the total delay never exceeds nDelay milliseconds. When nDelay
31383 ** is non-zero, memory used to hold the filename is reclaimed regardless
31384 ** of whether or not the temporary files were successfully deleted.
31385 **
31386 ** If bForce is true, deletion is attempted on p->aUnlink[] files
31387 ** even if their time has not expired. However, there is a pause
31388 ** of up to nDelay milliseconds before doing the deletion.
31389 **
31390 ** When nDelay is zero and the deletion attempt fails, memory used to
31391 ** store temporary filesnames is not reclaimed.
31392 **
31393 ** The bForce flag is used only when the process is about to exit. When
31394 ** bForce is set, that indicates that this is our last opportunity to
31395 ** clean up temporary files.
31396 */
31397 static void clearTempFile(ShellState *p, int nDelay, int bForce){
31398 int alwaysFree = (nDelay>0) || bForce;
31399 int rc = 0;
31400 if( p->zTempFile && (!p->doXdgOpen || bForce) ){
31401 rc = shellDeleteFile(p->zTempFile, &nDelay);
31402 if( rc==0 || alwaysFree ){
31403 sqlite3_free(p->zTempFile);
@@ -31409,11 +31411,15 @@
31409 for(i=0; i<p->nUnlink; i++){
31410 sqlite3_int64 tmToGo = p->aUnlink[i].tm - timeOfDay();
31411 int doDelete = tmToGo<=0;
31412 if( !doDelete && alwaysFree ){
31413 int tmSleep = nDelay;
31414 if( tmSleep > tmToGo ) tmSleep = (int)tmToGo;
 
 
 
 
31415 sqlite3_sleep(tmSleep);
31416 nDelay -= tmSleep;
31417 doDelete = 1;
31418 }
31419 if( doDelete ){
@@ -39601,11 +39607,11 @@
39601 }
39602 }
39603 find_home_dir(1);
39604 output_reset(&data);
39605 data.doXdgOpen = 0;
39606 clearTempFile(&data,2500,1);
39607 globalShellState = 0;
39608 while( data.nModeStack ) modePop(&data);
39609 free(data.aModeStack);
39610 modeFree(&data.mode);
39611 if( data.nSavedModes ){
39612
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -30903,20 +30903,24 @@
30903 "open";
30904 #else
30905 "xdg-open";
30906 #endif
30907 char *zCmd;
30908 #ifdef __linux__
30909 zCmd = sqlite3_mprintf("%s %s 2>/dev/null", zXdgOpenCmd, p->zTempFile);
30910 #else
30911 zCmd = sqlite3_mprintf("%s %s", zXdgOpenCmd, p->zTempFile);
30912 #endif
30913 if( system(zCmd) ){
30914 cli_printf(stderr,"Failed: [%s]\n", zCmd);
30915 }else{
30916 /* Give the start/open/xdg-open command some time to get
30917 ** going before we continue and potentially delete the
30918 ** p->zTempFile data file out from under it */
30919 p->aUnlink = realloc(p->aUnlink, sizeof(Unlink)*(1+p->nUnlink));
30920 shell_check_oom(p->aUnlink);
30921 p->aUnlink[p->nUnlink].tm = timeOfDay()+10000000;
30922 p->aUnlink[p->nUnlink].zFN = p->zTempFile;
30923 p->nUnlink++;
30924 p->zTempFile = 0;
30925 }
30926 sqlite3_free(zCmd);
@@ -31353,12 +31357,13 @@
31357 #endif
31358 if( rc && pRetry && pRetry[0] ){
31359 sqlite3_sleep(pRetry[0]);
31360 pRetry[0] = 0;
31361 continue;
31362 }else{
31363 break;
31364 }
 
31365 }
31366 return rc;
31367 }
31368
31369 /*
@@ -31377,27 +31382,24 @@
31382 **
31383 ** If nDelay is non-zero and a deletion attempt is not successful,
31384 ** wait for nDelay milliseconds and try again before giving up. Only
31385 ** a single wait occurs, even if problems are encountered with multiple
31386 ** temp files. Only the first problem seen takes the delay. Thus
31387 ** the total delay never exceeds nDelay milliseconds.
 
 
31388 **
31389 ** If bForce is true, deletion is attempted on p->aUnlink[] files
31390 ** even if their time has not expired. However, there is a pause
31391 ** of up to nDelay milliseconds before doing the deletion. Memory
31392 ** used to hold filenames is reclaimed regardless of whether or not
31393 ** the delete is successful.
 
31394 **
31395 ** The bForce flag is used only when the process is about to exit. When
31396 ** bForce is set, that indicates that this is our last opportunity to
31397 ** clean up temporary files.
31398 */
31399 static void clearTempFile(ShellState *p, int nDelay, int bForce){
31400 int alwaysFree = bForce;
31401 int rc = 0;
31402 if( p->zTempFile && (!p->doXdgOpen || bForce) ){
31403 rc = shellDeleteFile(p->zTempFile, &nDelay);
31404 if( rc==0 || alwaysFree ){
31405 sqlite3_free(p->zTempFile);
@@ -31409,11 +31411,15 @@
31411 for(i=0; i<p->nUnlink; i++){
31412 sqlite3_int64 tmToGo = p->aUnlink[i].tm - timeOfDay();
31413 int doDelete = tmToGo<=0;
31414 if( !doDelete && alwaysFree ){
31415 int tmSleep = nDelay;
31416 if( tmSleep > tmToGo/1000 ) tmSleep = (int)(tmToGo/1000);
31417 if( tmSleep>=1000 ){
31418 cli_printf(p->out,"Waiting about %d.%d seconds to delete temp"
31419 " file(s)\n", tmSleep/1000, (tmSleep/100)%10);
31420 }
31421 sqlite3_sleep(tmSleep);
31422 nDelay -= tmSleep;
31423 doDelete = 1;
31424 }
31425 if( doDelete ){
@@ -39601,11 +39607,11 @@
39607 }
39608 }
39609 find_home_dir(1);
39610 output_reset(&data);
39611 data.doXdgOpen = 0;
39612 clearTempFile(&data,10000,1);
39613 globalShellState = 0;
39614 while( data.nModeStack ) modePop(&data);
39615 free(data.aModeStack);
39616 modeFree(&data.mode);
39617 if( data.nSavedModes ){
39618
+59 -26
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -16,11 +16,11 @@
1616
** if you want a wrapper to interface SQLite with your choice of programming
1717
** language. The code for the "sqlite3" command-line shell is also in a
1818
** separate file. This file contains only code for the core SQLite library.
1919
**
2020
** The content in this amalgamation comes from Fossil check-in
21
-** 4bfc6e53a95d710b7f40fa9c80d8cdd1df50 with changes in files:
21
+** a435d786fe0e245e352d08d2e2ddf8c1e151 with changes in files:
2222
**
2323
**
2424
*/
2525
#ifndef SQLITE_AMALGAMATION
2626
#define SQLITE_CORE 1
@@ -467,14 +467,14 @@
467467
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
468468
** [sqlite_version()] and [sqlite_source_id()].
469469
*/
470470
#define SQLITE_VERSION "3.54.0"
471471
#define SQLITE_VERSION_NUMBER 3054000
472
-#define SQLITE_SOURCE_ID "2026-10-05 14:22:13 4bfc6e53a95d710b7f40fa9c80d8cdd1df50d69ed8614e9800f7e6a1ca5a3c29"
472
+#define SQLITE_SOURCE_ID "2026-10-06 18:52:47 a435d786fe0e245e352d08d2e2ddf8c1e15154809e3b471810cc327e9d90ef85"
473473
#define SQLITE_SCM_BRANCH "trunk"
474474
#define SQLITE_SCM_TAGS ""
475
-#define SQLITE_SCM_DATETIME "2026-10-05T14:22:13.597Z"
475
+#define SQLITE_SCM_DATETIME "2026-10-06T18:52:47.576Z"
476476
477477
/*
478478
** CAPI3REF: Run-Time Library Version Numbers
479479
** KEYWORDS: sqlite3_version sqlite3_sourceid
480480
**
@@ -47272,13 +47272,13 @@
4727247272
/* On systems that support O_TMPFILE, use that flag to create a more
4727347273
** secure temporary file that cannot be accessed by other processes
4727447274
*/
4727547275
zName = unixTempFileDir();
4727647276
if( zName
47277
- && (fd = robust_open(zName, O_RDWR|O_CREAT|O_EXCL|O_TMPFILE, 0600))>=0
47277
+ && (fd = robust_open(zName, O_RDWR|O_EXCL|O_TMPFILE, 0600))>=0
4727847278
){
47279
- rc = fillInUnixFile(pVfs, fd, pFile, zPath, ctrlFlags);
47279
+ rc = fillInUnixFile(pVfs, fd, pFile, zPath, ctrlFlags|UNIXFILE_NOLOCK);
4728047280
goto open_finished;
4728147281
}
4728247282
#endif
4728347283
rc = unixGetTempname(pVfs->mxPathname, zTmpname);
4728447284
if( rc!=SQLITE_OK ){
@@ -52305,10 +52305,32 @@
5230552305
}else{
5230652306
pp = &p->pNext;
5230752307
}
5230852308
}
5230952309
}
52310
+
52311
+/*
52312
+** Handle h is open on the *-shm file. This function zeroes the first
52313
+** 8 bytes of the file. If SQLITE_ENABLE_SETLK_TIMEOUT is defined, h may
52314
+** have been opened with FILE_FLAG_OVERLAPPED.
52315
+*/
52316
+static int winZeroSharedMemory(HANDLE h){
52317
+ u8 aZero[8] = {0,0,0,0,0,0,0,0};
52318
+ DWORD nWrite = 0;
52319
+ OVERLAPPED ovlp;
52320
+ memset(&ovlp, 0, sizeof(OVERLAPPED));
52321
+ if( !osWriteFile(h, aZero, sizeof(aZero), &nWrite, &ovlp) ){
52322
+ /* If the file was opened with FILE_FLAG_OVERLAPPED, the write may still
52323
+ ** be pending. Wait for it with GetOverlappedResult(). */
52324
+ if( osGetLastError()!=ERROR_IO_PENDING
52325
+ || !GetOverlappedResult(h, &ovlp, &nWrite, TRUE)
52326
+ ){
52327
+ nWrite = 0;
52328
+ }
52329
+ }
52330
+ return (nWrite==sizeof(aZero) ? SQLITE_OK : SQLITE_IOERR_WRITE);
52331
+}
5231052332
5231152333
/*
5231252334
** The DMS lock has not yet been taken on the shm file associated with
5231352335
** pShmNode. Take the lock. Truncate the *-shm file if required.
5231452336
** Return SQLITE_OK if successful, or an SQLite error code otherwise.
@@ -52324,11 +52346,16 @@
5232452346
** is the first process to open the file. Truncate it to zero bytes
5232552347
** in this case. */
5232652348
if( pShmNode->isReadonly ){
5232752349
rc = SQLITE_READONLY_CANTINIT;
5232852350
}else{
52329
- rc = winHandleTruncate(h, 0);
52351
+ if( SQLITE_OK!=winHandleTruncate(h, 0) ){
52352
+ /* Sometimes the truncate operation may fail because some other
52353
+ ** process is still holding an open mapping. So try to write
52354
+ ** zeroes into the start of the file instead. */
52355
+ rc = winZeroSharedMemory(h);
52356
+ }
5233052357
}
5233152358
5233252359
/* Release the EXCLUSIVE lock acquired above. */
5233352360
winUnlockFile(&h, WIN_SHM_DMS, 0, 1, 0);
5233452361
}else if( (rc & 0xFF)==SQLITE_BUSY ){
@@ -82682,11 +82709,11 @@
8268282709
assert( MX_CELL_SIZE(pBt) >= nCell );
8268382710
pTmp = pBt->pTmpSpace;
8268482711
assert( pTmp!=0 );
8268582712
rc = sqlite3PagerWrite(pLeaf->pDbPage);
8268682713
if( rc==SQLITE_OK ){
82687
- rc = insertCell(pPage, iCellIdx, pCell-4, nCell+4, pTmp, n);
82714
+ rc = insertCell(pPage, iCellIdx, pCell-4, nCell+4-(pCell[0]==2), pTmp, n);
8268882715
}
8268982716
dropCell(pLeaf, pLeaf->nCell-1, nCell, &rc);
8269082717
if( rc ) return rc;
8269182718
}
8269282719
@@ -125833,10 +125860,27 @@
125833125860
return (
125834125861
sqlite3StrICmp(db->aDb[iDb].zDbSName, zName)==0
125835125862
|| (iDb==0 && sqlite3StrICmp("main", zName)==0)
125836125863
);
125837125864
}
125865
+
125866
+/*
125867
+** If any TEMP triggers reference schema pSchema, move those triggers to
125868
+** reference the TEMP schema itself.
125869
+*/
125870
+static void detachTempTriggers(sqlite3 *db, Schema *pSchema){
125871
+ HashElem *pEntry;
125872
+ assert( db->aDb[1].pSchema );
125873
+ pEntry = sqliteHashFirst(&db->aDb[1].pSchema->trigHash);
125874
+ while( pEntry ){
125875
+ Trigger *pTrig = (Trigger*)sqliteHashData(pEntry);
125876
+ if( pTrig->pTabSchema==pSchema ){
125877
+ pTrig->pTabSchema = pTrig->pSchema;
125878
+ }
125879
+ pEntry = sqliteHashNext(pEntry);
125880
+ }
125881
+}
125838125882
125839125883
/*
125840125884
** An SQL user-function registered to do the work of an ATTACH statement. The
125841125885
** three arguments to the function come directly from an attach statement:
125842125886
**
@@ -125903,18 +125947,20 @@
125903125947
Schema *pNewSchema = sqlite3SchemaGet(db, pNewBt);
125904125948
if( pNewSchema ){
125905125949
/* Both the Btree and the new Schema were allocated successfully.
125906125950
** Close the old db and update the aDb[] slot with the new memdb
125907125951
** values. */
125952
+ detachTempTriggers(db, pNew->pSchema);
125908125953
sqlite3BtreeClose(pNew->pBt);
125909125954
pNew->pBt = pNewBt;
125910125955
pNew->pSchema = pNewSchema;
125911125956
if( db->init.iDb==0 ){
125912125957
/* Clear all eponymous virtual table instances, as they are holding
125913125958
** pointers to the schema object just freed by sqlite3BtreeClose() */
125914125959
sqlite3VtabEponymousTableClearAll(db);
125915125960
}
125961
+ sqlite3ExpirePreparedStatements(db, 1);
125916125962
}else{
125917125963
sqlite3BtreeClose(pNewBt);
125918125964
rc = SQLITE_NOMEM;
125919125965
}
125920125966
}
@@ -126082,11 +126128,10 @@
126082126128
){
126083126129
const char *zName = (const char *)sqlite3_value_text(argv[0]);
126084126130
sqlite3 *db = sqlite3_context_db_handle(context);
126085126131
int i;
126086126132
Db *pDb = 0;
126087
- HashElem *pEntry;
126088126133
char zErr[128];
126089126134
126090126135
UNUSED_PARAMETER(NotUsed);
126091126136
126092126137
if( zName==0 ) zName = "";
@@ -126109,22 +126154,11 @@
126109126154
){
126110126155
sqlite3_snprintf(sizeof(zErr),zErr, "database %s is locked", zName);
126111126156
goto detach_error;
126112126157
}
126113126158
126114
- /* If any TEMP triggers reference the schema being detached, move those
126115
- ** triggers to reference the TEMP schema itself. */
126116
- assert( db->aDb[1].pSchema );
126117
- pEntry = sqliteHashFirst(&db->aDb[1].pSchema->trigHash);
126118
- while( pEntry ){
126119
- Trigger *pTrig = (Trigger*)sqliteHashData(pEntry);
126120
- if( pTrig->pTabSchema==pDb->pSchema ){
126121
- pTrig->pTabSchema = pTrig->pSchema;
126122
- }
126123
- pEntry = sqliteHashNext(pEntry);
126124
- }
126125
-
126159
+ detachTempTriggers(db, pDb->pSchema);
126126126160
sqlite3BtreeClose(pDb->pBt);
126127126161
pDb->pBt = 0;
126128126162
pDb->pSchema = 0;
126129126163
sqlite3CollapseDatabaseArray(db);
126130126164
return;
@@ -187997,11 +188031,10 @@
187997188031
break;
187998188032
}
187999188033
zSql += 2;
188000188034
while( zSql[0] && (zSql[0]!='*' || zSql[1]!='/') ){ zSql++; }
188001188035
if( zSql[0]==0 ){
188002
- if( state==0 ) state = 2;
188003188036
pending = '/';
188004188037
goto incomplete_finish;
188005188038
}
188006188039
zSql++;
188007188040
token = tkWS;
@@ -188012,11 +188045,11 @@
188012188045
token = tkOTHER;
188013188046
break;
188014188047
}
188015188048
while( *zSql && *zSql!='\n' ){ zSql++; }
188016188049
if( *zSql==0 ){
188017
- if( state!=1 ) pending = '-';
188050
+ pending = '-';
188018188051
goto incomplete_finish;
188019188052
}
188020188053
token = tkWS;
188021188054
break;
188022188055
}
@@ -188115,16 +188148,16 @@
188115188148
}
188116188149
state = trans[state][token];
188117188150
zSql++;
188118188151
}
188119188152
incomplete_finish:
188120
- if( state==0 ) return SQLITE_EMPTY;
188153
+ if( state==0 && pending==0 ) return SQLITE_EMPTY;
188121188154
if( state==1 ) nParen = 0;
188122188155
return (i64)((((u64)nParen)<<32) |
188123188156
((u64)pending<<16) |
188124188157
((u64)statemap[state]<<8) |
188125
- (state!=1));
188158
+ (state>1 || pending!=0));
188126188159
}
188127188160
SQLITE_API int sqlite3_complete(const char *zSql){
188128188161
return sqlite3_incomplete(zSql)==0;
188129188162
}
188130188163
@@ -188615,11 +188648,11 @@
188615188648
SQLITE_API int sqlite3_initialize(void){
188616188649
/* If this build does not support writable static data (WSD) natively
188617188650
** then we have to invoke the (application-supplied) WSD initialization
188618188651
** routine before doing anything else. */
188619188652
#ifdef SQLITE_OMIT_WSD
188620
- rc = sqlite3_wsd_init(4096, 24);
188653
+ int rc = sqlite3_wsd_init(4096, 24);
188621188654
if( rc!=SQLITE_OK ){
188622188655
return rc;
188623188656
}
188624188657
#endif
188625188658
@@ -265376,11 +265409,11 @@
265376265409
int nArg, /* Number of args */
265377265410
sqlite3_value **apUnused /* Function arguments */
265378265411
){
265379265412
assert( nArg==0 );
265380265413
UNUSED_PARAM2(nArg, apUnused);
265381
- sqlite3_result_text(pCtx, "fts5: 2026-10-05 14:22:13 4bfc6e53a95d710b7f40fa9c80d8cdd1df50d69ed8614e9800f7e6a1ca5a3c29", -1, SQLITE_TRANSIENT);
265414
+ sqlite3_result_text(pCtx, "fts5: 2026-10-06 14:34:02 adacd1423f159fa4698f7e40dd1488256a13dff0b31cc90e28c3441109596ef4", -1, SQLITE_TRANSIENT);
265382265415
}
265383265416
265384265417
/*
265385265418
** Implementation of fts5_locale(LOCALE, TEXT) function.
265386265419
**
265387265420
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -16,11 +16,11 @@
16 ** if you want a wrapper to interface SQLite with your choice of programming
17 ** language. The code for the "sqlite3" command-line shell is also in a
18 ** separate file. This file contains only code for the core SQLite library.
19 **
20 ** The content in this amalgamation comes from Fossil check-in
21 ** 4bfc6e53a95d710b7f40fa9c80d8cdd1df50 with changes in files:
22 **
23 **
24 */
25 #ifndef SQLITE_AMALGAMATION
26 #define SQLITE_CORE 1
@@ -467,14 +467,14 @@
467 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
468 ** [sqlite_version()] and [sqlite_source_id()].
469 */
470 #define SQLITE_VERSION "3.54.0"
471 #define SQLITE_VERSION_NUMBER 3054000
472 #define SQLITE_SOURCE_ID "2026-10-05 14:22:13 4bfc6e53a95d710b7f40fa9c80d8cdd1df50d69ed8614e9800f7e6a1ca5a3c29"
473 #define SQLITE_SCM_BRANCH "trunk"
474 #define SQLITE_SCM_TAGS ""
475 #define SQLITE_SCM_DATETIME "2026-10-05T14:22:13.597Z"
476
477 /*
478 ** CAPI3REF: Run-Time Library Version Numbers
479 ** KEYWORDS: sqlite3_version sqlite3_sourceid
480 **
@@ -47272,13 +47272,13 @@
47272 /* On systems that support O_TMPFILE, use that flag to create a more
47273 ** secure temporary file that cannot be accessed by other processes
47274 */
47275 zName = unixTempFileDir();
47276 if( zName
47277 && (fd = robust_open(zName, O_RDWR|O_CREAT|O_EXCL|O_TMPFILE, 0600))>=0
47278 ){
47279 rc = fillInUnixFile(pVfs, fd, pFile, zPath, ctrlFlags);
47280 goto open_finished;
47281 }
47282 #endif
47283 rc = unixGetTempname(pVfs->mxPathname, zTmpname);
47284 if( rc!=SQLITE_OK ){
@@ -52305,10 +52305,32 @@
52305 }else{
52306 pp = &p->pNext;
52307 }
52308 }
52309 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52310
52311 /*
52312 ** The DMS lock has not yet been taken on the shm file associated with
52313 ** pShmNode. Take the lock. Truncate the *-shm file if required.
52314 ** Return SQLITE_OK if successful, or an SQLite error code otherwise.
@@ -52324,11 +52346,16 @@
52324 ** is the first process to open the file. Truncate it to zero bytes
52325 ** in this case. */
52326 if( pShmNode->isReadonly ){
52327 rc = SQLITE_READONLY_CANTINIT;
52328 }else{
52329 rc = winHandleTruncate(h, 0);
 
 
 
 
 
52330 }
52331
52332 /* Release the EXCLUSIVE lock acquired above. */
52333 winUnlockFile(&h, WIN_SHM_DMS, 0, 1, 0);
52334 }else if( (rc & 0xFF)==SQLITE_BUSY ){
@@ -82682,11 +82709,11 @@
82682 assert( MX_CELL_SIZE(pBt) >= nCell );
82683 pTmp = pBt->pTmpSpace;
82684 assert( pTmp!=0 );
82685 rc = sqlite3PagerWrite(pLeaf->pDbPage);
82686 if( rc==SQLITE_OK ){
82687 rc = insertCell(pPage, iCellIdx, pCell-4, nCell+4, pTmp, n);
82688 }
82689 dropCell(pLeaf, pLeaf->nCell-1, nCell, &rc);
82690 if( rc ) return rc;
82691 }
82692
@@ -125833,10 +125860,27 @@
125833 return (
125834 sqlite3StrICmp(db->aDb[iDb].zDbSName, zName)==0
125835 || (iDb==0 && sqlite3StrICmp("main", zName)==0)
125836 );
125837 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125838
125839 /*
125840 ** An SQL user-function registered to do the work of an ATTACH statement. The
125841 ** three arguments to the function come directly from an attach statement:
125842 **
@@ -125903,18 +125947,20 @@
125903 Schema *pNewSchema = sqlite3SchemaGet(db, pNewBt);
125904 if( pNewSchema ){
125905 /* Both the Btree and the new Schema were allocated successfully.
125906 ** Close the old db and update the aDb[] slot with the new memdb
125907 ** values. */
 
125908 sqlite3BtreeClose(pNew->pBt);
125909 pNew->pBt = pNewBt;
125910 pNew->pSchema = pNewSchema;
125911 if( db->init.iDb==0 ){
125912 /* Clear all eponymous virtual table instances, as they are holding
125913 ** pointers to the schema object just freed by sqlite3BtreeClose() */
125914 sqlite3VtabEponymousTableClearAll(db);
125915 }
 
125916 }else{
125917 sqlite3BtreeClose(pNewBt);
125918 rc = SQLITE_NOMEM;
125919 }
125920 }
@@ -126082,11 +126128,10 @@
126082 ){
126083 const char *zName = (const char *)sqlite3_value_text(argv[0]);
126084 sqlite3 *db = sqlite3_context_db_handle(context);
126085 int i;
126086 Db *pDb = 0;
126087 HashElem *pEntry;
126088 char zErr[128];
126089
126090 UNUSED_PARAMETER(NotUsed);
126091
126092 if( zName==0 ) zName = "";
@@ -126109,22 +126154,11 @@
126109 ){
126110 sqlite3_snprintf(sizeof(zErr),zErr, "database %s is locked", zName);
126111 goto detach_error;
126112 }
126113
126114 /* If any TEMP triggers reference the schema being detached, move those
126115 ** triggers to reference the TEMP schema itself. */
126116 assert( db->aDb[1].pSchema );
126117 pEntry = sqliteHashFirst(&db->aDb[1].pSchema->trigHash);
126118 while( pEntry ){
126119 Trigger *pTrig = (Trigger*)sqliteHashData(pEntry);
126120 if( pTrig->pTabSchema==pDb->pSchema ){
126121 pTrig->pTabSchema = pTrig->pSchema;
126122 }
126123 pEntry = sqliteHashNext(pEntry);
126124 }
126125
126126 sqlite3BtreeClose(pDb->pBt);
126127 pDb->pBt = 0;
126128 pDb->pSchema = 0;
126129 sqlite3CollapseDatabaseArray(db);
126130 return;
@@ -187997,11 +188031,10 @@
187997 break;
187998 }
187999 zSql += 2;
188000 while( zSql[0] && (zSql[0]!='*' || zSql[1]!='/') ){ zSql++; }
188001 if( zSql[0]==0 ){
188002 if( state==0 ) state = 2;
188003 pending = '/';
188004 goto incomplete_finish;
188005 }
188006 zSql++;
188007 token = tkWS;
@@ -188012,11 +188045,11 @@
188012 token = tkOTHER;
188013 break;
188014 }
188015 while( *zSql && *zSql!='\n' ){ zSql++; }
188016 if( *zSql==0 ){
188017 if( state!=1 ) pending = '-';
188018 goto incomplete_finish;
188019 }
188020 token = tkWS;
188021 break;
188022 }
@@ -188115,16 +188148,16 @@
188115 }
188116 state = trans[state][token];
188117 zSql++;
188118 }
188119 incomplete_finish:
188120 if( state==0 ) return SQLITE_EMPTY;
188121 if( state==1 ) nParen = 0;
188122 return (i64)((((u64)nParen)<<32) |
188123 ((u64)pending<<16) |
188124 ((u64)statemap[state]<<8) |
188125 (state!=1));
188126 }
188127 SQLITE_API int sqlite3_complete(const char *zSql){
188128 return sqlite3_incomplete(zSql)==0;
188129 }
188130
@@ -188615,11 +188648,11 @@
188615 SQLITE_API int sqlite3_initialize(void){
188616 /* If this build does not support writable static data (WSD) natively
188617 ** then we have to invoke the (application-supplied) WSD initialization
188618 ** routine before doing anything else. */
188619 #ifdef SQLITE_OMIT_WSD
188620 rc = sqlite3_wsd_init(4096, 24);
188621 if( rc!=SQLITE_OK ){
188622 return rc;
188623 }
188624 #endif
188625
@@ -265376,11 +265409,11 @@
265376 int nArg, /* Number of args */
265377 sqlite3_value **apUnused /* Function arguments */
265378 ){
265379 assert( nArg==0 );
265380 UNUSED_PARAM2(nArg, apUnused);
265381 sqlite3_result_text(pCtx, "fts5: 2026-10-05 14:22:13 4bfc6e53a95d710b7f40fa9c80d8cdd1df50d69ed8614e9800f7e6a1ca5a3c29", -1, SQLITE_TRANSIENT);
265382 }
265383
265384 /*
265385 ** Implementation of fts5_locale(LOCALE, TEXT) function.
265386 **
265387
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -16,11 +16,11 @@
16 ** if you want a wrapper to interface SQLite with your choice of programming
17 ** language. The code for the "sqlite3" command-line shell is also in a
18 ** separate file. This file contains only code for the core SQLite library.
19 **
20 ** The content in this amalgamation comes from Fossil check-in
21 ** a435d786fe0e245e352d08d2e2ddf8c1e151 with changes in files:
22 **
23 **
24 */
25 #ifndef SQLITE_AMALGAMATION
26 #define SQLITE_CORE 1
@@ -467,14 +467,14 @@
467 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
468 ** [sqlite_version()] and [sqlite_source_id()].
469 */
470 #define SQLITE_VERSION "3.54.0"
471 #define SQLITE_VERSION_NUMBER 3054000
472 #define SQLITE_SOURCE_ID "2026-10-06 18:52:47 a435d786fe0e245e352d08d2e2ddf8c1e15154809e3b471810cc327e9d90ef85"
473 #define SQLITE_SCM_BRANCH "trunk"
474 #define SQLITE_SCM_TAGS ""
475 #define SQLITE_SCM_DATETIME "2026-10-06T18:52:47.576Z"
476
477 /*
478 ** CAPI3REF: Run-Time Library Version Numbers
479 ** KEYWORDS: sqlite3_version sqlite3_sourceid
480 **
@@ -47272,13 +47272,13 @@
47272 /* On systems that support O_TMPFILE, use that flag to create a more
47273 ** secure temporary file that cannot be accessed by other processes
47274 */
47275 zName = unixTempFileDir();
47276 if( zName
47277 && (fd = robust_open(zName, O_RDWR|O_EXCL|O_TMPFILE, 0600))>=0
47278 ){
47279 rc = fillInUnixFile(pVfs, fd, pFile, zPath, ctrlFlags|UNIXFILE_NOLOCK);
47280 goto open_finished;
47281 }
47282 #endif
47283 rc = unixGetTempname(pVfs->mxPathname, zTmpname);
47284 if( rc!=SQLITE_OK ){
@@ -52305,10 +52305,32 @@
52305 }else{
52306 pp = &p->pNext;
52307 }
52308 }
52309 }
52310
52311 /*
52312 ** Handle h is open on the *-shm file. This function zeroes the first
52313 ** 8 bytes of the file. If SQLITE_ENABLE_SETLK_TIMEOUT is defined, h may
52314 ** have been opened with FILE_FLAG_OVERLAPPED.
52315 */
52316 static int winZeroSharedMemory(HANDLE h){
52317 u8 aZero[8] = {0,0,0,0,0,0,0,0};
52318 DWORD nWrite = 0;
52319 OVERLAPPED ovlp;
52320 memset(&ovlp, 0, sizeof(OVERLAPPED));
52321 if( !osWriteFile(h, aZero, sizeof(aZero), &nWrite, &ovlp) ){
52322 /* If the file was opened with FILE_FLAG_OVERLAPPED, the write may still
52323 ** be pending. Wait for it with GetOverlappedResult(). */
52324 if( osGetLastError()!=ERROR_IO_PENDING
52325 || !GetOverlappedResult(h, &ovlp, &nWrite, TRUE)
52326 ){
52327 nWrite = 0;
52328 }
52329 }
52330 return (nWrite==sizeof(aZero) ? SQLITE_OK : SQLITE_IOERR_WRITE);
52331 }
52332
52333 /*
52334 ** The DMS lock has not yet been taken on the shm file associated with
52335 ** pShmNode. Take the lock. Truncate the *-shm file if required.
52336 ** Return SQLITE_OK if successful, or an SQLite error code otherwise.
@@ -52324,11 +52346,16 @@
52346 ** is the first process to open the file. Truncate it to zero bytes
52347 ** in this case. */
52348 if( pShmNode->isReadonly ){
52349 rc = SQLITE_READONLY_CANTINIT;
52350 }else{
52351 if( SQLITE_OK!=winHandleTruncate(h, 0) ){
52352 /* Sometimes the truncate operation may fail because some other
52353 ** process is still holding an open mapping. So try to write
52354 ** zeroes into the start of the file instead. */
52355 rc = winZeroSharedMemory(h);
52356 }
52357 }
52358
52359 /* Release the EXCLUSIVE lock acquired above. */
52360 winUnlockFile(&h, WIN_SHM_DMS, 0, 1, 0);
52361 }else if( (rc & 0xFF)==SQLITE_BUSY ){
@@ -82682,11 +82709,11 @@
82709 assert( MX_CELL_SIZE(pBt) >= nCell );
82710 pTmp = pBt->pTmpSpace;
82711 assert( pTmp!=0 );
82712 rc = sqlite3PagerWrite(pLeaf->pDbPage);
82713 if( rc==SQLITE_OK ){
82714 rc = insertCell(pPage, iCellIdx, pCell-4, nCell+4-(pCell[0]==2), pTmp, n);
82715 }
82716 dropCell(pLeaf, pLeaf->nCell-1, nCell, &rc);
82717 if( rc ) return rc;
82718 }
82719
@@ -125833,10 +125860,27 @@
125860 return (
125861 sqlite3StrICmp(db->aDb[iDb].zDbSName, zName)==0
125862 || (iDb==0 && sqlite3StrICmp("main", zName)==0)
125863 );
125864 }
125865
125866 /*
125867 ** If any TEMP triggers reference schema pSchema, move those triggers to
125868 ** reference the TEMP schema itself.
125869 */
125870 static void detachTempTriggers(sqlite3 *db, Schema *pSchema){
125871 HashElem *pEntry;
125872 assert( db->aDb[1].pSchema );
125873 pEntry = sqliteHashFirst(&db->aDb[1].pSchema->trigHash);
125874 while( pEntry ){
125875 Trigger *pTrig = (Trigger*)sqliteHashData(pEntry);
125876 if( pTrig->pTabSchema==pSchema ){
125877 pTrig->pTabSchema = pTrig->pSchema;
125878 }
125879 pEntry = sqliteHashNext(pEntry);
125880 }
125881 }
125882
125883 /*
125884 ** An SQL user-function registered to do the work of an ATTACH statement. The
125885 ** three arguments to the function come directly from an attach statement:
125886 **
@@ -125903,18 +125947,20 @@
125947 Schema *pNewSchema = sqlite3SchemaGet(db, pNewBt);
125948 if( pNewSchema ){
125949 /* Both the Btree and the new Schema were allocated successfully.
125950 ** Close the old db and update the aDb[] slot with the new memdb
125951 ** values. */
125952 detachTempTriggers(db, pNew->pSchema);
125953 sqlite3BtreeClose(pNew->pBt);
125954 pNew->pBt = pNewBt;
125955 pNew->pSchema = pNewSchema;
125956 if( db->init.iDb==0 ){
125957 /* Clear all eponymous virtual table instances, as they are holding
125958 ** pointers to the schema object just freed by sqlite3BtreeClose() */
125959 sqlite3VtabEponymousTableClearAll(db);
125960 }
125961 sqlite3ExpirePreparedStatements(db, 1);
125962 }else{
125963 sqlite3BtreeClose(pNewBt);
125964 rc = SQLITE_NOMEM;
125965 }
125966 }
@@ -126082,11 +126128,10 @@
126128 ){
126129 const char *zName = (const char *)sqlite3_value_text(argv[0]);
126130 sqlite3 *db = sqlite3_context_db_handle(context);
126131 int i;
126132 Db *pDb = 0;
 
126133 char zErr[128];
126134
126135 UNUSED_PARAMETER(NotUsed);
126136
126137 if( zName==0 ) zName = "";
@@ -126109,22 +126154,11 @@
126154 ){
126155 sqlite3_snprintf(sizeof(zErr),zErr, "database %s is locked", zName);
126156 goto detach_error;
126157 }
126158
126159 detachTempTriggers(db, pDb->pSchema);
 
 
 
 
 
 
 
 
 
 
 
126160 sqlite3BtreeClose(pDb->pBt);
126161 pDb->pBt = 0;
126162 pDb->pSchema = 0;
126163 sqlite3CollapseDatabaseArray(db);
126164 return;
@@ -187997,11 +188031,10 @@
188031 break;
188032 }
188033 zSql += 2;
188034 while( zSql[0] && (zSql[0]!='*' || zSql[1]!='/') ){ zSql++; }
188035 if( zSql[0]==0 ){
 
188036 pending = '/';
188037 goto incomplete_finish;
188038 }
188039 zSql++;
188040 token = tkWS;
@@ -188012,11 +188045,11 @@
188045 token = tkOTHER;
188046 break;
188047 }
188048 while( *zSql && *zSql!='\n' ){ zSql++; }
188049 if( *zSql==0 ){
188050 pending = '-';
188051 goto incomplete_finish;
188052 }
188053 token = tkWS;
188054 break;
188055 }
@@ -188115,16 +188148,16 @@
188148 }
188149 state = trans[state][token];
188150 zSql++;
188151 }
188152 incomplete_finish:
188153 if( state==0 && pending==0 ) return SQLITE_EMPTY;
188154 if( state==1 ) nParen = 0;
188155 return (i64)((((u64)nParen)<<32) |
188156 ((u64)pending<<16) |
188157 ((u64)statemap[state]<<8) |
188158 (state>1 || pending!=0));
188159 }
188160 SQLITE_API int sqlite3_complete(const char *zSql){
188161 return sqlite3_incomplete(zSql)==0;
188162 }
188163
@@ -188615,11 +188648,11 @@
188648 SQLITE_API int sqlite3_initialize(void){
188649 /* If this build does not support writable static data (WSD) natively
188650 ** then we have to invoke the (application-supplied) WSD initialization
188651 ** routine before doing anything else. */
188652 #ifdef SQLITE_OMIT_WSD
188653 int rc = sqlite3_wsd_init(4096, 24);
188654 if( rc!=SQLITE_OK ){
188655 return rc;
188656 }
188657 #endif
188658
@@ -265376,11 +265409,11 @@
265409 int nArg, /* Number of args */
265410 sqlite3_value **apUnused /* Function arguments */
265411 ){
265412 assert( nArg==0 );
265413 UNUSED_PARAM2(nArg, apUnused);
265414 sqlite3_result_text(pCtx, "fts5: 2026-10-06 14:34:02 adacd1423f159fa4698f7e40dd1488256a13dff0b31cc90e28c3441109596ef4", -1, SQLITE_TRANSIENT);
265415 }
265416
265417 /*
265418 ** Implementation of fts5_locale(LOCALE, TEXT) function.
265419 **
265420
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,14 +146,14 @@
146146
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147147
** [sqlite_version()] and [sqlite_source_id()].
148148
*/
149149
#define SQLITE_VERSION "3.54.0"
150150
#define SQLITE_VERSION_NUMBER 3054000
151
-#define SQLITE_SOURCE_ID "2026-10-05 14:22:13 4bfc6e53a95d710b7f40fa9c80d8cdd1df50d69ed8614e9800f7e6a1ca5a3c29"
151
+#define SQLITE_SOURCE_ID "2026-10-06 18:52:47 a435d786fe0e245e352d08d2e2ddf8c1e15154809e3b471810cc327e9d90ef85"
152152
#define SQLITE_SCM_BRANCH "trunk"
153153
#define SQLITE_SCM_TAGS ""
154
-#define SQLITE_SCM_DATETIME "2026-10-05T14:22:13.597Z"
154
+#define SQLITE_SCM_DATETIME "2026-10-06T18:52:47.576Z"
155155
156156
/*
157157
** CAPI3REF: Run-Time Library Version Numbers
158158
** KEYWORDS: sqlite3_version sqlite3_sourceid
159159
**
160160
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,14 +146,14 @@
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.54.0"
150 #define SQLITE_VERSION_NUMBER 3054000
151 #define SQLITE_SOURCE_ID "2026-10-05 14:22:13 4bfc6e53a95d710b7f40fa9c80d8cdd1df50d69ed8614e9800f7e6a1ca5a3c29"
152 #define SQLITE_SCM_BRANCH "trunk"
153 #define SQLITE_SCM_TAGS ""
154 #define SQLITE_SCM_DATETIME "2026-10-05T14:22:13.597Z"
155
156 /*
157 ** CAPI3REF: Run-Time Library Version Numbers
158 ** KEYWORDS: sqlite3_version sqlite3_sourceid
159 **
160
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,14 +146,14 @@
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.54.0"
150 #define SQLITE_VERSION_NUMBER 3054000
151 #define SQLITE_SOURCE_ID "2026-10-06 18:52:47 a435d786fe0e245e352d08d2e2ddf8c1e15154809e3b471810cc327e9d90ef85"
152 #define SQLITE_SCM_BRANCH "trunk"
153 #define SQLITE_SCM_TAGS ""
154 #define SQLITE_SCM_DATETIME "2026-10-06T18:52:47.576Z"
155
156 /*
157 ** CAPI3REF: Run-Time Library Version Numbers
158 ** KEYWORDS: sqlite3_version sqlite3_sourceid
159 **
160

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button