Fossil SCM

Update the built-in SQLite to the 3.48.0 release.

drh 2025-01-14 15:25 trunk
Commit b361aa14800536f947095121de16374c52c7be18a4246ac6cfaa65f2bf2f27d8
+49 -10
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -5289,31 +5289,34 @@
52895289
u8 bdp = BX_DV_PROTO(c);
52905290
switch( bdp ){
52915291
case ND:
52925292
/* Treat dark non-digits as pad, but they terminate decode too. */
52935293
ncIn = 0;
5294
- deliberate_fall_through;
5294
+ deliberate_fall_through; /* FALLTHRU */
52955295
case WS:
52965296
/* Treat whitespace as pad and terminate this group.*/
52975297
nti = nac;
5298
- deliberate_fall_through;
5298
+ deliberate_fall_through; /* FALLTHRU */
52995299
case PC:
53005300
bdp = 0;
53015301
--nbo;
5302
- deliberate_fall_through;
5302
+ deliberate_fall_through; /* FALLTHRU */
53035303
default: /* bdp is the digit value. */
53045304
qv = qv<<6 | bdp;
53055305
break;
53065306
}
53075307
}
53085308
switch( nbo ){
53095309
case 3:
53105310
pOut[2] = (qv) & 0xff;
5311
+ deliberate_fall_through; /* FALLTHRU */
53115312
case 2:
53125313
pOut[1] = (qv>>8) & 0xff;
5314
+ deliberate_fall_through; /* FALLTHRU */
53135315
case 1:
53145316
pOut[0] = (qv>>16) & 0xff;
5317
+ deliberate_fall_through; /* FALLTHRU */
53155318
}
53165319
pOut += nbo;
53175320
}
53185321
return pOut;
53195322
}
@@ -5644,16 +5647,20 @@
56445647
}
56455648
nbo -= nti; /* Adjust for early (non-digit) end of group. */
56465649
switch( nbo ){
56475650
case 4:
56485651
*pOut++ = (qv >> 24)&0xff;
5652
+ /* FALLTHRU */
56495653
case 3:
56505654
*pOut++ = (qv >> 16)&0xff;
5655
+ /* FALLTHRU */
56515656
case 2:
56525657
*pOut++ = (qv >> 8)&0xff;
5658
+ /* FALLTHRU */
56535659
case 1:
56545660
*pOut++ = qv&0xff;
5661
+ /* FALLTHRU */
56555662
case 0:
56565663
break;
56575664
}
56585665
}
56595666
return pOut;
@@ -7692,11 +7699,12 @@
76927699
76937700
/* Free and reclaim all the memory used by a previously compiled
76947701
** regular expression. Applications should invoke this routine once
76957702
** for every call to re_compile() to avoid memory leaks.
76967703
*/
7697
-static void re_free(ReCompiled *pRe){
7704
+static void re_free(void *p){
7705
+ ReCompiled *pRe = (ReCompiled*)p;
76987706
if( pRe ){
76997707
sqlite3_free(pRe->aOp);
77007708
sqlite3_free(pRe->aArg);
77017709
sqlite3_free(pRe);
77027710
}
@@ -8358,11 +8366,11 @@
83588366
LPWSTR zUnicodeName;
83598367
extern LPWSTR sqlite3_win32_utf8_to_unicode(const char*);
83608368
83618369
GetSystemTime(&currentTime);
83628370
SystemTimeToFileTime(&currentTime, &lastAccess);
8363
- intervals = Int32x32To64(mtime, 10000000) + 116444736000000000;
8371
+ intervals = (mtime*10000000) + 116444736000000000;
83648372
lastWrite.dwLowDateTime = (DWORD)intervals;
83658373
lastWrite.dwHighDateTime = intervals >> 32;
83668374
zUnicodeName = sqlite3_win32_utf8_to_unicode(zFile);
83678375
if( zUnicodeName==0 ){
83688376
return 1;
@@ -16344,10 +16352,11 @@
1634416352
#define VTR_DLCLOSE 0x00800000
1634516353
#define VTR_RAND 0x01000000
1634616354
#define VTR_SLEEP 0x02000000
1634716355
#define VTR_CURTIME 0x04000000
1634816356
#define VTR_LASTERR 0x08000000
16357
+#define VTR_FETCH 0x10000000 /* Also coverse xUnfetch */
1634916358
1635016359
/*
1635116360
** Method declarations for vfstrace_file.
1635216361
*/
1635316362
static int vfstraceClose(sqlite3_file*);
@@ -16773,10 +16782,11 @@
1677316782
{ "randomness", VTR_RAND },
1677416783
{ "sleep", VTR_SLEEP },
1677516784
{ "currenttime", VTR_CURTIME },
1677616785
{ "currenttimeint64", VTR_CURTIME },
1677716786
{ "getlasterror", VTR_LASTERR },
16787
+ { "fetch", VTR_FETCH },
1677816788
};
1677916789
int onOff = 1;
1678016790
while( zArg[0] ){
1678116791
int jj, n;
1678216792
while( zArg[0]!=0 && zArg[0]!='-' && zArg[0]!='+'
@@ -17000,11 +17010,32 @@
1700017010
pInfo->zVfsName, p->zFName, delFlag);
1700117011
rc = p->pReal->pMethods->xShmUnmap(p->pReal, delFlag);
1700217012
vfstrace_print_errcode(pInfo, " -> %s\n", rc);
1700317013
return rc;
1700417014
}
17005
-
17015
+static int vfstraceFetch(sqlite3_file *pFile, i64 iOff, int nAmt, void **pptr){
17016
+ vfstrace_file *p = (vfstrace_file *)pFile;
17017
+ vfstrace_info *pInfo = p->pInfo;
17018
+ int rc;
17019
+ vfstraceOnOff(pInfo, VTR_FETCH);
17020
+ vfstrace_printf(pInfo, "%s.xFetch(%s,iOff=%lld,nAmt=%d,p=%p)",
17021
+ pInfo->zVfsName, p->zFName, iOff, nAmt, *pptr);
17022
+ rc = p->pReal->pMethods->xFetch(p->pReal, iOff, nAmt, pptr);
17023
+ vfstrace_print_errcode(pInfo, " -> %s\n", rc);
17024
+ return rc;
17025
+}
17026
+static int vfstraceUnfetch(sqlite3_file *pFile, i64 iOff, void *ptr){
17027
+ vfstrace_file *p = (vfstrace_file *)pFile;
17028
+ vfstrace_info *pInfo = p->pInfo;
17029
+ int rc;
17030
+ vfstraceOnOff(pInfo, VTR_FETCH);
17031
+ vfstrace_printf(pInfo, "%s.xUnfetch(%s,iOff=%lld,p=%p)",
17032
+ pInfo->zVfsName, p->zFName, iOff, ptr);
17033
+ rc = p->pReal->pMethods->xUnfetch(p->pReal, iOff, ptr);
17034
+ vfstrace_print_errcode(pInfo, " -> %s\n", rc);
17035
+ return rc;
17036
+}
1700617037
1700717038
1700817039
/*
1700917040
** Open an vfstrace file handle.
1701017041
*/
@@ -17047,10 +17078,14 @@
1704717078
pNew->xShmMap = pSub->xShmMap ? vfstraceShmMap : 0;
1704817079
pNew->xShmLock = pSub->xShmLock ? vfstraceShmLock : 0;
1704917080
pNew->xShmBarrier = pSub->xShmBarrier ? vfstraceShmBarrier : 0;
1705017081
pNew->xShmUnmap = pSub->xShmUnmap ? vfstraceShmUnmap : 0;
1705117082
}
17083
+ if( pNew->iVersion>=3 ){
17084
+ pNew->xFetch = pSub->xFetch ? vfstraceFetch : 0;
17085
+ pNew->xUnfetch = pSub->xUnfetch ? vfstraceUnfetch : 0;
17086
+ }
1705217087
pFile->pMethods = pNew;
1705317088
}
1705417089
vfstrace_print_errcode(pInfo, " -> %s", rc);
1705517090
if( pOutFlags ){
1705617091
vfstrace_printf(pInfo, ", outFlags=0x%x\n", *pOutFlags);
@@ -27460,11 +27495,11 @@
2746027495
case AR_SWITCH_VERBOSE:
2746127496
pAr->bVerbose = 1;
2746227497
break;
2746327498
case AR_SWITCH_APPEND:
2746427499
pAr->bAppend = 1;
27465
- deliberate_fall_through;
27500
+ deliberate_fall_through; /* FALLTHRU */
2746627501
case AR_SWITCH_FILE:
2746727502
pAr->zFile = zArg;
2746827503
break;
2746927504
case AR_SWITCH_DIRECTORY:
2747027505
pAr->zDir = zArg;
@@ -30202,10 +30237,11 @@
3020230237
}
3020330238
}
3020430239
if( zFile==0 ){
3020530240
zFile = sqlite3_mprintf("stdout");
3020630241
}
30242
+ shell_check_oom(zFile);
3020730243
if( bOnce ){
3020830244
p->outCount = 2;
3020930245
}else{
3021030246
p->outCount = 0;
3021130247
}
@@ -30244,10 +30280,11 @@
3024430280
rc = 1;
3024530281
output_redir(p, stdout);
3024630282
#else
3024730283
FILE *pfPipe = sqlite3_popen(zFile + 1, "w");
3024830284
if( pfPipe==0 ){
30285
+ assert( stderr!=NULL );
3024930286
sqlite3_fprintf(stderr,"Error: cannot open pipe \"%s\"\n", zFile + 1);
3025030287
rc = 1;
3025130288
}else{
3025230289
output_redir(p, pfPipe);
3025330290
if( zBom ) sqlite3_fputs(zBom, pfPipe);
@@ -30256,11 +30293,12 @@
3025630293
#endif
3025730294
}else{
3025830295
FILE *pfFile = output_file_open(zFile);
3025930296
if( pfFile==0 ){
3026030297
if( cli_strcmp(zFile,"off")!=0 ){
30261
- sqlite3_fprintf(stderr,"Error: cannot write to \"%s\"\n", zFile);
30298
+ assert( stderr!=NULL );
30299
+ sqlite3_fprintf(stderr,"Error: cannot write to \"%s\"\n", zFile);
3026230300
}
3026330301
rc = 1;
3026430302
} else {
3026530303
output_redir(p, pfFile);
3026630304
if( zBom ) sqlite3_fputs(zBom, pfFile);
@@ -30360,10 +30398,11 @@
3036030398
sqlite3_finalize(pStmt);
3036130399
pStmt = 0;
3036230400
rc = 1;
3036330401
}
3036430402
}
30403
+ bind_prepared_stmt(p, pStmt);
3036530404
sqlite3_step(pStmt);
3036630405
sqlite3_finalize(pStmt);
3036730406
}else
3036830407
3036930408
/* .parameter unset NAME
@@ -32148,11 +32187,11 @@
3214832187
goto TermScan;
3214932188
}
3215032189
break;
3215132190
case '[':
3215232191
cin = ']';
32153
- deliberate_fall_through;
32192
+ deliberate_fall_through; /* FALLTHRU */
3215432193
case '`': case '\'': case '"':
3215532194
cWait = cin;
3215632195
qss = QSS_HasDark | cWait;
3215732196
CONTINUE_PROMPT_AWAITC(pst, cin);
3215832197
goto TermScan;
@@ -32183,11 +32222,11 @@
3218332222
if(*zLine==cWait){
3218432223
/* Swallow doubled end-delimiter.*/
3218532224
++zLine;
3218632225
continue;
3218732226
}
32188
- deliberate_fall_through;
32227
+ deliberate_fall_through; /* FALLTHRU */
3218932228
case ']':
3219032229
CONTINUE_PROMPT_AWAITC(pst, 0);
3219132230
qss = QSS_SETV(qss, 0);
3219232231
goto PlainScan;
3219332232
default: assert(0);
3219432233
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -5289,31 +5289,34 @@
5289 u8 bdp = BX_DV_PROTO(c);
5290 switch( bdp ){
5291 case ND:
5292 /* Treat dark non-digits as pad, but they terminate decode too. */
5293 ncIn = 0;
5294 deliberate_fall_through;
5295 case WS:
5296 /* Treat whitespace as pad and terminate this group.*/
5297 nti = nac;
5298 deliberate_fall_through;
5299 case PC:
5300 bdp = 0;
5301 --nbo;
5302 deliberate_fall_through;
5303 default: /* bdp is the digit value. */
5304 qv = qv<<6 | bdp;
5305 break;
5306 }
5307 }
5308 switch( nbo ){
5309 case 3:
5310 pOut[2] = (qv) & 0xff;
 
5311 case 2:
5312 pOut[1] = (qv>>8) & 0xff;
 
5313 case 1:
5314 pOut[0] = (qv>>16) & 0xff;
 
5315 }
5316 pOut += nbo;
5317 }
5318 return pOut;
5319 }
@@ -5644,16 +5647,20 @@
5644 }
5645 nbo -= nti; /* Adjust for early (non-digit) end of group. */
5646 switch( nbo ){
5647 case 4:
5648 *pOut++ = (qv >> 24)&0xff;
 
5649 case 3:
5650 *pOut++ = (qv >> 16)&0xff;
 
5651 case 2:
5652 *pOut++ = (qv >> 8)&0xff;
 
5653 case 1:
5654 *pOut++ = qv&0xff;
 
5655 case 0:
5656 break;
5657 }
5658 }
5659 return pOut;
@@ -7692,11 +7699,12 @@
7692
7693 /* Free and reclaim all the memory used by a previously compiled
7694 ** regular expression. Applications should invoke this routine once
7695 ** for every call to re_compile() to avoid memory leaks.
7696 */
7697 static void re_free(ReCompiled *pRe){
 
7698 if( pRe ){
7699 sqlite3_free(pRe->aOp);
7700 sqlite3_free(pRe->aArg);
7701 sqlite3_free(pRe);
7702 }
@@ -8358,11 +8366,11 @@
8358 LPWSTR zUnicodeName;
8359 extern LPWSTR sqlite3_win32_utf8_to_unicode(const char*);
8360
8361 GetSystemTime(&currentTime);
8362 SystemTimeToFileTime(&currentTime, &lastAccess);
8363 intervals = Int32x32To64(mtime, 10000000) + 116444736000000000;
8364 lastWrite.dwLowDateTime = (DWORD)intervals;
8365 lastWrite.dwHighDateTime = intervals >> 32;
8366 zUnicodeName = sqlite3_win32_utf8_to_unicode(zFile);
8367 if( zUnicodeName==0 ){
8368 return 1;
@@ -16344,10 +16352,11 @@
16344 #define VTR_DLCLOSE 0x00800000
16345 #define VTR_RAND 0x01000000
16346 #define VTR_SLEEP 0x02000000
16347 #define VTR_CURTIME 0x04000000
16348 #define VTR_LASTERR 0x08000000
 
16349
16350 /*
16351 ** Method declarations for vfstrace_file.
16352 */
16353 static int vfstraceClose(sqlite3_file*);
@@ -16773,10 +16782,11 @@
16773 { "randomness", VTR_RAND },
16774 { "sleep", VTR_SLEEP },
16775 { "currenttime", VTR_CURTIME },
16776 { "currenttimeint64", VTR_CURTIME },
16777 { "getlasterror", VTR_LASTERR },
 
16778 };
16779 int onOff = 1;
16780 while( zArg[0] ){
16781 int jj, n;
16782 while( zArg[0]!=0 && zArg[0]!='-' && zArg[0]!='+'
@@ -17000,11 +17010,32 @@
17000 pInfo->zVfsName, p->zFName, delFlag);
17001 rc = p->pReal->pMethods->xShmUnmap(p->pReal, delFlag);
17002 vfstrace_print_errcode(pInfo, " -> %s\n", rc);
17003 return rc;
17004 }
17005
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17006
17007
17008 /*
17009 ** Open an vfstrace file handle.
17010 */
@@ -17047,10 +17078,14 @@
17047 pNew->xShmMap = pSub->xShmMap ? vfstraceShmMap : 0;
17048 pNew->xShmLock = pSub->xShmLock ? vfstraceShmLock : 0;
17049 pNew->xShmBarrier = pSub->xShmBarrier ? vfstraceShmBarrier : 0;
17050 pNew->xShmUnmap = pSub->xShmUnmap ? vfstraceShmUnmap : 0;
17051 }
 
 
 
 
17052 pFile->pMethods = pNew;
17053 }
17054 vfstrace_print_errcode(pInfo, " -> %s", rc);
17055 if( pOutFlags ){
17056 vfstrace_printf(pInfo, ", outFlags=0x%x\n", *pOutFlags);
@@ -27460,11 +27495,11 @@
27460 case AR_SWITCH_VERBOSE:
27461 pAr->bVerbose = 1;
27462 break;
27463 case AR_SWITCH_APPEND:
27464 pAr->bAppend = 1;
27465 deliberate_fall_through;
27466 case AR_SWITCH_FILE:
27467 pAr->zFile = zArg;
27468 break;
27469 case AR_SWITCH_DIRECTORY:
27470 pAr->zDir = zArg;
@@ -30202,10 +30237,11 @@
30202 }
30203 }
30204 if( zFile==0 ){
30205 zFile = sqlite3_mprintf("stdout");
30206 }
 
