Fossil SCM

Update the built-in SQLite to the latest trunk version that includes support for the "weekday -N" and "end of day/month/year" date/time modifiers.

drh 2026-07-01 12:15 UTC trunk
Commit 4fcd911ef7ae308d0adeba8697f8f5e8f5097650459593fc77205cfe05c451d3
+1 -1
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -8265,11 +8265,11 @@
82658265
82668266
/* Convert a floating point value to its closest integer. Do so in
82678267
** a way that avoids 'outside the range of representable values' warnings
82688268
** from UBSAN.
82698269
*/
8270
-sqlite3_int64 seriesRealToI64(double r){
8270
+static sqlite3_int64 seriesRealToI64(double r){
82718271
if( r<-9223372036854774784.0 ) return SMALLEST_INT64;
82728272
if( r>+9223372036854774784.0 ) return LARGEST_INT64;
82738273
return (sqlite3_int64)r;
82748274
}
82758275
82768276
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -8265,11 +8265,11 @@
8265
8266 /* Convert a floating point value to its closest integer. Do so in
8267 ** a way that avoids 'outside the range of representable values' warnings
8268 ** from UBSAN.
8269 */
8270 sqlite3_int64 seriesRealToI64(double r){
8271 if( r<-9223372036854774784.0 ) return SMALLEST_INT64;
8272 if( r>+9223372036854774784.0 ) return LARGEST_INT64;
8273 return (sqlite3_int64)r;
8274 }
8275
8276
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -8265,11 +8265,11 @@
8265
8266 /* Convert a floating point value to its closest integer. Do so in
8267 ** a way that avoids 'outside the range of representable values' warnings
8268 ** from UBSAN.
8269 */
8270 static sqlite3_int64 seriesRealToI64(double r){
8271 if( r<-9223372036854774784.0 ) return SMALLEST_INT64;
8272 if( r>+9223372036854774784.0 ) return LARGEST_INT64;
8273 return (sqlite3_int64)r;
8274 }
8275
8276
+90 -24
--- 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
-** 716782abe939083b7732289d862ddfd84105 with changes in files:
21
+** 88901fffcd445ccb97e4e379ea15d8b06d87 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-06-26 19:31:46 716782abe939083b7732289d862ddfd841057d3458814f96e5e6d7826ec7fa5c"
472
+#define SQLITE_SOURCE_ID "2026-07-01 12:11:41 88901fffcd445ccb97e4e379ea15d8b06d87b8170cad0f717c909944ff21851f"
473473
#define SQLITE_SCM_BRANCH "trunk"
474474
#define SQLITE_SCM_TAGS ""
475
-#define SQLITE_SCM_DATETIME "2026-06-26T19:31:46.902Z"
475
+#define SQLITE_SCM_DATETIME "2026-07-01T12:11:41.802Z"
476476
477477
/*
478478
** CAPI3REF: Run-Time Library Version Numbers
479479
** KEYWORDS: sqlite3_version sqlite3_sourceid
480480
**
@@ -26375,10 +26375,53 @@
2637526375
clearYMD_HMS_TZ(p);
2637626376
rc = 0;
2637726377
p->nFloor = 0;
2637826378
}
2637926379
break;
26380
+ }
26381
+ case 'e': {
26382
+ /*
26383
+ ** end of day
26384
+ ** end of month
26385
+ ** end of year
26386
+ **
26387
+ ** Move the date forwards to the last millisecond of the current
26388
+ ** day, month or year.
26389
+ */
26390
+ if( sqlite3_strnicmp(z, "end of ", 7)!=0 ){
26391
+ break;
26392
+ }
26393
+ if( !p->validJD && !p->validYMD && !p->validHMS ) break;
26394
+ z += 7;
26395
+ computeYMD(p);
26396
+ p->validHMS = 1;
26397
+ p->h = 23;
26398
+ p->m = 59;
26399
+ p->s = 59.999;
26400
+ p->rawS = 0;
26401
+ p->tz = 0;
26402
+ p->validJD = 0;
26403
+ if( sqlite3_stricmp(z,"month")==0 ){
26404
+ p->D = 1;
26405
+ p->M++;
26406
+ if( p->M>12 ){
26407
+ p->Y++;
26408
+ p->M = 1;
26409
+ }
26410
+ computeFloor(p);
26411
+ computeJD(p);
26412
+ p->iJD -= (p->nFloor+1)*86400000;
26413
+ clearYMD_HMS_TZ(p);
26414
+ rc = 0;
26415
+ }else if( sqlite3_stricmp(z,"year")==0 ){
26416
+ p->M = 12;
26417
+ p->D = 31;
26418
+ rc = 0;
26419
+ }else if( sqlite3_stricmp(z,"day")==0 ){
26420
+ rc = 0;
26421
+ }
26422
+ break;
2638026423
}
2638126424
case 'f': {
2638226425
/*
2638326426
** floor
2638426427
**
@@ -26478,34 +26521,44 @@
2647826521
break;
2647926522
}
2648026523
case 'w': {
2648126524
/*
2648226525
** weekday N
26526
+ ** weekday -N
2648326527
**
26484
- ** Move the date to the same time on the next occurrence of
26485
- ** weekday N where 0==Sunday, 1==Monday, and so forth. If the
26486
- ** date is already on the appropriate weekday, this is a no-op.
26528
+ ** Move the date forward (for N>=0) or backward (for N<=-0) to the
26529
+ ** same time on the next/previous occurrence of weekday abs(N)
26530
+ ** where 0==Sunday, 1==Monday, and so forth. If the date is already
26531
+ ** on the appropriate weekday, this is a no-op.
2648726532
*/
2648826533
if( sqlite3_strnicmp(z, "weekday ", 8)==0
26489
- && sqlite3AtoF(&z[8], &r)>0
26490
- && r>=0.0 && r<7.0 && (n=(int)r)==r ){
26534
+ && sqlite3AtoF(&z[8], &r)>0
26535
+ && r>=-6.0 && r<=6.0
26536
+ && (n=(int)r)==r
26537
+ ){
2649126538
sqlite3_int64 Z;
2649226539
computeYMD_HMS(p);
2649326540
p->tz = 0;
2649426541
p->validJD = 0;
2649526542
computeJD(p);
2649626543
Z = ((p->iJD + 129600000)/86400000) % 7;
26497
- if( Z>n ) Z -= 7;
26498
- p->iJD += (n - Z)*86400000;
26544
+ if( n<0 ) n = -n;
26545
+ if( Z!=n ){
26546
+ if( Z>n ) Z -= 7;
26547
+ p->iJD += (n - Z)*86400000;
26548
+ if( strchr(z+8,'-')!=0 ) p->iJD -= 7*86400000;
26549
+ }
2649926550
clearYMD_HMS_TZ(p);
2650026551
rc = 0;
2650126552
}
2650226553
break;
2650326554
}
2650426555
case 's': {
2650526556
/*
26506
- ** start of TTTTT
26557
+ ** start of day
26558
+ ** start of month
26559
+ ** start of year
2650726560
**
2650826561
** Move the date backwards to the beginning of the current day,
2650926562
** or month or year.
2651026563
**
2651126564
** subsecond
@@ -33777,10 +33830,11 @@
3377733830
** work (enlarging the buffer) using tail recursion, so that the
3377833831
** sqlite3_str_append() routine can use fast calling semantics.
3377933832
*/
3378033833
static void SQLITE_NOINLINE enlargeAndAppend(StrAccum *p, const char *z, int N){
3378133834
N = sqlite3StrAccumEnlarge(p, N);
33835
+ assert( z!=0 || N==0 );
3378233836
if( N>0 ){
3378333837
memcpy(&p->zText[p->nChar], z, N);
3378433838
p->nChar += N;
3378533839
}
3378633840
}
@@ -74498,12 +74552,15 @@
7449874552
/* Freeblock off the end of the page */
7449974553
return SQLITE_CORRUPT_PAGE(pPage);
7450074554
}
7450174555
next = get2byte(&data[pc]);
7450274556
size = get2byte(&data[pc+2]);
74503
- if( size<4 ){
74504
- /* Minimum freeblock size is 4 */
74557
+ if( size<4 && sqlite3FaultSim(422)==SQLITE_OK ){
74558
+ /* Minimum freeblock size is 4. Enable fault-sim 422 to disable this
74559
+ ** check to reach interesting error stats. However, disabling this
74560
+ ** check can cause assertion faults due to min-heap overflow. All
74561
+ ** fault-sims are for testing use only, but this one especially so. */
7450574562
return SQLITE_CORRUPT_PAGE(pPage);
7450674563
}
7450774564
nFree = nFree + size;
7450874565
if( next<pc+size+4 ) break;
7450974566
pc = next;
@@ -83387,11 +83444,11 @@
8338783444
checkAppendMsg(pCheck, "Child page depth differs");
8338883445
depth = d2;
8338983446
}
8339083447
}else{
8339183448
/* Populate the coverage-checking heap for leaf pages */
83392
- assert( heap[0] < pCheck->mxHeap );
83449
+ assert( heap!=0 && heap[0] < pCheck->mxHeap );
8339383450
btreeHeapInsert(heap, (pc<<16)|(pc+info.nSize-1));
8339483451
}
8339583452
}
8339683453
*piMinKey = maxKey;
8339783454
@@ -83407,11 +83464,11 @@
8340783464
heap[0] = 0;
8340883465
for(i=nCell-1; i>=0; i--){
8340983466
u32 size;
8341083467
pc = get2byteAligned(&data[cellStart+i*2]);
8341183468
size = pPage->xCellSize(pPage, &data[pc]);
83412
- assert( heap[0] < pCheck->mxHeap );
83469
+ assert( heap!=0 && heap[0] < pCheck->mxHeap );
8341383470
btreeHeapInsert(heap, (pc<<16)|(pc+size-1));
8341483471
}
8341583472
}
8341683473
assert( heap!=0 );
8341783474
/* Add the freeblocks to the min-heap
@@ -83424,11 +83481,11 @@
8342483481
while( i>0 ){
8342583482
int size, j;
8342683483
assert( (u32)i<=usableSize-4 ); /* Enforced by btreeComputeFreeSpace() */
8342783484
size = get2byte(&data[i+2]);
8342883485
assert( (u32)(i+size)<=usableSize ); /* due to btreeComputeFreeSpace() */
83429
- assert( heap[0] < pCheck->mxHeap );
83486
+ assert( heap!=0 && heap[0] < pCheck->mxHeap );
8343083487
btreeHeapInsert(heap, (((u32)i)<<16)|(i+size-1));
8343183488
/* EVIDENCE-OF: R-58208-19414 The first 2 bytes of a freeblock are a
8343283489
** big-endian integer which is the offset in the b-tree page of the next
8343383490
** freeblock in the chain, or zero if the freeblock is the last on the
8343483491
** chain. */
@@ -84047,12 +84104,14 @@
8404784104
** If the "temp" database is requested, it may need to be opened by this
8404884105
** function. If an error occurs while doing so, return 0 and write an
8404984106
** error message to pErrorDb.
8405084107
*/
8405184108
static Btree *findBtree(sqlite3 *pErrorDb, sqlite3 *pDb, const char *zDb){
84052
- int i = sqlite3FindDbName(pDb, zDb);
84109
+ int i;
8405384110
84111
+ assert( pDb!=0 );
84112
+ i = sqlite3FindDbName(pDb, zDb);
8405484113
if( i==1 ){
8405584114
Parse sParse;
8405684115
int rc = 0;
8405784116
sqlite3ParseObjectInit(&sParse,pDb);
8405884117
if( sqlite3OpenTempDatabase(&sParse) ){
@@ -128460,18 +128519,15 @@
128460128519
128461128520
#ifndef SQLITE_OMIT_VIRTUALTABLE
128462128521
/*
128463128522
** Return true if zName is a shadow table name in the current database
128464128523
** connection.
128465
-**
128466
-** zName is temporarily modified while this routine is running, but is
128467
-** restored to its original value prior to this routine returning.
128468128524
*/
128469128525
SQLITE_PRIVATE int sqlite3ShadowTableName(sqlite3 *db, const char *zName){
128470128526
const char *zTail; /* Pointer to the last "_" in zName */
128471128527
Table *pTab; /* Table that zName is a shadow of */
128472
- char *zCopy;
128528
+ char *zCopy; /* Transient copy of zName after last "_" */
128473128529
zTail = strrchr(zName, '_');
128474128530
if( zTail==0 ) return 0;
128475128531
zCopy = sqlite3DbStrNDup(db, zName, (int)(zTail-zName));
128476128532
pTab = zCopy ? sqlite3FindTable(db, zCopy, 0) : 0;
128477128533
sqlite3DbFree(db, zCopy);
@@ -148036,10 +148092,11 @@
148036148092
**
148037148093
** Caution: Do not confuse this routine with sqlite3ParseObjectInit() which
148038148094
** is generated by Lemon.
148039148095
*/
148040148096
SQLITE_PRIVATE void sqlite3ParseObjectInit(Parse *pParse, sqlite3 *db){
148097
+ assert( db!=0 );
148041148098
memset(PARSE_HDR(pParse), 0, PARSE_HDR_SZ);
148042148099
memset(PARSE_TAIL(pParse), 0, PARSE_TAIL_SZ);
148043148100
assert( db->pParse!=pParse );
148044148101
pParse->pOuterParse = db->pParse;
148045148102
db->pParse = pParse;
@@ -149134,11 +149191,10 @@
149134149191
pRight->fg.isOn = 1;
149135149192
p->selFlags |= SF_OnToWhere;
149136149193
}
149137149194
149138149195
if( pRight->fg.isTabFunc && joinType==EP_OuterON && pRight->u1.pFuncArg ){
149139
- assert( IsVirtual(pRightTab) );
149140149196
p->selFlags |= SF_OnToWhere;
149141149197
}
149142149198
}
149143149199
return 0;
149144149200
}
@@ -162084,10 +162140,12 @@
162084162140
char *zErr = 0;
162085162141
rc = vtabCallConstructor(db, pTab, pMod, pMod->pModule->xConnect, &zErr);
162086162142
if( rc!=SQLITE_OK ){
162087162143
sqlite3ErrorMsg(pParse, "%s", zErr);
162088162144
pParse->rc = rc;
162145
+ }else{
162146
+ sqlite3MarkAllShadowTablesOf(db, pTab);
162089162147
}
162090162148
sqlite3DbFree(db, zErr);
162091162149
}
162092162150
162093162151
return rc;
@@ -168316,10 +168374,14 @@
168316168374
Expr *pColRef;
168317168375
Expr *pTerm;
168318168376
if( pItem->fg.isTabFunc==0 ) return;
168319168377
pTab = pItem->pSTab;
168320168378
assert( pTab!=0 );
168379
+ if( !IsVirtual(pTab) ){
168380
+ sqlite3ErrorMsg(pParse, "'%s' is not a function", pItem->zName);
168381
+ return;
168382
+ }
168321168383
pArgs = pItem->u1.pFuncArg;
168322168384
if( pArgs==0 ) return;
168323168385
for(j=k=0; j<pArgs->nExpr; j++){
168324168386
Expr *pRhs;
168325168387
u32 joinType;
@@ -253274,10 +253336,14 @@
253274253336
const u8 *a = pIter->pLeaf->p;
253275253337
int iTermOff = 0;
253276253338
253277253339
pIter->iPgidxOff = pIter->pLeaf->szLeaf;
253278253340
pIter->iPgidxOff += fts5GetVarint32(&a[pIter->iPgidxOff], iTermOff);
253341
+ if( iTermOff > pIter->pLeaf->szLeaf ){
253342
+ p->rc = FTS5_CORRUPT;
253343
+ return;
253344
+ }
253279253345
pIter->iLeafOffset = iTermOff;
253280253346
fts5SegIterLoadTerm(p, pIter, 0);
253281253347
fts5SegIterLoadNPos(p, pIter);
253282253348
if( bDlidx ) fts5SegIterLoadDlidx(p, pIter);
253283253349
@@ -258983,11 +259049,11 @@
258983259049
iRowidOff = fts5LeafFirstRowidOff(pLeaf);
258984259050
if( iRowidOff>=iOff || iOff>=pLeaf->szLeaf ){
258985259051
FTS5_CORRUPT_ROWID(p, iRow);
258986259052
}else{
258987259053
iOff += fts5GetVarint32(&pLeaf->p[iOff], nTerm);
258988
- if( iOff+nTerm>pLeaf->szLeaf ){
259054
+ if( (i64)iOff+(i64)nTerm>(i64)pLeaf->szLeaf ){
258989259055
FTS5_CORRUPT_ROWID(p, iRow);
258990259056
}else{
258991259057
res = fts5Memcmp(&pLeaf->p[iOff], zIdxTerm, MIN(nTerm, nIdxTerm));
258992259058
if( res==0 ) res = nTerm - nIdxTerm;
258993259059
if( res<0 ) FTS5_CORRUPT_ROWID(p, iRow);
@@ -263631,11 +263697,11 @@
263631263697
int nArg, /* Number of args */
263632263698
sqlite3_value **apUnused /* Function arguments */
263633263699
){
263634263700
assert( nArg==0 );
263635263701
UNUSED_PARAM2(nArg, apUnused);
263636
- sqlite3_result_text(pCtx, "fts5: 2026-06-26 19:31:46 716782abe939083b7732289d862ddfd841057d3458814f96e5e6d7826ec7fa5c", -1, SQLITE_TRANSIENT);
263702
+ sqlite3_result_text(pCtx, "fts5: 2026-07-01 12:11:41 88901fffcd445ccb97e4e379ea15d8b06d87b8170cad0f717c909944ff21851f", -1, SQLITE_TRANSIENT);
263637263703
}
263638263704
263639263705
/*
263640263706
** Implementation of fts5_locale(LOCALE, TEXT) function.
263641263707
**
263642263708
--- 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 ** 716782abe939083b7732289d862ddfd84105 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-06-26 19:31:46 716782abe939083b7732289d862ddfd841057d3458814f96e5e6d7826ec7fa5c"
473 #define SQLITE_SCM_BRANCH "trunk"
474 #define SQLITE_SCM_TAGS ""
475 #define SQLITE_SCM_DATETIME "2026-06-26T19:31:46.902Z"
476
477 /*
478 ** CAPI3REF: Run-Time Library Version Numbers
479 ** KEYWORDS: sqlite3_version sqlite3_sourceid
480 **
@@ -26375,10 +26375,53 @@
26375 clearYMD_HMS_TZ(p);
26376 rc = 0;
26377 p->nFloor = 0;
26378 }
26379 break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26380 }
26381 case 'f': {
26382 /*
26383 ** floor
26384 **
@@ -26478,34 +26521,44 @@
26478 break;
26479 }
26480 case 'w': {
26481 /*
26482 ** weekday N
 
26483 **
26484 ** Move the date to the same time on the next occurrence of
26485 ** weekday N where 0==Sunday, 1==Monday, and so forth. If the
26486 ** date is already on the appropriate weekday, this is a no-op.
 
26487 */
26488 if( sqlite3_strnicmp(z, "weekday ", 8)==0
26489 && sqlite3AtoF(&z[8], &r)>0
26490 && r>=0.0 && r<7.0 && (n=(int)r)==r ){
 
 
26491 sqlite3_int64 Z;
26492 computeYMD_HMS(p);
26493 p->tz = 0;
26494 p->validJD = 0;
26495 computeJD(p);
26496 Z = ((p->iJD + 129600000)/86400000) % 7;
26497 if( Z>n ) Z -= 7;
26498 p->iJD += (n - Z)*86400000;
 
 
 
 
26499 clearYMD_HMS_TZ(p);
26500 rc = 0;
26501 }
26502 break;
26503 }
26504 case 's': {
26505 /*
26506 ** start of TTTTT
 
 
26507 **
26508 ** Move the date backwards to the beginning of the current day,
26509 ** or month or year.
26510 **
26511 ** subsecond
@@ -33777,10 +33830,11 @@
33777 ** work (enlarging the buffer) using tail recursion, so that the
33778 ** sqlite3_str_append() routine can use fast calling semantics.
33779 */
33780 static void SQLITE_NOINLINE enlargeAndAppend(StrAccum *p, const char *z, int N){
33781 N = sqlite3StrAccumEnlarge(p, N);
 
33782 if( N>0 ){
33783 memcpy(&p->zText[p->nChar], z, N);
33784 p->nChar += N;
33785 }
33786 }
@@ -74498,12 +74552,15 @@
74498 /* Freeblock off the end of the page */
74499 return SQLITE_CORRUPT_PAGE(pPage);
74500 }
74501 next = get2byte(&data[pc]);
74502 size = get2byte(&data[pc+2]);
74503 if( size<4 ){
74504 /* Minimum freeblock size is 4 */
 
 
 
74505 return SQLITE_CORRUPT_PAGE(pPage);
74506 }
74507 nFree = nFree + size;
74508 if( next<pc+size+4 ) break;
74509 pc = next;
@@ -83387,11 +83444,11 @@
83387 checkAppendMsg(pCheck, "Child page depth differs");
83388 depth = d2;
83389 }
83390 }else{
83391 /* Populate the coverage-checking heap for leaf pages */
83392 assert( heap[0] < pCheck->mxHeap );
83393 btreeHeapInsert(heap, (pc<<16)|(pc+info.nSize-1));
83394 }
83395 }
83396 *piMinKey = maxKey;
83397
@@ -83407,11 +83464,11 @@
83407 heap[0] = 0;
83408 for(i=nCell-1; i>=0; i--){
83409 u32 size;
83410 pc = get2byteAligned(&data[cellStart+i*2]);
83411 size = pPage->xCellSize(pPage, &data[pc]);
83412 assert( heap[0] < pCheck->mxHeap );
83413 btreeHeapInsert(heap, (pc<<16)|(pc+size-1));
83414 }
83415 }
83416 assert( heap!=0 );
83417 /* Add the freeblocks to the min-heap
@@ -83424,11 +83481,11 @@
83424 while( i>0 ){
83425 int size, j;
83426 assert( (u32)i<=usableSize-4 ); /* Enforced by btreeComputeFreeSpace() */
83427 size = get2byte(&data[i+2]);
83428 assert( (u32)(i+size)<=usableSize ); /* due to btreeComputeFreeSpace() */
83429 assert( heap[0] < pCheck->mxHeap );
83430 btreeHeapInsert(heap, (((u32)i)<<16)|(i+size-1));
83431 /* EVIDENCE-OF: R-58208-19414 The first 2 bytes of a freeblock are a
83432 ** big-endian integer which is the offset in the b-tree page of the next
83433 ** freeblock in the chain, or zero if the freeblock is the last on the
83434 ** chain. */
@@ -84047,12 +84104,14 @@
84047 ** If the "temp" database is requested, it may need to be opened by this
84048 ** function. If an error occurs while doing so, return 0 and write an
84049 ** error message to pErrorDb.
84050 */
84051 static Btree *findBtree(sqlite3 *pErrorDb, sqlite3 *pDb, const char *zDb){
84052 int i = sqlite3FindDbName(pDb, zDb);
84053
 
 
84054 if( i==1 ){
84055 Parse sParse;
84056 int rc = 0;
84057 sqlite3ParseObjectInit(&sParse,pDb);
84058 if( sqlite3OpenTempDatabase(&sParse) ){
@@ -128460,18 +128519,15 @@
128460
128461 #ifndef SQLITE_OMIT_VIRTUALTABLE
128462 /*
128463 ** Return true if zName is a shadow table name in the current database
128464 ** connection.
128465 **
128466 ** zName is temporarily modified while this routine is running, but is
128467 ** restored to its original value prior to this routine returning.
128468 */
128469 SQLITE_PRIVATE int sqlite3ShadowTableName(sqlite3 *db, const char *zName){
128470 const char *zTail; /* Pointer to the last "_" in zName */
128471 Table *pTab; /* Table that zName is a shadow of */
128472 char *zCopy;
128473 zTail = strrchr(zName, '_');
128474 if( zTail==0 ) return 0;
128475 zCopy = sqlite3DbStrNDup(db, zName, (int)(zTail-zName));
128476 pTab = zCopy ? sqlite3FindTable(db, zCopy, 0) : 0;
128477 sqlite3DbFree(db, zCopy);
@@ -148036,10 +148092,11 @@
148036 **
148037 ** Caution: Do not confuse this routine with sqlite3ParseObjectInit() which
148038 ** is generated by Lemon.
148039 */
148040 SQLITE_PRIVATE void sqlite3ParseObjectInit(Parse *pParse, sqlite3 *db){
 
148041 memset(PARSE_HDR(pParse), 0, PARSE_HDR_SZ);
148042 memset(PARSE_TAIL(pParse), 0, PARSE_TAIL_SZ);
148043 assert( db->pParse!=pParse );
148044 pParse->pOuterParse = db->pParse;
148045 db->pParse = pParse;
@@ -149134,11 +149191,10 @@
149134 pRight->fg.isOn = 1;
149135 p->selFlags |= SF_OnToWhere;
149136 }
149137
149138 if( pRight->fg.isTabFunc && joinType==EP_OuterON && pRight->u1.pFuncArg ){
149139 assert( IsVirtual(pRightTab) );
149140 p->selFlags |= SF_OnToWhere;
149141 }
149142 }
149143 return 0;
149144 }
@@ -162084,10 +162140,12 @@
162084 char *zErr = 0;
162085 rc = vtabCallConstructor(db, pTab, pMod, pMod->pModule->xConnect, &zErr);
162086 if( rc!=SQLITE_OK ){
162087 sqlite3ErrorMsg(pParse, "%s", zErr);
162088 pParse->rc = rc;
 
 
162089 }
162090 sqlite3DbFree(db, zErr);
162091 }
162092
162093 return rc;
@@ -168316,10 +168374,14 @@
168316 Expr *pColRef;
168317 Expr *pTerm;
168318 if( pItem->fg.isTabFunc==0 ) return;
168319 pTab = pItem->pSTab;
168320 assert( pTab!=0 );
 
 
 
 
168321 pArgs = pItem->u1.pFuncArg;
168322 if( pArgs==0 ) return;
168323 for(j=k=0; j<pArgs->nExpr; j++){
168324 Expr *pRhs;
168325 u32 joinType;
@@ -253274,10 +253336,14 @@
253274 const u8 *a = pIter->pLeaf->p;
253275 int iTermOff = 0;
253276
253277 pIter->iPgidxOff = pIter->pLeaf->szLeaf;
253278 pIter->iPgidxOff += fts5GetVarint32(&a[pIter->iPgidxOff], iTermOff);
 
 
 
 
253279 pIter->iLeafOffset = iTermOff;
253280 fts5SegIterLoadTerm(p, pIter, 0);
253281 fts5SegIterLoadNPos(p, pIter);
253282 if( bDlidx ) fts5SegIterLoadDlidx(p, pIter);
253283
@@ -258983,11 +259049,11 @@
258983 iRowidOff = fts5LeafFirstRowidOff(pLeaf);
258984 if( iRowidOff>=iOff || iOff>=pLeaf->szLeaf ){
258985 FTS5_CORRUPT_ROWID(p, iRow);
258986 }else{
258987 iOff += fts5GetVarint32(&pLeaf->p[iOff], nTerm);
258988 if( iOff+nTerm>pLeaf->szLeaf ){
258989 FTS5_CORRUPT_ROWID(p, iRow);
258990 }else{
258991 res = fts5Memcmp(&pLeaf->p[iOff], zIdxTerm, MIN(nTerm, nIdxTerm));
258992 if( res==0 ) res = nTerm - nIdxTerm;
258993 if( res<0 ) FTS5_CORRUPT_ROWID(p, iRow);
@@ -263631,11 +263697,11 @@
263631 int nArg, /* Number of args */
263632 sqlite3_value **apUnused /* Function arguments */
263633 ){
263634 assert( nArg==0 );
263635 UNUSED_PARAM2(nArg, apUnused);
263636 sqlite3_result_text(pCtx, "fts5: 2026-06-26 19:31:46 716782abe939083b7732289d862ddfd841057d3458814f96e5e6d7826ec7fa5c", -1, SQLITE_TRANSIENT);
263637 }
263638
263639 /*
263640 ** Implementation of fts5_locale(LOCALE, TEXT) function.
263641 **
263642
--- 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 ** 88901fffcd445ccb97e4e379ea15d8b06d87 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-07-01 12:11:41 88901fffcd445ccb97e4e379ea15d8b06d87b8170cad0f717c909944ff21851f"
473 #define SQLITE_SCM_BRANCH "trunk"
474 #define SQLITE_SCM_TAGS ""
475 #define SQLITE_SCM_DATETIME "2026-07-01T12:11:41.802Z"
476
477 /*
478 ** CAPI3REF: Run-Time Library Version Numbers
479 ** KEYWORDS: sqlite3_version sqlite3_sourceid
480 **
@@ -26375,10 +26375,53 @@
26375 clearYMD_HMS_TZ(p);
26376 rc = 0;
26377 p->nFloor = 0;
26378 }
26379 break;
26380 }
26381 case 'e': {
26382 /*
26383 ** end of day
26384 ** end of month
26385 ** end of year
26386 **
26387 ** Move the date forwards to the last millisecond of the current
26388 ** day, month or year.
26389 */
26390 if( sqlite3_strnicmp(z, "end of ", 7)!=0 ){
26391 break;
26392 }
26393 if( !p->validJD && !p->validYMD && !p->validHMS ) break;
26394 z += 7;
26395 computeYMD(p);
26396 p->validHMS = 1;
26397 p->h = 23;
26398 p->m = 59;
26399 p->s = 59.999;
26400 p->rawS = 0;
26401 p->tz = 0;
26402 p->validJD = 0;
26403 if( sqlite3_stricmp(z,"month")==0 ){
26404 p->D = 1;
26405 p->M++;
26406 if( p->M>12 ){
26407 p->Y++;
26408 p->M = 1;
26409 }
26410 computeFloor(p);
26411 computeJD(p);
26412 p->iJD -= (p->nFloor+1)*86400000;
26413 clearYMD_HMS_TZ(p);
26414 rc = 0;
26415 }else if( sqlite3_stricmp(z,"year")==0 ){
26416 p->M = 12;
26417 p->D = 31;
26418 rc = 0;
26419 }else if( sqlite3_stricmp(z,"day")==0 ){
26420 rc = 0;
26421 }
26422 break;
26423 }
26424 case 'f': {
26425 /*
26426 ** floor
26427 **
@@ -26478,34 +26521,44 @@
26521 break;
26522 }
26523 case 'w': {
26524 /*
26525 ** weekday N
26526 ** weekday -N
26527 **
26528 ** Move the date forward (for N>=0) or backward (for N<=-0) to the
26529 ** same time on the next/previous occurrence of weekday abs(N)
26530 ** where 0==Sunday, 1==Monday, and so forth. If the date is already
26531 ** on the appropriate weekday, this is a no-op.
26532 */
26533 if( sqlite3_strnicmp(z, "weekday ", 8)==0
26534 && sqlite3AtoF(&z[8], &r)>0
26535 && r>=-6.0 && r<=6.0
26536 && (n=(int)r)==r
26537 ){
26538 sqlite3_int64 Z;
26539 computeYMD_HMS(p);
26540 p->tz = 0;
26541 p->validJD = 0;
26542 computeJD(p);
26543 Z = ((p->iJD + 129600000)/86400000) % 7;
26544 if( n<0 ) n = -n;
26545 if( Z!=n ){
26546 if( Z>n ) Z -= 7;
26547 p->iJD += (n - Z)*86400000;
26548 if( strchr(z+8,'-')!=0 ) p->iJD -= 7*86400000;
26549 }
26550 clearYMD_HMS_TZ(p);
26551 rc = 0;
26552 }
26553 break;
26554 }
26555 case 's': {
26556 /*
26557 ** start of day
26558 ** start of month
26559 ** start of year
26560 **
26561 ** Move the date backwards to the beginning of the current day,
26562 ** or month or year.
26563 **
26564 ** subsecond
@@ -33777,10 +33830,11 @@
33830 ** work (enlarging the buffer) using tail recursion, so that the
33831 ** sqlite3_str_append() routine can use fast calling semantics.
33832 */
33833 static void SQLITE_NOINLINE enlargeAndAppend(StrAccum *p, const char *z, int N){
33834 N = sqlite3StrAccumEnlarge(p, N);
33835 assert( z!=0 || N==0 );
33836 if( N>0 ){
33837 memcpy(&p->zText[p->nChar], z, N);
33838 p->nChar += N;
33839 }
33840 }
@@ -74498,12 +74552,15 @@
74552 /* Freeblock off the end of the page */
74553 return SQLITE_CORRUPT_PAGE(pPage);
74554 }
74555 next = get2byte(&data[pc]);
74556 size = get2byte(&data[pc+2]);
74557 if( size<4 && sqlite3FaultSim(422)==SQLITE_OK ){
74558 /* Minimum freeblock size is 4. Enable fault-sim 422 to disable this
74559 ** check to reach interesting error stats. However, disabling this
74560 ** check can cause assertion faults due to min-heap overflow. All
74561 ** fault-sims are for testing use only, but this one especially so. */
74562 return SQLITE_CORRUPT_PAGE(pPage);
74563 }
74564 nFree = nFree + size;
74565 if( next<pc+size+4 ) break;
74566 pc = next;
@@ -83387,11 +83444,11 @@
83444 checkAppendMsg(pCheck, "Child page depth differs");
83445 depth = d2;
83446 }
83447 }else{
83448 /* Populate the coverage-checking heap for leaf pages */
83449 assert( heap!=0 && heap[0] < pCheck->mxHeap );
83450 btreeHeapInsert(heap, (pc<<16)|(pc+info.nSize-1));
83451 }
83452 }
83453 *piMinKey = maxKey;
83454
@@ -83407,11 +83464,11 @@
83464 heap[0] = 0;
83465 for(i=nCell-1; i>=0; i--){
83466 u32 size;
83467 pc = get2byteAligned(&data[cellStart+i*2]);
83468 size = pPage->xCellSize(pPage, &data[pc]);
83469 assert( heap!=0 && heap[0] < pCheck->mxHeap );
83470 btreeHeapInsert(heap, (pc<<16)|(pc+size-1));
83471 }
83472 }
83473 assert( heap!=0 );
83474 /* Add the freeblocks to the min-heap
@@ -83424,11 +83481,11 @@
83481 while( i>0 ){
83482 int size, j;
83483 assert( (u32)i<=usableSize-4 ); /* Enforced by btreeComputeFreeSpace() */
83484 size = get2byte(&data[i+2]);
83485 assert( (u32)(i+size)<=usableSize ); /* due to btreeComputeFreeSpace() */
83486 assert( heap!=0 && heap[0] < pCheck->mxHeap );
83487 btreeHeapInsert(heap, (((u32)i)<<16)|(i+size-1));
83488 /* EVIDENCE-OF: R-58208-19414 The first 2 bytes of a freeblock are a
83489 ** big-endian integer which is the offset in the b-tree page of the next
83490 ** freeblock in the chain, or zero if the freeblock is the last on the
83491 ** chain. */
@@ -84047,12 +84104,14 @@
84104 ** If the "temp" database is requested, it may need to be opened by this
84105 ** function. If an error occurs while doing so, return 0 and write an
84106 ** error message to pErrorDb.
84107 */
84108 static Btree *findBtree(sqlite3 *pErrorDb, sqlite3 *pDb, const char *zDb){
84109 int i;
84110
84111 assert( pDb!=0 );
84112 i = sqlite3FindDbName(pDb, zDb);
84113 if( i==1 ){
84114 Parse sParse;
84115 int rc = 0;
84116 sqlite3ParseObjectInit(&sParse,pDb);
84117 if( sqlite3OpenTempDatabase(&sParse) ){
@@ -128460,18 +128519,15 @@
128519
128520 #ifndef SQLITE_OMIT_VIRTUALTABLE
128521 /*
128522 ** Return true if zName is a shadow table name in the current database
128523 ** connection.
 
 
 
128524 */
128525 SQLITE_PRIVATE int sqlite3ShadowTableName(sqlite3 *db, const char *zName){
128526 const char *zTail; /* Pointer to the last "_" in zName */
128527 Table *pTab; /* Table that zName is a shadow of */
128528 char *zCopy; /* Transient copy of zName after last "_" */
128529 zTail = strrchr(zName, '_');
128530 if( zTail==0 ) return 0;
128531 zCopy = sqlite3DbStrNDup(db, zName, (int)(zTail-zName));
128532 pTab = zCopy ? sqlite3FindTable(db, zCopy, 0) : 0;
128533 sqlite3DbFree(db, zCopy);
@@ -148036,10 +148092,11 @@
148092 **
148093 ** Caution: Do not confuse this routine with sqlite3ParseObjectInit() which
148094 ** is generated by Lemon.
148095 */
148096 SQLITE_PRIVATE void sqlite3ParseObjectInit(Parse *pParse, sqlite3 *db){
148097 assert( db!=0 );
148098 memset(PARSE_HDR(pParse), 0, PARSE_HDR_SZ);
148099 memset(PARSE_TAIL(pParse), 0, PARSE_TAIL_SZ);
148100 assert( db->pParse!=pParse );
148101 pParse->pOuterParse = db->pParse;
148102 db->pParse = pParse;
@@ -149134,11 +149191,10 @@
149191 pRight->fg.isOn = 1;
149192 p->selFlags |= SF_OnToWhere;
149193 }
149194
149195 if( pRight->fg.isTabFunc && joinType==EP_OuterON && pRight->u1.pFuncArg ){
 
149196 p->selFlags |= SF_OnToWhere;
149197 }
149198 }
149199 return 0;
149200 }
@@ -162084,10 +162140,12 @@
162140 char *zErr = 0;
162141 rc = vtabCallConstructor(db, pTab, pMod, pMod->pModule->xConnect, &zErr);
162142 if( rc!=SQLITE_OK ){
162143 sqlite3ErrorMsg(pParse, "%s", zErr);
162144 pParse->rc = rc;
162145 }else{
162146 sqlite3MarkAllShadowTablesOf(db, pTab);
162147 }
162148 sqlite3DbFree(db, zErr);
162149 }
162150
162151 return rc;
@@ -168316,10 +168374,14 @@
168374 Expr *pColRef;
168375 Expr *pTerm;
168376 if( pItem->fg.isTabFunc==0 ) return;
168377 pTab = pItem->pSTab;
168378 assert( pTab!=0 );
168379 if( !IsVirtual(pTab) ){
168380 sqlite3ErrorMsg(pParse, "'%s' is not a function", pItem->zName);
168381 return;
168382 }
168383 pArgs = pItem->u1.pFuncArg;
168384 if( pArgs==0 ) return;
168385 for(j=k=0; j<pArgs->nExpr; j++){
168386 Expr *pRhs;
168387 u32 joinType;
@@ -253274,10 +253336,14 @@
253336 const u8 *a = pIter->pLeaf->p;
253337 int iTermOff = 0;
253338
253339 pIter->iPgidxOff = pIter->pLeaf->szLeaf;
253340 pIter->iPgidxOff += fts5GetVarint32(&a[pIter->iPgidxOff], iTermOff);
253341 if( iTermOff > pIter->pLeaf->szLeaf ){
253342 p->rc = FTS5_CORRUPT;
253343 return;
253344 }
253345 pIter->iLeafOffset = iTermOff;
253346 fts5SegIterLoadTerm(p, pIter, 0);
253347 fts5SegIterLoadNPos(p, pIter);
253348 if( bDlidx ) fts5SegIterLoadDlidx(p, pIter);
253349
@@ -258983,11 +259049,11 @@
259049 iRowidOff = fts5LeafFirstRowidOff(pLeaf);
259050 if( iRowidOff>=iOff || iOff>=pLeaf->szLeaf ){
259051 FTS5_CORRUPT_ROWID(p, iRow);
259052 }else{
259053 iOff += fts5GetVarint32(&pLeaf->p[iOff], nTerm);
259054 if( (i64)iOff+(i64)nTerm>(i64)pLeaf->szLeaf ){
259055 FTS5_CORRUPT_ROWID(p, iRow);
259056 }else{
259057 res = fts5Memcmp(&pLeaf->p[iOff], zIdxTerm, MIN(nTerm, nIdxTerm));
259058 if( res==0 ) res = nTerm - nIdxTerm;
259059 if( res<0 ) FTS5_CORRUPT_ROWID(p, iRow);
@@ -263631,11 +263697,11 @@
263697 int nArg, /* Number of args */
263698 sqlite3_value **apUnused /* Function arguments */
263699 ){
263700 assert( nArg==0 );
263701 UNUSED_PARAM2(nArg, apUnused);
263702 sqlite3_result_text(pCtx, "fts5: 2026-07-01 12:11:41 88901fffcd445ccb97e4e379ea15d8b06d87b8170cad0f717c909944ff21851f", -1, SQLITE_TRANSIENT);
263703 }
263704
263705 /*
263706 ** Implementation of fts5_locale(LOCALE, TEXT) function.
263707 **
263708
--- 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-06-26 19:31:46 716782abe939083b7732289d862ddfd841057d3458814f96e5e6d7826ec7fa5c"
151
+#define SQLITE_SOURCE_ID "2026-07-01 12:11:41 88901fffcd445ccb97e4e379ea15d8b06d87b8170cad0f717c909944ff21851f"
152152
#define SQLITE_SCM_BRANCH "trunk"
153153
#define SQLITE_SCM_TAGS ""
154
-#define SQLITE_SCM_DATETIME "2026-06-26T19:31:46.902Z"
154
+#define SQLITE_SCM_DATETIME "2026-07-01T12:11:41.802Z"
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-06-26 19:31:46 716782abe939083b7732289d862ddfd841057d3458814f96e5e6d7826ec7fa5c"
152 #define SQLITE_SCM_BRANCH "trunk"
153 #define SQLITE_SCM_TAGS ""
154 #define SQLITE_SCM_DATETIME "2026-06-26T19:31:46.902Z"
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-07-01 12:11:41 88901fffcd445ccb97e4e379ea15d8b06d87b8170cad0f717c909944ff21851f"
152 #define SQLITE_SCM_BRANCH "trunk"
153 #define SQLITE_SCM_TAGS ""
154 #define SQLITE_SCM_DATETIME "2026-07-01T12:11:41.802Z"
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