30207 if( bOnce ){
30208 p->outCount = 2;
30209 }else{
30210 p->outCount = 0;
30211 }
@@ -30244,10 +30280,11 @@
30244 rc = 1;
30245 output_redir(p, stdout);
30246 #else
30247 FILE *pfPipe = sqlite3_popen(zFile + 1, "w");
30248 if( pfPipe==0 ){
 
30249 sqlite3_fprintf(stderr,"Error: cannot open pipe \"%s\"\n", zFile + 1);
30250 rc = 1;
30251 }else{
30252 output_redir(p, pfPipe);
30253 if( zBom ) sqlite3_fputs(zBom, pfPipe);
@@ -30256,11 +30293,12 @@
30256 #endif
30257 }else{
30258 FILE *pfFile = output_file_open(zFile);
30259 if( pfFile==0 ){
30260 if( cli_strcmp(zFile,"off")!=0 ){
30261 sqlite3_fprintf(stderr,"Error: cannot write to \"%s\"\n", zFile);
 
30262 }
30263 rc = 1;
30264 } else {
30265 output_redir(p, pfFile);
30266 if( zBom ) sqlite3_fputs(zBom, pfFile);
@@ -30360,10 +30398,11 @@
30360 sqlite3_finalize(pStmt);
30361 pStmt = 0;
30362 rc = 1;
30363 }
30364 }
 
30365 sqlite3_step(pStmt);
30366 sqlite3_finalize(pStmt);
30367 }else
30368
30369 /* .parameter unset NAME
@@ -32148,11 +32187,11 @@
32148 goto TermScan;
32149 }
32150 break;
32151 case '[':
32152 cin = ']';
32153 deliberate_fall_through;
32154 case '`': case '\'': case '"':
32155 cWait = cin;
32156 qss = QSS_HasDark | cWait;
32157 CONTINUE_PROMPT_AWAITC(pst, cin);
32158 goto TermScan;
@@ -32183,11 +32222,11 @@
32183 if(*zLine==cWait){
32184 /* Swallow doubled end-delimiter.*/
32185 ++zLine;
32186 continue;
32187 }
32188 deliberate_fall_through;
32189 case ']':
32190 CONTINUE_PROMPT_AWAITC(pst, 0);
32191 qss = QSS_SETV(qss, 0);
32192 goto PlainScan;
32193 default: assert(0);
32194
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -5289,31 +5289,34 @@
5289 u8 bdp = BX_DV_PROTO(c);
5290 switch( bdp ){
5291 case ND:
5292 /* Treat dark non-digits as pad, but they terminate decode too. */
5293 ncIn = 0;
5294 deliberate_fall_through; /* FALLTHRU */
5295 case WS:
5296 /* Treat whitespace as pad and terminate this group.*/
5297 nti = nac;
5298 deliberate_fall_through; /* FALLTHRU */
5299 case PC:
5300 bdp = 0;
5301 --nbo;
5302 deliberate_fall_through; /* FALLTHRU */
5303 default: /* bdp is the digit value. */
5304 qv = qv<<6 | bdp;
5305 break;
5306 }
5307 }
5308 switch( nbo ){
5309 case 3:
5310 pOut[2] = (qv) & 0xff;
5311 deliberate_fall_through; /* FALLTHRU */
5312 case 2:
5313 pOut[1] = (qv>>8) & 0xff;
5314 deliberate_fall_through; /* FALLTHRU */
5315 case 1:
5316 pOut[0] = (qv>>16) & 0xff;
5317 deliberate_fall_through; /* FALLTHRU */
5318 }
5319 pOut += nbo;
5320 }
5321 return pOut;
5322 }
@@ -5644,16 +5647,20 @@
5647 }
5648 nbo -= nti; /* Adjust for early (non-digit) end of group. */
5649 switch( nbo ){
5650 case 4:
5651 *pOut++ = (qv >> 24)&0xff;
5652 /* FALLTHRU */
5653 case 3:
5654 *pOut++ = (qv >> 16)&0xff;
5655 /* FALLTHRU */
5656 case 2:
5657 *pOut++ = (qv >> 8)&0xff;
5658 /* FALLTHRU */
5659 case 1:
5660 *pOut++ = qv&0xff;
5661 /* FALLTHRU */
5662 case 0:
5663 break;
5664 }
5665 }
5666 return pOut;
@@ -7692,11 +7699,12 @@
7699
7700 /* Free and reclaim all the memory used by a previously compiled
7701 ** regular expression. Applications should invoke this routine once
7702 ** for every call to re_compile() to avoid memory leaks.
7703 */
7704 static void re_free(void *p){
7705 ReCompiled *pRe = (ReCompiled*)p;
7706 if( pRe ){
7707 sqlite3_free(pRe->aOp);
7708 sqlite3_free(pRe->aArg);
7709 sqlite3_free(pRe);
7710 }
@@ -8358,11 +8366,11 @@
8366 LPWSTR zUnicodeName;
8367 extern LPWSTR sqlite3_win32_utf8_to_unicode(const char*);
8368
8369 GetSystemTime(&currentTime);
8370 SystemTimeToFileTime(&currentTime, &lastAccess);
8371 intervals = (mtime*10000000) + 116444736000000000;
8372 lastWrite.dwLowDateTime = (DWORD)intervals;
8373 lastWrite.dwHighDateTime = intervals >> 32;
8374 zUnicodeName = sqlite3_win32_utf8_to_unicode(zFile);
8375 if( zUnicodeName==0 ){
8376 return 1;
@@ -16344,10 +16352,11 @@
16352 #define VTR_DLCLOSE 0x00800000
16353 #define VTR_RAND 0x01000000
16354 #define VTR_SLEEP 0x02000000
16355 #define VTR_CURTIME 0x04000000
16356 #define VTR_LASTERR 0x08000000
16357 #define VTR_FETCH 0x10000000 /* Also coverse xUnfetch */
16358
16359 /*
16360 ** Method declarations for vfstrace_file.
16361 */
16362 static int vfstraceClose(sqlite3_file*);
@@ -16773,10 +16782,11 @@
16782 { "randomness", VTR_RAND },
16783 { "sleep", VTR_SLEEP },
16784 { "currenttime", VTR_CURTIME },
16785 { "currenttimeint64", VTR_CURTIME },
16786 { "getlasterror", VTR_LASTERR },
16787 { "fetch", VTR_FETCH },
16788 };
16789 int onOff = 1;
16790 while( zArg[0] ){
16791 int jj, n;
16792 while( zArg[0]!=0 && zArg[0]!='-' && zArg[0]!='+'
@@ -17000,11 +17010,32 @@
17010 pInfo->zVfsName, p->zFName, delFlag);
17011 rc = p->pReal->pMethods->xShmUnmap(p->pReal, delFlag);
17012 vfstrace_print_errcode(pInfo, " -> %s\n", rc);
17013 return rc;
17014 }
17015 static int vfstraceFetch(sqlite3_file *pFile, i64 iOff, int nAmt, void **pptr){
17016 vfstrace_file *p = (vfstrace_file *)pFile;
17017 vfstrace_info *pInfo = p->pInfo;
17018 int rc;
17019 vfstraceOnOff(pInfo, VTR_FETCH);
17020 vfstrace_printf(pInfo, "%s.xFetch(%s,iOff=%lld,nAmt=%d,p=%p)",
17021 pInfo->zVfsName, p->zFName, iOff, nAmt, *pptr);
17022 rc = p->pReal->pMethods->xFetch(p->pReal, iOff, nAmt, pptr);
17023 vfstrace_print_errcode(pInfo, " -> %s\n", rc);
17024 return rc;
17025 }
17026 static int vfstraceUnfetch(sqlite3_file *pFile, i64 iOff, void *ptr){
17027 vfstrace_file *p = (vfstrace_file *)pFile;
17028 vfstrace_info *pInfo = p->pInfo;
17029 int rc;
17030 vfstraceOnOff(pInfo, VTR_FETCH);
17031 vfstrace_printf(pInfo, "%s.xUnfetch(%s,iOff=%lld,p=%p)",
17032 pInfo->zVfsName, p->zFName, iOff, ptr);
17033 rc = p->pReal->pMethods->xUnfetch(p->pReal, iOff, ptr);
17034 vfstrace_print_errcode(pInfo, " -> %s\n", rc);
17035 return rc;
17036 }
17037
17038
17039 /*
17040 ** Open an vfstrace file handle.
17041 */
@@ -17047,10 +17078,14 @@
17078 pNew->xShmMap = pSub->xShmMap ? vfstraceShmMap : 0;
17079 pNew->xShmLock = pSub->xShmLock ? vfstraceShmLock : 0;
17080 pNew->xShmBarrier = pSub->xShmBarrier ? vfstraceShmBarrier : 0;
17081 pNew->xShmUnmap = pSub->xShmUnmap ? vfstraceShmUnmap : 0;
17082 }
17083 if( pNew->iVersion>=3 ){
17084 pNew->xFetch = pSub->xFetch ? vfstraceFetch : 0;
17085 pNew->xUnfetch = pSub->xUnfetch ? vfstraceUnfetch : 0;
17086 }
17087 pFile->pMethods = pNew;
17088 }
17089 vfstrace_print_errcode(pInfo, " -> %s", rc);
17090 if( pOutFlags ){
17091 vfstrace_printf(pInfo, ", outFlags=0x%x\n", *pOutFlags);
@@ -27460,11 +27495,11 @@
27495 case AR_SWITCH_VERBOSE:
27496 pAr->bVerbose = 1;
27497 break;
27498 case AR_SWITCH_APPEND:
27499 pAr->bAppend = 1;
27500 deliberate_fall_through; /* FALLTHRU */
27501 case AR_SWITCH_FILE:
27502 pAr->zFile = zArg;
27503 break;
27504 case AR_SWITCH_DIRECTORY:
27505 pAr->zDir = zArg;
@@ -30202,10 +30237,11 @@
30237 }
30238 }
30239 if( zFile==0 ){
30240 zFile = sqlite3_mprintf("stdout");
30241 }
30242 shell_check_oom(zFile);
30243 if( bOnce ){
30244 p->outCount = 2;
30245 }else{
30246 p->outCount = 0;
30247 }
@@ -30244,10 +30280,11 @@
30280 rc = 1;
30281 output_redir(p, stdout);
30282 #else
30283 FILE *pfPipe = sqlite3_popen(zFile + 1, "w");
30284 if( pfPipe==0 ){
30285 assert( stderr!=NULL );
30286 sqlite3_fprintf(stderr,"Error: cannot open pipe \"%s\"\n", zFile + 1);
30287 rc = 1;
30288 }else{
30289 output_redir(p, pfPipe);
30290 if( zBom ) sqlite3_fputs(zBom, pfPipe);
@@ -30256,11 +30293,12 @@
30293 #endif
30294 }else{
30295 FILE *pfFile = output_file_open(zFile);
30296 if( pfFile==0 ){
30297 if( cli_strcmp(zFile,"off")!=0 ){
30298 assert( stderr!=NULL );
30299 sqlite3_fprintf(stderr,"Error: cannot write to \"%s\"\n", zFile);
30300 }
30301 rc = 1;
30302 } else {
30303 output_redir(p, pfFile);
30304 if( zBom ) sqlite3_fputs(zBom, pfFile);
@@ -30360,10 +30398,11 @@
30398 sqlite3_finalize(pStmt);
30399 pStmt = 0;
30400 rc = 1;
30401 }
30402 }
30403 bind_prepared_stmt(p, pStmt);
30404 sqlite3_step(pStmt);
30405 sqlite3_finalize(pStmt);
30406 }else
30407
30408 /* .parameter unset NAME
@@ -32148,11 +32187,11 @@
32187 goto TermScan;
32188 }
32189 break;
32190 case '[':
32191 cin = ']';
32192 deliberate_fall_through; /* FALLTHRU */
32193 case '`': case '\'': case '"':
32194 cWait = cin;
32195 qss = QSS_HasDark | cWait;
32196 CONTINUE_PROMPT_AWAITC(pst, cin);
32197 goto TermScan;
@@ -32183,11 +32222,11 @@
32222 if(*zLine==cWait){
32223 /* Swallow doubled end-delimiter.*/
32224 ++zLine;
32225 continue;
32226 }
32227 deliberate_fall_through; /* FALLTHRU */
32228 case ']':
32229 CONTINUE_PROMPT_AWAITC(pst, 0);
32230 qss = QSS_SETV(qss, 0);
32231 goto PlainScan;
32232 default: assert(0);
32233
+70 -41
--- 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
-** 2b17bc49655c577029919c2d409de994b0d2 with changes in files:
21
+** d2fe6b05f38d9d7cd78c5d252e99ac59f1ae with changes in files:
2222
**
2323
**
2424
*/
2525
#ifndef SQLITE_AMALGAMATION
2626
#define SQLITE_CORE 1
@@ -465,11 +465,11 @@
465465
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
466466
** [sqlite_version()] and [sqlite_source_id()].
467467
*/
468468
#define SQLITE_VERSION "3.48.0"
469469
#define SQLITE_VERSION_NUMBER 3048000
470
-#define SQLITE_SOURCE_ID "2024-12-30 21:23:53 2b17bc49655c577029919c2d409de994b0d252f8efb5da1ba0913f2c96bee552"
470
+#define SQLITE_SOURCE_ID "2025-01-14 11:05:00 d2fe6b05f38d9d7cd78c5d252e99ac59f1aea071d669830c1ffe4e8966e84010"
471471
472472
/*
473473
** CAPI3REF: Run-Time Library Version Numbers
474474
** KEYWORDS: sqlite3_version sqlite3_sourceid
475475
**
@@ -33052,11 +33052,14 @@
3305233052
}
3305333053
if( pItem->fg.fromDDL ){
3305433054
sqlite3_str_appendf(&x, " DDL");
3305533055
}
3305633056
if( pItem->fg.isCte ){
33057
- sqlite3_str_appendf(&x, " CteUse=0x%p", pItem->u2.pCteUse);
33057
+ static const char *aMat[] = {",MAT", "", ",NO-MAT"};
33058
+ sqlite3_str_appendf(&x, " CteUse=%d%s",
33059
+ pItem->u2.pCteUse->nUse,
33060
+ aMat[pItem->u2.pCteUse->eM10d]);
3305833061
}
3305933062
if( pItem->fg.isOn || (pItem->fg.isUsing==0 && pItem->u3.pOn!=0) ){
3306033063
sqlite3_str_appendf(&x, " isOn");
3306133064
}
3306233065
if( pItem->fg.isTabFunc ) sqlite3_str_appendf(&x, " isTabFunc");
@@ -33083,13 +33086,10 @@
3308333086
if( pItem->pSTab ){
3308433087
Table *pTab = pItem->pSTab;
3308533088
sqlite3TreeViewColumnList(pView, pTab->aCol, pTab->nCol, 1);
3308633089
}
3308733090
assert( (int)pItem->fg.isNestedFrom == IsNestedFrom(pItem) );
33088
- sqlite3TreeViewPush(&pView, 0);
33089
- sqlite3TreeViewLine(pView, "SUBQUERY");
33090
- sqlite3TreeViewPop(&pView);
3309133091
sqlite3TreeViewSelect(pView, pItem->u4.pSubq->pSelect, 0);
3309233092
}
3309333093
if( pItem->fg.isTabFunc ){
3309433094
sqlite3TreeViewExprList(pView, pItem->u1.pFuncArg, 0, "func-args:");
3309533095
}
@@ -112713,10 +112713,11 @@
112713112713
if( mCol & colUsed ) break; /* Each column used only once */
112714112714
colUsed |= mCol;
112715112715
if( aiMap ) aiMap[i] = j;
112716112716
}
112717112717
112718
+ assert( nExpr>0 && nExpr<BMS );
112718112719
assert( i==nExpr || colUsed!=(MASKBIT(nExpr)-1) );
112719112720
if( colUsed==(MASKBIT(nExpr)-1) ){
112720112721
/* If we reach this point, that means the index pIdx is usable */
112721112722
int iAddr = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
112722112723
ExplainQueryPlan((pParse, 0,
@@ -164142,10 +164143,15 @@
164142164143
**
164143164144
** 2. If iCol is part of an existing index that has an aiRowLogEst of
164144164145
** more than 20, then return false.
164145164146
**
164146164147
** 3. If no disqualifying conditions above are found, return true.
164148
+**
164149
+** 2025-01-03: I experimented with a new rule that returns false if the
164150
+** the datatype of the column is "BOOLEAN". This did not improve
164151
+** performance on any queries at hand, but it did burn CPU cycles, so the
164152
+** idea was not committed.
164147164153
*/
164148164154
static SQLITE_NOINLINE int columnIsGoodIndexCandidate(
164149164155
const Table *pTab,
164150164156
int iCol
164151164157
){
@@ -226243,10 +226249,28 @@
226243226249
static int dbpageRowid(sqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){
226244226250
DbpageCursor *pCsr = (DbpageCursor *)pCursor;
226245226251
*pRowid = pCsr->pgno;
226246226252
return SQLITE_OK;
226247226253
}
226254
+
226255
+/*
226256
+** Open write transactions. Since we do not know in advance which database
226257
+** files will be written by the sqlite_dbpage virtual table, start a write
226258
+** transaction on them all.
226259
+**
226260
+** Return SQLITE_OK if successful, or an SQLite error code otherwise.
226261
+*/
226262
+static int dbpageBeginTrans(DbpageTable *pTab){
226263
+ sqlite3 *db = pTab->db;
226264
+ int rc = SQLITE_OK;
226265
+ int i;
226266
+ for(i=0; rc==SQLITE_OK && i<db->nDb; i++){
226267
+ Btree *pBt = db->aDb[i].pBt;
226268
+ if( pBt ) rc = sqlite3BtreeBeginTrans(pBt, 1, 0);
226269
+ }
226270
+ return rc;
226271
+}
226248226272
226249226273
static int dbpageUpdate(
226250226274
sqlite3_vtab *pVtab,
226251226275
int argc,
226252226276
sqlite3_value **argv,
@@ -226311,10 +226335,16 @@
226311226335
}else{
226312226336
zErr = "bad page value";
226313226337
goto update_fail;
226314226338
}
226315226339
}
226340
+
226341
+ if( dbpageBeginTrans(pTab)!=SQLITE_OK ){
226342
+ zErr = "failed to open transaction";
226343
+ goto update_fail;
226344
+ }
226345
+
226316226346
pPager = sqlite3BtreePager(pBt);
226317226347
rc = sqlite3PagerGet(pPager, pgno, (DbPage**)&pDbPage, 0);
226318226348
if( rc==SQLITE_OK ){
226319226349
const void *pData = sqlite3_value_blob(argv[3]);
226320226350
if( (rc = sqlite3PagerWrite(pDbPage))==SQLITE_OK && pData ){
@@ -226332,22 +226362,12 @@
226332226362
sqlite3_free(pVtab->zErrMsg);
226333226363
pVtab->zErrMsg = sqlite3_mprintf("%s", zErr);
226334226364
return SQLITE_ERROR;
226335226365
}
226336226366
226337
-/* Since we do not know in advance which database files will be
226338
-** written by the sqlite_dbpage virtual table, start a write transaction
226339
-** on them all.
226340
-*/
226341226367
static int dbpageBegin(sqlite3_vtab *pVtab){
226342226368
DbpageTable *pTab = (DbpageTable *)pVtab;
226343
- sqlite3 *db = pTab->db;
226344
- int i;
226345
- for(i=0; i<db->nDb; i++){
226346
- Btree *pBt = db->aDb[i].pBt;
226347
- if( pBt ) (void)sqlite3BtreeBeginTrans(pBt, 1, 0);
226348
- }
226349226369
pTab->pgnoTrunc = 0;
226350226370
return SQLITE_OK;
226351226371
}
226352226372
226353226373
/* Invoke sqlite3PagerTruncate() as necessary, just prior to COMMIT
@@ -226379,11 +226399,11 @@
226379226399
/*
226380226400
** Invoke this routine to register the "dbpage" virtual table module
226381226401
*/
226382226402
SQLITE_PRIVATE int sqlite3DbpageRegister(sqlite3 *db){
226383226403
static sqlite3_module dbpage_module = {
226384
- 0, /* iVersion */
226404
+ 2, /* iVersion */
226385226405
dbpageConnect, /* xCreate */
226386226406
dbpageConnect, /* xConnect */
226387226407
dbpageBestIndex, /* xBestIndex */
226388226408
dbpageDisconnect, /* xDisconnect */
226389226409
dbpageDisconnect, /* xDestroy */
@@ -231698,16 +231718,16 @@
231698231718
if( res!=SQLITE_CHANGESET_OMIT ){
231699231719
rc = SQLITE_CONSTRAINT;
231700231720
}
231701231721
}
231702231722
}
231703
- sqlite3_exec(db, "PRAGMA defer_foreign_keys = 0", 0, 0, 0);
231704231723
231705231724
if( (flags & SQLITE_CHANGESETAPPLY_NOSAVEPOINT)==0 ){
231706231725
if( rc==SQLITE_OK ){
231707231726
rc = sqlite3_exec(db, "RELEASE changeset_apply", 0, 0, 0);
231708
- }else{
231727
+ }
231728
+ if( rc!=SQLITE_OK ){
231709231729
sqlite3_exec(db, "ROLLBACK TO changeset_apply", 0, 0, 0);
231710231730
sqlite3_exec(db, "RELEASE changeset_apply", 0, 0, 0);
231711231731
}
231712231732
}
231713231733
@@ -243323,13 +243343,17 @@
243323243343
sqlite3_stmt **ppStmt,
243324243344
char *zSql
243325243345
){
243326243346
if( p->rc==SQLITE_OK ){
243327243347
if( zSql ){
243328
- p->rc = sqlite3_prepare_v3(p->pConfig->db, zSql, -1,
243348
+ int rc = sqlite3_prepare_v3(p->pConfig->db, zSql, -1,
243329243349
SQLITE_PREPARE_PERSISTENT|SQLITE_PREPARE_NO_VTAB,
243330243350
ppStmt, 0);
243351
+ /* If this prepare() call fails with SQLITE_ERROR, then one of the
243352
+ ** %_idx or %_data tables has been removed or modified. Call this
243353
+ ** corruption. */
243354
+ p->rc = (rc==SQLITE_ERROR ? SQLITE_CORRUPT : rc);
243331243355
}else{
243332243356
p->rc = SQLITE_NOMEM;
243333243357
}
243334243358
}
243335243359
sqlite3_free(zSql);
@@ -247904,10 +247928,28 @@
247904247928
int nTerm,
247905247929
i64 iRowid
247906247930
){
247907247931
const int f = FTS5INDEX_QUERY_SKIPHASH;
247908247932
Fts5Iter *pIter = 0; /* Used to find term instance */
247933
+
247934
+ /* If the version number has not been set to SECUREDELETE, do so now. */
247935
+ if( p->pConfig->iVersion!=FTS5_CURRENT_VERSION_SECUREDELETE ){
247936
+ Fts5Config *pConfig = p->pConfig;
247937
+ sqlite3_stmt *pStmt = 0;
247938
+ fts5IndexPrepareStmt(p, &pStmt, sqlite3_mprintf(
247939
+ "REPLACE INTO %Q.'%q_config' VALUES ('version', %d)",
247940
+ pConfig->zDb, pConfig->zName, FTS5_CURRENT_VERSION_SECUREDELETE
247941
+ ));
247942
+ if( p->rc==SQLITE_OK ){
247943
+ int rc;
247944
+ sqlite3_step(pStmt);
247945
+ rc = sqlite3_finalize(pStmt);
247946
+ if( p->rc==SQLITE_OK ) p->rc = rc;
247947
+ pConfig->iCookie++;
247948
+ pConfig->iVersion = FTS5_CURRENT_VERSION_SECUREDELETE;
247949
+ }
247950
+ }
247909247951
247910247952
fts5MultiIterNew(p, pStruct, f, 0, (const u8*)zTerm, nTerm, -1, 0, &pIter);
247911247953
if( fts5MultiIterEof(p, pIter)==0 ){
247912247954
i64 iThis = fts5MultiIterRowid(pIter);
247913247955
if( iThis<iRowid ){
@@ -253745,11 +253787,10 @@
253745253787
){
253746253788
Fts5FullTable *pTab = (Fts5FullTable*)pVtab;
253747253789
Fts5Config *pConfig = pTab->p.pConfig;
253748253790
int eType0; /* value_type() of apVal[0] */
253749253791
int rc = SQLITE_OK; /* Return code */
253750
- int bUpdateOrDelete = 0;
253751253792
253752253793
/* A transaction must be open when this is called. */
253753253794
assert( pTab->ts.eState==1 || pTab->ts.eState==2 );
253754253795
253755253796
assert( pVtab->zErrMsg==0 );
@@ -253757,11 +253798,11 @@
253757253798
assert( sqlite3_value_type(apVal[0])==SQLITE_INTEGER
253758253799
|| sqlite3_value_type(apVal[0])==SQLITE_NULL
253759253800
);
253760253801
assert( pTab->p.pConfig->pzErrmsg==0 );
253761253802
if( pConfig->pgsz==0 ){
253762
- rc = sqlite3Fts5IndexLoadConfig(pTab->p.pIndex);
253803
+ rc = sqlite3Fts5ConfigLoad(pTab->p.pConfig, pTab->p.pConfig->iCookie);
253763253804
if( rc!=SQLITE_OK ) return rc;
253764253805
}
253765253806
253766253807
pTab->p.pConfig->pzErrmsg = &pTab->p.base.zErrMsg;
253767253808
@@ -253782,11 +253823,10 @@
253782253823
"'delete' may not be used with a contentless_delete=1 table"
253783253824
);
253784253825
rc = SQLITE_ERROR;
253785253826
}else{
253786253827
rc = fts5SpecialDelete(pTab, apVal);
253787
- bUpdateOrDelete = 1;
253788253828
}
253789253829
}else{
253790253830
rc = fts5SpecialInsert(pTab, z, apVal[2 + pConfig->nCol + 1]);
253791253831
}
253792253832
}else{
@@ -253819,11 +253859,10 @@
253819253859
);
253820253860
rc = SQLITE_ERROR;
253821253861
}else{
253822253862
i64 iDel = sqlite3_value_int64(apVal[0]); /* Rowid to delete */
253823253863
rc = sqlite3Fts5StorageDelete(pTab->pStorage, iDel, 0, 0);
253824
- bUpdateOrDelete = 1;
253825253864
}
253826253865
}
253827253866
253828253867
/* INSERT or UPDATE */
253829253868
else{
@@ -253847,11 +253886,10 @@
253847253886
/* An INSERT statement. If the conflict-mode is REPLACE, first remove
253848253887
** the current entry (if any). */
253849253888
if( eConflict==SQLITE_REPLACE && eType1==SQLITE_INTEGER ){
253850253889
i64 iNew = sqlite3_value_int64(apVal[1]); /* Rowid to delete */
253851253890
rc = sqlite3Fts5StorageDelete(pTab->pStorage, iNew, 0, 0);
253852
- bUpdateOrDelete = 1;
253853253891
}
253854253892
fts5StorageInsert(&rc, pTab, apVal, pRowid);
253855253893
}
253856253894
253857253895
/* UPDATE */
@@ -253901,27 +253939,12 @@
253901253939
}
253902253940
}else{
253903253941
rc = sqlite3Fts5StorageDelete(pStorage, iOld, 0, 1);
253904253942
fts5StorageInsert(&rc, pTab, apVal, pRowid);
253905253943
}
253906
- bUpdateOrDelete = 1;
253907253944
sqlite3Fts5StorageReleaseDeleteRow(pStorage);
253908253945
}
253909
-
253910
- }
253911
- }
253912
-
253913
- if( rc==SQLITE_OK
253914
- && bUpdateOrDelete
253915
- && pConfig->bSecureDelete
253916
- && pConfig->iVersion==FTS5_CURRENT_VERSION
253917
- ){
253918
- rc = sqlite3Fts5StorageConfigValue(
253919
- pTab->pStorage, "version", 0, FTS5_CURRENT_VERSION_SECUREDELETE
253920
- );
253921
- if( rc==SQLITE_OK ){
253922
- pConfig->iVersion = FTS5_CURRENT_VERSION_SECUREDELETE;
253923253946
}
253924253947
}
253925253948
253926253949
update_out:
253927253950
pTab->p.pConfig->pzErrmsg = 0;
@@ -253970,10 +253993,11 @@
253970253993
static int fts5RollbackMethod(sqlite3_vtab *pVtab){
253971253994
int rc;
253972253995
Fts5FullTable *pTab = (Fts5FullTable*)pVtab;
253973253996
fts5CheckTransactionState(pTab, FTS5_ROLLBACK, 0);
253974253997
rc = sqlite3Fts5StorageRollback(pTab->pStorage);
253998
+ pTab->p.pConfig->pgsz = 0;
253975253999
return rc;
253976254000
}
253977254001
253978254002
static int fts5CsrPoslist(Fts5Cursor*, int, const u8**, int*);
253979254003
@@ -255438,11 +255462,11 @@
255438255462
int nArg, /* Number of args */
255439255463
sqlite3_value **apUnused /* Function arguments */
255440255464
){
255441255465
assert( nArg==0 );
255442255466
UNUSED_PARAM2(nArg, apUnused);
255443
- sqlite3_result_text(pCtx, "fts5: 2024-12-30 21:23:53 2b17bc49655c577029919c2d409de994b0d252f8efb5da1ba0913f2c96bee552", -1, SQLITE_TRANSIENT);
255467
+ sqlite3_result_text(pCtx, "fts5: 2025-01-14 11:05:00 d2fe6b05f38d9d7cd78c5d252e99ac59f1aea071d669830c1ffe4e8966e84010", -1, SQLITE_TRANSIENT);
255444255468
}
255445255469
255446255470
/*
255447255471
** Implementation of fts5_locale(LOCALE, TEXT) function.
255448255472
**
@@ -255918,10 +255942,15 @@
255918255942
rc = sqlite3_prepare_v3(pC->db, zSql, -1, f, &p->aStmt[eStmt], 0);
255919255943
p->pConfig->bLock--;
255920255944
sqlite3_free(zSql);
255921255945
if( rc!=SQLITE_OK && pzErrMsg ){
255922255946
*pzErrMsg = sqlite3_mprintf("%s", sqlite3_errmsg(pC->db));
255947
+ }
255948
+ if( rc==SQLITE_ERROR && eStmt>FTS5_STMT_LOOKUP2 && eStmt<FTS5_STMT_SCAN ){
255949
+ /* One of the internal tables - not the %_content table - is missing.
255950
+ ** This counts as a corrupted table. */
255951
+ rc = SQLITE_CORRUPT;
255923255952
}
255924255953
}
255925255954
}
255926255955
255927255956
*ppStmt = p->aStmt[eStmt];
255928255957
--- 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 ** 2b17bc49655c577029919c2d409de994b0d2 with changes in files:
22 **
23 **
24 */
25 #ifndef SQLITE_AMALGAMATION
26 #define SQLITE_CORE 1
@@ -465,11 +465,11 @@
465 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
466 ** [sqlite_version()] and [sqlite_source_id()].
467 */
468 #define SQLITE_VERSION "3.48.0"
469 #define SQLITE_VERSION_NUMBER 3048000
470 #define SQLITE_SOURCE_ID "2024-12-30 21:23:53 2b17bc49655c577029919c2d409de994b0d252f8efb5da1ba0913f2c96bee552"
471
472 /*
473 ** CAPI3REF: Run-Time Library Version Numbers
474 ** KEYWORDS: sqlite3_version sqlite3_sourceid
475 **
@@ -33052,11 +33052,14 @@
33052 }
33053 if( pItem->fg.fromDDL ){
33054 sqlite3_str_appendf(&x, " DDL");
33055 }
33056 if( pItem->fg.isCte ){
33057 sqlite3_str_appendf(&x, " CteUse=0x%p", pItem->u2.pCteUse);
 
 
 
33058 }
33059 if( pItem->fg.isOn || (pItem->fg.isUsing==0 && pItem->u3.pOn!=0) ){
33060 sqlite3_str_appendf(&x, " isOn");
33061 }
33062 if( pItem->fg.isTabFunc ) sqlite3_str_appendf(&x, " isTabFunc");
@@ -33083,13 +33086,10 @@
33083 if( pItem->pSTab ){
33084 Table *pTab = pItem->pSTab;
33085 sqlite3TreeViewColumnList(pView, pTab->aCol, pTab->nCol, 1);
33086 }
33087 assert( (int)pItem->fg.isNestedFrom == IsNestedFrom(pItem) );
33088 sqlite3TreeViewPush(&pView, 0);
33089 sqlite3TreeViewLine(pView, "SUBQUERY");
33090 sqlite3TreeViewPop(&pView);
33091 sqlite3TreeViewSelect(pView, pItem->u4.pSubq->pSelect, 0);
33092 }
33093 if( pItem->fg.isTabFunc ){
33094 sqlite3TreeViewExprList(pView, pItem->u1.pFuncArg, 0, "func-args:");
33095 }
@@ -112713,10 +112713,11 @@
112713 if( mCol & colUsed ) break; /* Each column used only once */
112714 colUsed |= mCol;
112715 if( aiMap ) aiMap[i] = j;
112716 }
112717
 
112718 assert( i==nExpr || colUsed!=(MASKBIT(nExpr)-1) );
112719 if( colUsed==(MASKBIT(nExpr)-1) ){
112720 /* If we reach this point, that means the index pIdx is usable */
112721 int iAddr = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
112722 ExplainQueryPlan((pParse, 0,
@@ -164142,10 +164143,15 @@
164142 **
164143 ** 2. If iCol is part of an existing index that has an aiRowLogEst of
164144 ** more than 20, then return false.
164145 **
164146 ** 3. If no disqualifying conditions above are found, return true.
 
 
 
 
 
164147 */
164148 static SQLITE_NOINLINE int columnIsGoodIndexCandidate(
164149 const Table *pTab,
164150 int iCol
164151 ){
@@ -226243,10 +226249,28 @@
226243 static int dbpageRowid(sqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){
226244 DbpageCursor *pCsr = (DbpageCursor *)pCursor;
226245 *pRowid = pCsr->pgno;
226246 return SQLITE_OK;
226247 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226248
226249 static int dbpageUpdate(
226250 sqlite3_vtab *pVtab,
226251 int argc,
226252 sqlite3_value **argv,
@@ -226311,10 +226335,16 @@
226311 }else{
226312 zErr = "bad page value";
226313 goto update_fail;
226314 }
226315 }
 
 
 
 
 
 
226316 pPager = sqlite3BtreePager(pBt);
226317 rc = sqlite3PagerGet(pPager, pgno, (DbPage**)&pDbPage, 0);
226318 if( rc==SQLITE_OK ){
226319 const void *pData = sqlite3_value_blob(argv[3]);
226320 if( (rc = sqlite3PagerWrite(pDbPage))==SQLITE_OK && pData ){
@@ -226332,22 +226362,12 @@
226332 sqlite3_free(pVtab->zErrMsg);
226333 pVtab->zErrMsg = sqlite3_mprintf("%s", zErr);
226334 return SQLITE_ERROR;
226335 }
226336
226337 /* Since we do not know in advance which database files will be
226338 ** written by the sqlite_dbpage virtual table, start a write transaction
226339 ** on them all.
226340 */
226341 static int dbpageBegin(sqlite3_vtab *pVtab){
226342 DbpageTable *pTab = (DbpageTable *)pVtab;
226343 sqlite3 *db = pTab->db;
226344 int i;
226345 for(i=0; i<db->nDb; i++){
226346 Btree *pBt = db->aDb[i].pBt;
226347 if( pBt ) (void)sqlite3BtreeBeginTrans(pBt, 1, 0);
226348 }
226349 pTab->pgnoTrunc = 0;
226350 return SQLITE_OK;
226351 }
226352
226353 /* Invoke sqlite3PagerTruncate() as necessary, just prior to COMMIT
@@ -226379,11 +226399,11 @@
226379 /*
226380 ** Invoke this routine to register the "dbpage" virtual table module
226381 */
226382 SQLITE_PRIVATE int sqlite3DbpageRegister(sqlite3 *db){
226383 static sqlite3_module dbpage_module = {
226384 0, /* iVersion */
226385 dbpageConnect, /* xCreate */
226386 dbpageConnect, /* xConnect */
226387 dbpageBestIndex, /* xBestIndex */
226388 dbpageDisconnect, /* xDisconnect */
226389 dbpageDisconnect, /* xDestroy */
@@ -231698,16 +231718,16 @@
231698 if( res!=SQLITE_CHANGESET_OMIT ){
231699 rc = SQLITE_CONSTRAINT;
231700 }
231701 }
231702 }
231703 sqlite3_exec(db, "PRAGMA defer_foreign_keys = 0", 0, 0, 0);
231704
231705 if( (flags & SQLITE_CHANGESETAPPLY_NOSAVEPOINT)==0 ){
231706 if( rc==SQLITE_OK ){
231707 rc = sqlite3_exec(db, "RELEASE changeset_apply", 0, 0, 0);
231708 }else{
 
231709 sqlite3_exec(db, "ROLLBACK TO changeset_apply", 0, 0, 0);
231710 sqlite3_exec(db, "RELEASE changeset_apply", 0, 0, 0);
231711 }
231712 }
231713
@@ -243323,13 +243343,17 @@
243323 sqlite3_stmt **ppStmt,
243324 char *zSql
243325 ){
243326 if( p->rc==SQLITE_OK ){
243327 if( zSql ){
243328 p->rc = sqlite3_prepare_v3(p->pConfig->db, zSql, -1,
243329 SQLITE_PREPARE_PERSISTENT|SQLITE_PREPARE_NO_VTAB,
243330 ppStmt, 0);
 
 
 
 
243331 }else{
243332 p->rc = SQLITE_NOMEM;
243333 }
243334 }
243335 sqlite3_free(zSql);
@@ -247904,10 +247928,28 @@
247904 int nTerm,
247905 i64 iRowid
247906 ){
247907 const int f = FTS5INDEX_QUERY_SKIPHASH;
247908 Fts5Iter *pIter = 0; /* Used to find term instance */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
247909
247910 fts5MultiIterNew(p, pStruct, f, 0, (const u8*)zTerm, nTerm, -1, 0, &pIter);
247911 if( fts5MultiIterEof(p, pIter)==0 ){
247912 i64 iThis = fts5MultiIterRowid(pIter);
247913 if( iThis<iRowid ){
@@ -253745,11 +253787,10 @@
253745 ){
253746 Fts5FullTable *pTab = (Fts5FullTable*)pVtab;
253747 Fts5Config *pConfig = pTab->p.pConfig;
253748 int eType0; /* value_type() of apVal[0] */
253749 int rc = SQLITE_OK; /* Return code */
253750 int bUpdateOrDelete = 0;
253751
253752 /* A transaction must be open when this is called. */
253753 assert( pTab->ts.eState==1 || pTab->ts.eState==2 );
253754
253755 assert( pVtab->zErrMsg==0 );
@@ -253757,11 +253798,11 @@
253757 assert( sqlite3_value_type(apVal[0])==SQLITE_INTEGER
253758 || sqlite3_value_type(apVal[0])==SQLITE_NULL
253759 );
253760 assert( pTab->p.pConfig->pzErrmsg==0 );
253761 if( pConfig->pgsz==0 ){
253762 rc = sqlite3Fts5IndexLoadConfig(pTab->p.pIndex);
253763 if( rc!=SQLITE_OK ) return rc;
253764 }
253765
253766 pTab->p.pConfig->pzErrmsg = &pTab->p.base.zErrMsg;
253767
@@ -253782,11 +253823,10 @@
253782 "'delete' may not be used with a contentless_delete=1 table"
253783 );
253784 rc = SQLITE_ERROR;
253785 }else{
253786 rc = fts5SpecialDelete(pTab, apVal);
253787 bUpdateOrDelete = 1;
253788 }
253789 }else{
253790 rc = fts5SpecialInsert(pTab, z, apVal[2 + pConfig->nCol + 1]);
253791 }
253792 }else{
@@ -253819,11 +253859,10 @@
253819 );
253820 rc = SQLITE_ERROR;
253821 }else{
253822 i64 iDel = sqlite3_value_int64(apVal[0]); /* Rowid to delete */
253823 rc = sqlite3Fts5StorageDelete(pTab->pStorage, iDel, 0, 0);
253824 bUpdateOrDelete = 1;
253825 }
253826 }
253827
253828 /* INSERT or UPDATE */
253829 else{
@@ -253847,11 +253886,10 @@
253847 /* An INSERT statement. If the conflict-mode is REPLACE, first remove
253848 ** the current entry (if any). */
253849 if( eConflict==SQLITE_REPLACE && eType1==SQLITE_INTEGER ){
253850 i64 iNew = sqlite3_value_int64(apVal[1]); /* Rowid to delete */
253851 rc = sqlite3Fts5StorageDelete(pTab->pStorage, iNew, 0, 0);
253852 bUpdateOrDelete = 1;
253853 }
253854 fts5StorageInsert(&rc, pTab, apVal, pRowid);
253855 }
253856
253857 /* UPDATE */
@@ -253901,27 +253939,12 @@
253901 }
253902 }else{
253903 rc = sqlite3Fts5StorageDelete(pStorage, iOld, 0, 1);
253904 fts5StorageInsert(&rc, pTab, apVal, pRowid);
253905 }
253906 bUpdateOrDelete = 1;
253907 sqlite3Fts5StorageReleaseDeleteRow(pStorage);
253908 }
253909
253910 }
253911 }
253912
253913 if( rc==SQLITE_OK
253914 && bUpdateOrDelete
253915 && pConfig->bSecureDelete
253916 && pConfig->iVersion==FTS5_CURRENT_VERSION
253917 ){
253918 rc = sqlite3Fts5StorageConfigValue(
253919 pTab->pStorage, "version", 0, FTS5_CURRENT_VERSION_SECUREDELETE
253920 );
253921 if( rc==SQLITE_OK ){
253922 pConfig->iVersion = FTS5_CURRENT_VERSION_SECUREDELETE;
253923 }
253924 }
253925
253926 update_out:
253927 pTab->p.pConfig->pzErrmsg = 0;
@@ -253970,10 +253993,11 @@
253970 static int fts5RollbackMethod(sqlite3_vtab *pVtab){
253971 int rc;
253972 Fts5FullTable *pTab = (Fts5FullTable*)pVtab;
253973 fts5CheckTransactionState(pTab, FTS5_ROLLBACK, 0);
253974 rc = sqlite3Fts5StorageRollback(pTab->pStorage);
 
253975 return rc;
253976 }
253977
253978 static int fts5CsrPoslist(Fts5Cursor*, int, const u8**, int*);
253979
@@ -255438,11 +255462,11 @@
255438 int nArg, /* Number of args */
255439 sqlite3_value **apUnused /* Function arguments */
255440 ){
255441 assert( nArg==0 );
255442 UNUSED_PARAM2(nArg, apUnused);
255443 sqlite3_result_text(pCtx, "fts5: 2024-12-30 21:23:53 2b17bc49655c577029919c2d409de994b0d252f8efb5da1ba0913f2c96bee552", -1, SQLITE_TRANSIENT);
255444 }
255445
255446 /*
255447 ** Implementation of fts5_locale(LOCALE, TEXT) function.
255448 **
@@ -255918,10 +255942,15 @@
255918 rc = sqlite3_prepare_v3(pC->db, zSql, -1, f, &p->aStmt[eStmt], 0);
255919 p->pConfig->bLock--;
255920 sqlite3_free(zSql);
255921 if( rc!=SQLITE_OK && pzErrMsg ){
255922 *pzErrMsg = sqlite3_mprintf("%s", sqlite3_errmsg(pC->db));
 
 
 
 
 
255923 }
255924 }
255925 }
255926
255927 *ppStmt = p->aStmt[eStmt];
255928
--- 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 ** d2fe6b05f38d9d7cd78c5d252e99ac59f1ae with changes in files:
22 **
23 **
24 */
25 #ifndef SQLITE_AMALGAMATION
26 #define SQLITE_CORE 1
@@ -465,11 +465,11 @@
465 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
466 ** [sqlite_version()] and [sqlite_source_id()].
467 */
468 #define SQLITE_VERSION "3.48.0"
469 #define SQLITE_VERSION_NUMBER 3048000
470 #define SQLITE_SOURCE_ID "2025-01-14 11:05:00 d2fe6b05f38d9d7cd78c5d252e99ac59f1aea071d669830c1ffe4e8966e84010"
471
472 /*
473 ** CAPI3REF: Run-Time Library Version Numbers
474 ** KEYWORDS: sqlite3_version sqlite3_sourceid
475 **
@@ -33052,11 +33052,14 @@
33052 }
33053 if( pItem->fg.fromDDL ){
33054 sqlite3_str_appendf(&x, " DDL");
33055 }
33056 if( pItem->fg.isCte ){
33057 static const char *aMat[] = {",MAT", "", ",NO-MAT"};
33058 sqlite3_str_appendf(&x, " CteUse=%d%s",
33059 pItem->u2.pCteUse->nUse,
33060 aMat[pItem->u2.pCteUse->eM10d]);
33061 }
33062 if( pItem->fg.isOn || (pItem->fg.isUsing==0 && pItem->u3.pOn!=0) ){
33063 sqlite3_str_appendf(&x, " isOn");
33064 }
33065 if( pItem->fg.isTabFunc ) sqlite3_str_appendf(&x, " isTabFunc");
@@ -33083,13 +33086,10 @@
33086 if( pItem->pSTab ){
33087 Table *pTab = pItem->pSTab;
33088 sqlite3TreeViewColumnList(pView, pTab->aCol, pTab->nCol, 1);
33089 }
33090 assert( (int)pItem->fg.isNestedFrom == IsNestedFrom(pItem) );
 
 
 
33091 sqlite3TreeViewSelect(pView, pItem->u4.pSubq->pSelect, 0);
33092 }
33093 if( pItem->fg.isTabFunc ){
33094 sqlite3TreeViewExprList(pView, pItem->u1.pFuncArg, 0, "func-args:");
33095 }
@@ -112713,10 +112713,11 @@
112713 if( mCol & colUsed ) break; /* Each column used only once */
112714 colUsed |= mCol;
112715 if( aiMap ) aiMap[i] = j;
112716 }
112717
112718 assert( nExpr>0 && nExpr<BMS );
112719 assert( i==nExpr || colUsed!=(MASKBIT(nExpr)-1) );
112720 if( colUsed==(MASKBIT(nExpr)-1) ){
112721 /* If we reach this point, that means the index pIdx is usable */
112722 int iAddr = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
112723 ExplainQueryPlan((pParse, 0,
@@ -164142,10 +164143,15 @@
164143 **
164144 ** 2. If iCol is part of an existing index that has an aiRowLogEst of
164145 ** more than 20, then return false.
164146 **
164147 ** 3. If no disqualifying conditions above are found, return true.
164148 **
164149 ** 2025-01-03: I experimented with a new rule that returns false if the
164150 ** the datatype of the column is "BOOLEAN". This did not improve
164151 ** performance on any queries at hand, but it did burn CPU cycles, so the
164152 ** idea was not committed.
164153 */
164154 static SQLITE_NOINLINE int columnIsGoodIndexCandidate(
164155 const Table *pTab,
164156 int iCol
164157 ){
@@ -226243,10 +226249,28 @@
226249 static int dbpageRowid(sqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){
226250 DbpageCursor *pCsr = (DbpageCursor *)pCursor;
226251 *pRowid = pCsr->pgno;
226252 return SQLITE_OK;
226253 }
226254
226255 /*
226256 ** Open write transactions. Since we do not know in advance which database
226257 ** files will be written by the sqlite_dbpage virtual table, start a write
226258 ** transaction on them all.
226259 **
226260 ** Return SQLITE_OK if successful, or an SQLite error code otherwise.
226261 */
226262 static int dbpageBeginTrans(DbpageTable *pTab){
226263 sqlite3 *db = pTab->db;
226264 int rc = SQLITE_OK;
226265 int i;
226266 for(i=0; rc==SQLITE_OK && i<db->nDb; i++){
226267 Btree *pBt = db->aDb[i].pBt;
226268 if( pBt ) rc = sqlite3BtreeBeginTrans(pBt, 1, 0);
226269 }
226270 return rc;
226271 }
226272
226273 static int dbpageUpdate(
226274 sqlite3_vtab *pVtab,
226275 int argc,
226276 sqlite3_value **argv,
@@ -226311,10 +226335,16 @@
226335 }else{
226336 zErr = "bad page value";
226337 goto update_fail;
226338 }
226339 }
226340
226341 if( dbpageBeginTrans(pTab)!=SQLITE_OK ){
226342 zErr = "failed to open transaction";
226343 goto update_fail;
226344 }
226345
226346 pPager = sqlite3BtreePager(pBt);
226347 rc = sqlite3PagerGet(pPager, pgno, (DbPage**)&pDbPage, 0);
226348 if( rc==SQLITE_OK ){
226349 const void *pData = sqlite3_value_blob(argv[3]);
226350 if( (rc = sqlite3PagerWrite(pDbPage))==SQLITE_OK && pData ){
@@ -226332,22 +226362,12 @@
226362 sqlite3_free(pVtab->zErrMsg);
226363 pVtab->zErrMsg = sqlite3_mprintf("%s", zErr);
226364 return SQLITE_ERROR;
226365 }
226366
 
 
 
 
226367 static int dbpageBegin(sqlite3_vtab *pVtab){
226368 DbpageTable *pTab = (DbpageTable *)pVtab;
 
 
 
 
 
 
226369 pTab->pgnoTrunc = 0;
226370 return SQLITE_OK;
226371 }
226372
226373 /* Invoke sqlite3PagerTruncate() as necessary, just prior to COMMIT
@@ -226379,11 +226399,11 @@
226399 /*
226400 ** Invoke this routine to register the "dbpage" virtual table module
226401 */
226402 SQLITE_PRIVATE int sqlite3DbpageRegister(sqlite3 *db){
226403 static sqlite3_module dbpage_module = {
226404 2, /* iVersion */
226405 dbpageConnect, /* xCreate */
226406 dbpageConnect, /* xConnect */
226407 dbpageBestIndex, /* xBestIndex */
226408 dbpageDisconnect, /* xDisconnect */
226409 dbpageDisconnect, /* xDestroy */
@@ -231698,16 +231718,16 @@
231718 if( res!=SQLITE_CHANGESET_OMIT ){
231719 rc = SQLITE_CONSTRAINT;
231720 }
231721 }
231722 }
 
231723
231724 if( (flags & SQLITE_CHANGESETAPPLY_NOSAVEPOINT)==0 ){
231725 if( rc==SQLITE_OK ){
231726 rc = sqlite3_exec(db, "RELEASE changeset_apply", 0, 0, 0);
231727 }
231728 if( rc!=SQLITE_OK ){
231729 sqlite3_exec(db, "ROLLBACK TO changeset_apply", 0, 0, 0);
231730 sqlite3_exec(db, "RELEASE changeset_apply", 0, 0, 0);
231731 }
231732 }
231733
@@ -243323,13 +243343,17 @@
243343 sqlite3_stmt **ppStmt,
243344 char *zSql
243345 ){
243346 if( p->rc==SQLITE_OK ){
243347 if( zSql ){
243348 int rc = sqlite3_prepare_v3(p->pConfig->db, zSql, -1,
243349 SQLITE_PREPARE_PERSISTENT|SQLITE_PREPARE_NO_VTAB,
243350 ppStmt, 0);
243351 /* If this prepare() call fails with SQLITE_ERROR, then one of the
243352 ** %_idx or %_data tables has been removed or modified. Call this
243353 ** corruption. */
243354 p->rc = (rc==SQLITE_ERROR ? SQLITE_CORRUPT : rc);
243355 }else{
243356 p->rc = SQLITE_NOMEM;
243357 }
243358 }
243359 sqlite3_free(zSql);
@@ -247904,10 +247928,28 @@
247928 int nTerm,
247929 i64 iRowid
247930 ){
247931 const int f = FTS5INDEX_QUERY_SKIPHASH;
247932 Fts5Iter *pIter = 0; /* Used to find term instance */
247933
247934 /* If the version number has not been set to SECUREDELETE, do so now. */
247935 if( p->pConfig->iVersion!=FTS5_CURRENT_VERSION_SECUREDELETE ){
247936 Fts5Config *pConfig = p->pConfig;
247937 sqlite3_stmt *pStmt = 0;
247938 fts5IndexPrepareStmt(p, &pStmt, sqlite3_mprintf(
247939 "REPLACE INTO %Q.'%q_config' VALUES ('version', %d)",
247940 pConfig->zDb, pConfig->zName, FTS5_CURRENT_VERSION_SECUREDELETE
247941 ));
247942 if( p->rc==SQLITE_OK ){
247943 int rc;
247944 sqlite3_step(pStmt);
247945 rc = sqlite3_finalize(pStmt);
247946 if( p->rc==SQLITE_OK ) p->rc = rc;
247947 pConfig->iCookie++;
247948 pConfig->iVersion = FTS5_CURRENT_VERSION_SECUREDELETE;
247949 }
247950 }
247951
247952 fts5MultiIterNew(p, pStruct, f, 0, (const u8*)zTerm, nTerm, -1, 0, &pIter);
247953 if( fts5MultiIterEof(p, pIter)==0 ){
247954 i64 iThis = fts5MultiIterRowid(pIter);
247955 if( iThis<iRowid ){
@@ -253745,11 +253787,10 @@
253787 ){
253788 Fts5FullTable *pTab = (Fts5FullTable*)pVtab;
253789 Fts5Config *pConfig = pTab->p.pConfig;
253790 int eType0; /* value_type() of apVal[0] */
253791 int rc = SQLITE_OK; /* Return code */
 
253792
253793 /* A transaction must be open when this is called. */
253794 assert( pTab->ts.eState==1 || pTab->ts.eState==2 );
253795
253796 assert( pVtab->zErrMsg==0 );
@@ -253757,11 +253798,11 @@
253798 assert( sqlite3_value_type(apVal[0])==SQLITE_INTEGER
253799 || sqlite3_value_type(apVal[0])==SQLITE_NULL
253800 );
253801 assert( pTab->p.pConfig->pzErrmsg==0 );
253802 if( pConfig->pgsz==0 ){
253803 rc = sqlite3Fts5ConfigLoad(pTab->p.pConfig, pTab->p.pConfig->iCookie);
253804 if( rc!=SQLITE_OK ) return rc;
253805 }
253806
253807 pTab->p.pConfig->pzErrmsg = &pTab->p.base.zErrMsg;
253808
@@ -253782,11 +253823,10 @@
253823 "'delete' may not be used with a contentless_delete=1 table"
253824 );
253825 rc = SQLITE_ERROR;
253826 }else{
253827 rc = fts5SpecialDelete(pTab, apVal);
 
253828 }
253829 }else{
253830 rc = fts5SpecialInsert(pTab, z, apVal[2 + pConfig->nCol + 1]);
253831 }
253832 }else{
@@ -253819,11 +253859,10 @@
253859 );
253860 rc = SQLITE_ERROR;
253861 }else{
253862 i64 iDel = sqlite3_value_int64(apVal[0]); /* Rowid to delete */
253863 rc = sqlite3Fts5StorageDelete(pTab->pStorage, iDel, 0, 0);
 
253864 }
253865 }
253866
253867 /* INSERT or UPDATE */
253868 else{
@@ -253847,11 +253886,10 @@
253886 /* An INSERT statement. If the conflict-mode is REPLACE, first remove
253887 ** the current entry (if any). */
253888 if( eConflict==SQLITE_REPLACE && eType1==SQLITE_INTEGER ){
253889 i64 iNew = sqlite3_value_int64(apVal[1]); /* Rowid to delete */
253890 rc = sqlite3Fts5StorageDelete(pTab->pStorage, iNew, 0, 0);
 
253891 }
253892 fts5StorageInsert(&rc, pTab, apVal, pRowid);
253893 }
253894
253895 /* UPDATE */
@@ -253901,27 +253939,12 @@
253939 }
253940 }else{
253941 rc = sqlite3Fts5StorageDelete(pStorage, iOld, 0, 1);
253942 fts5StorageInsert(&rc, pTab, apVal, pRowid);
253943 }
 
253944 sqlite3Fts5StorageReleaseDeleteRow(pStorage);
253945 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
253946 }
253947 }
253948
253949 update_out:
253950 pTab->p.pConfig->pzErrmsg = 0;
@@ -253970,10 +253993,11 @@
253993 static int fts5RollbackMethod(sqlite3_vtab *pVtab){
253994 int rc;
253995 Fts5FullTable *pTab = (Fts5FullTable*)pVtab;
253996 fts5CheckTransactionState(pTab, FTS5_ROLLBACK, 0);
253997 rc = sqlite3Fts5StorageRollback(pTab->pStorage);
253998 pTab->p.pConfig->pgsz = 0;
253999 return rc;
254000 }
254001
254002 static int fts5CsrPoslist(Fts5Cursor*, int, const u8**, int*);
254003
@@ -255438,11 +255462,11 @@
255462 int nArg, /* Number of args */
255463 sqlite3_value **apUnused /* Function arguments */
255464 ){
255465 assert( nArg==0 );
255466 UNUSED_PARAM2(nArg, apUnused);
255467 sqlite3_result_text(pCtx, "fts5: 2025-01-14 11:05:00 d2fe6b05f38d9d7cd78c5d252e99ac59f1aea071d669830c1ffe4e8966e84010", -1, SQLITE_TRANSIENT);
255468 }
255469
255470 /*
255471 ** Implementation of fts5_locale(LOCALE, TEXT) function.
255472 **
@@ -255918,10 +255942,15 @@
255942 rc = sqlite3_prepare_v3(pC->db, zSql, -1, f, &p->aStmt[eStmt], 0);
255943 p->pConfig->bLock--;
255944 sqlite3_free(zSql);
255945 if( rc!=SQLITE_OK && pzErrMsg ){
255946 *pzErrMsg = sqlite3_mprintf("%s", sqlite3_errmsg(pC->db));
255947 }
255948 if( rc==SQLITE_ERROR && eStmt>FTS5_STMT_LOOKUP2 && eStmt<FTS5_STMT_SCAN ){
255949 /* One of the internal tables - not the %_content table - is missing.
255950 ** This counts as a corrupted table. */
255951 rc = SQLITE_CORRUPT;
255952 }
255953 }
255954 }
255955
255956 *ppStmt = p->aStmt[eStmt];
255957
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,11 +146,11 @@
146146
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147147
** [sqlite_version()] and [sqlite_source_id()].
148148
*/
149149
#define SQLITE_VERSION "3.48.0"
150150
#define SQLITE_VERSION_NUMBER 3048000
151
-#define SQLITE_SOURCE_ID "2024-12-30 21:23:53 2b17bc49655c577029919c2d409de994b0d252f8efb5da1ba0913f2c96bee552"
151
+#define SQLITE_SOURCE_ID "2025-01-14 11:05:00 d2fe6b05f38d9d7cd78c5d252e99ac59f1aea071d669830c1ffe4e8966e84010"
152152
153153
/*
154154
** CAPI3REF: Run-Time Library Version Numbers
155155
** KEYWORDS: sqlite3_version sqlite3_sourceid
156156
**
157157
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,11 +146,11 @@
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.48.0"
150 #define SQLITE_VERSION_NUMBER 3048000
151 #define SQLITE_SOURCE_ID "2024-12-30 21:23:53 2b17bc49655c577029919c2d409de994b0d252f8efb5da1ba0913f2c96bee552"
152
153 /*
154 ** CAPI3REF: Run-Time Library Version Numbers
155 ** KEYWORDS: sqlite3_version sqlite3_sourceid
156 **
157
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,11 +146,11 @@
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.48.0"
150 #define SQLITE_VERSION_NUMBER 3048000
151 #define SQLITE_SOURCE_ID "2025-01-14 11:05:00 d2fe6b05f38d9d7cd78c5d252e99ac59f1aea071d669830c1ffe4e8966e84010"
152
153 /*
154 ** CAPI3REF: Run-Time Library Version Numbers
155 ** KEYWORDS: sqlite3_version sqlite3_sourceid
156 **
157

Keyboard Shortcuts

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