Fossil SCM

Update the built-in SQLite to the latest trunk version for testing.

drh 2024-09-21 15:59 trunk
Commit 5de7ce9a0673c9972169a24e33f8fc65ae88f61c33d2561e260b4d688fc9f0b8
+2 -2
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -8534,11 +8534,11 @@
85348534
** If the optional MTIME argument is present, then it is interpreted
85358535
** as an integer - the number of seconds since the unix epoch. The
85368536
** modification-time of the target file is set to this value before
85378537
** returning.
85388538
**
8539
-** If three or more arguments are passed to this function and an
8539
+** If five or more arguments are passed to this function and an
85408540
** error is encountered, an exception is raised.
85418541
**
85428542
** READFILE(FILE):
85438543
**
85448544
** Read and return the contents of file FILE (type blob) from disk.
@@ -17049,11 +17049,11 @@
1704917049
*/
1705017050
static const char *lockName(int eLock){
1705117051
const char *azLockNames[] = {
1705217052
"NONE", "SHARED", "RESERVED", "PENDING", "EXCLUSIVE"
1705317053
};
17054
- if( eLock<0 || eLock>=sizeof(azLockNames)/sizeof(azLockNames[0]) ){
17054
+ if( eLock<0 || eLock>=(int)(sizeof(azLockNames)/sizeof(azLockNames[0])) ){
1705517055
return "???";
1705617056
}else{
1705717057
return azLockNames[eLock];
1705817058
}
1705917059
}
1706017060
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -8534,11 +8534,11 @@
8534 ** If the optional MTIME argument is present, then it is interpreted
8535 ** as an integer - the number of seconds since the unix epoch. The
8536 ** modification-time of the target file is set to this value before
8537 ** returning.
8538 **
8539 ** If three or more arguments are passed to this function and an
8540 ** error is encountered, an exception is raised.
8541 **
8542 ** READFILE(FILE):
8543 **
8544 ** Read and return the contents of file FILE (type blob) from disk.
@@ -17049,11 +17049,11 @@
17049 */
17050 static const char *lockName(int eLock){
17051 const char *azLockNames[] = {
17052 "NONE", "SHARED", "RESERVED", "PENDING", "EXCLUSIVE"
17053 };
17054 if( eLock<0 || eLock>=sizeof(azLockNames)/sizeof(azLockNames[0]) ){
17055 return "???";
17056 }else{
17057 return azLockNames[eLock];
17058 }
17059 }
17060
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -8534,11 +8534,11 @@
8534 ** If the optional MTIME argument is present, then it is interpreted
8535 ** as an integer - the number of seconds since the unix epoch. The
8536 ** modification-time of the target file is set to this value before
8537 ** returning.
8538 **
8539 ** If five or more arguments are passed to this function and an
8540 ** error is encountered, an exception is raised.
8541 **
8542 ** READFILE(FILE):
8543 **
8544 ** Read and return the contents of file FILE (type blob) from disk.
@@ -17049,11 +17049,11 @@
17049 */
17050 static const char *lockName(int eLock){
17051 const char *azLockNames[] = {
17052 "NONE", "SHARED", "RESERVED", "PENDING", "EXCLUSIVE"
17053 };
17054 if( eLock<0 || eLock>=(int)(sizeof(azLockNames)/sizeof(azLockNames[0])) ){
17055 return "???";
17056 }else{
17057 return azLockNames[eLock];
17058 }
17059 }
17060
+80 -20
--- 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
-** a63e412b6b2939422ecfa99d91fccb7a9c61.
21
+** 62e11a3a78edf9853b74d6495ccd8ae9ac19.
2222
*/
2323
#define SQLITE_CORE 1
2424
#define SQLITE_AMALGAMATION 1
2525
#ifndef SQLITE_PRIVATE
2626
# define SQLITE_PRIVATE static
@@ -462,11 +462,11 @@
462462
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
463463
** [sqlite_version()] and [sqlite_source_id()].
464464
*/
465465
#define SQLITE_VERSION "3.47.0"
466466
#define SQLITE_VERSION_NUMBER 3047000
467
-#define SQLITE_SOURCE_ID "2024-09-17 22:57:08 a63e412b6b2939422ecfa99d91fccb7a9c61e1533bb0db20ff12f3815ef41a2c"
467
+#define SQLITE_SOURCE_ID "2024-09-21 15:57:06 62e11a3a78edf9853b74d6495ccd8ae9ac1966c7d78eb3682cf2d5885e3740ec"
468468
469469
/*
470470
** CAPI3REF: Run-Time Library Version Numbers
471471
** KEYWORDS: sqlite3_version sqlite3_sourceid
472472
**
@@ -21381,11 +21381,11 @@
2138121381
SQLITE_PRIVATE int sqlite3AtoF(const char *z, double*, int, u8);
2138221382
SQLITE_PRIVATE int sqlite3GetInt32(const char *, int*);
2138321383
SQLITE_PRIVATE int sqlite3GetUInt32(const char*, u32*);
2138421384
SQLITE_PRIVATE int sqlite3Atoi(const char*);
2138521385
#ifndef SQLITE_OMIT_UTF16
21386
-SQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *pData, int nChar);
21386
+SQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *pData, int nByte, int nChar);
2138721387
#endif
2138821388
SQLITE_PRIVATE int sqlite3Utf8CharLen(const char *pData, int nByte);
2138921389
SQLITE_PRIVATE u32 sqlite3Utf8Read(const u8**);
2139021390
SQLITE_PRIVATE int sqlite3Utf8ReadLimited(const u8*, int, u32*);
2139121391
SQLITE_PRIVATE LogEst sqlite3LogEst(u64);
@@ -23840,10 +23840,11 @@
2384023840
i64 iKey1; /* First key value passed to hook */
2384123841
i64 iKey2; /* Second key value passed to hook */
2384223842
Mem *aNew; /* Array of new.* values */
2384323843
Table *pTab; /* Schema object being updated */
2384423844
Index *pPk; /* PK index if pTab is WITHOUT ROWID */
23845
+ sqlite3_value **apDflt; /* Array of default values, if required */
2384523846
};
2384623847
2384723848
/*
2384823849
** An instance of this object is used to pass an vector of values into
2384923850
** OP_VFilter, the xFilter method of a virtual table. The vector is the
@@ -35078,24 +35079,26 @@
3507835079
assert( m.z || db->mallocFailed );
3507935080
return m.z;
3508035081
}
3508135082
3508235083
/*
35083
-** zIn is a UTF-16 encoded unicode string at least nChar characters long.
35084
+** zIn is a UTF-16 encoded unicode string at least nByte bytes long.
3508435085
** Return the number of bytes in the first nChar unicode characters
35085
-** in pZ. nChar must be non-negative.
35086
+** in pZ. nChar must be non-negative. Surrogate pairs count as a single
35087
+** character.
3508635088
*/
35087
-SQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *zIn, int nChar){
35089
+SQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *zIn, int nByte, int nChar){
3508835090
int c;
3508935091
unsigned char const *z = zIn;
35092
+ unsigned char const *zEnd = &z[nByte-1];
3509035093
int n = 0;
3509135094
3509235095
if( SQLITE_UTF16NATIVE==SQLITE_UTF16LE ) z++;
35093
- while( n<nChar ){
35096
+ while( n<nChar && ALWAYS(z<=zEnd) ){
3509435097
c = z[0];
3509535098
z += 2;
35096
- if( c>=0xd8 && c<0xdc && z[0]>=0xdc && z[0]<0xe0 ) z += 2;
35099
+ if( c>=0xd8 && c<0xdc && z<=zEnd && z[0]>=0xdc && z[0]<0xe0 ) z += 2;
3509735100
n++;
3509835101
}
3509935102
return (int)(z-(unsigned char const *)zIn)
3510035103
- (SQLITE_UTF16NATIVE==SQLITE_UTF16LE);
3510135104
}
@@ -84551,11 +84554,12 @@
8455184554
if( apVal==0 ){
8455284555
rc = SQLITE_NOMEM_BKPT;
8455384556
goto value_from_function_out;
8455484557
}
8455584558
for(i=0; i<nVal; i++){
84556
- rc = sqlite3ValueFromExpr(db, pList->a[i].pExpr, enc, aff, &apVal[i]);
84559
+ rc = sqlite3Stat4ValueFromExpr(pCtx->pParse, pList->a[i].pExpr, aff,
84560
+ &apVal[i]);
8455784561
if( apVal[i]==0 || rc!=SQLITE_OK ) goto value_from_function_out;
8455884562
}
8455984563
}
8456084564
8456184565
pVal = valueNew(db, pCtx);
@@ -90615,10 +90619,17 @@
9061590619
for(i=0; i<pCsr->nField; i++){
9061690620
sqlite3VdbeMemRelease(&preupdate.aNew[i]);
9061790621
}
9061890622
sqlite3DbNNFreeNN(db, preupdate.aNew);
9061990623
}
90624
+ if( preupdate.apDflt ){
90625
+ int i;
90626
+ for(i=0; i<pTab->nCol; i++){
90627
+ sqlite3ValueFree(preupdate.apDflt[i]);
90628
+ }
90629
+ sqlite3DbFree(db, preupdate.apDflt);
90630
+ }
9062090631
}
9062190632
#endif /* SQLITE_ENABLE_PREUPDATE_HOOK */
9062290633
9062390634
/************** End of vdbeaux.c *********************************************/
9062490635
/************** Begin file vdbeapi.c *****************************************/
@@ -92844,11 +92855,34 @@
9284492855
9284592856
pMem = *ppValue = &p->pUnpacked->aMem[iIdx];
9284692857
if( iIdx==p->pTab->iPKey ){
9284792858
sqlite3VdbeMemSetInt64(pMem, p->iKey1);
9284892859
}else if( iIdx>=p->pUnpacked->nField ){
92849
- *ppValue = (sqlite3_value *)columnNullValue();
92860
+ /* This occurs when the table has been extended using ALTER TABLE
92861
+ ** ADD COLUMN. The value to return is the default value of the column. */
92862
+ Column *pCol = &p->pTab->aCol[iIdx];
92863
+ if( pCol->iDflt>0 ){
92864
+ if( p->apDflt==0 ){
92865
+ int nByte = sizeof(sqlite3_value*)*p->pTab->nCol;
92866
+ p->apDflt = (sqlite3_value**)sqlite3DbMallocZero(db, nByte);
92867
+ if( p->apDflt==0 ) goto preupdate_old_out;
92868
+ }
92869
+ if( p->apDflt[iIdx]==0 ){
92870
+ sqlite3_value *pVal = 0;
92871
+ Expr *pDflt;
92872
+ assert( p->pTab!=0 && IsOrdinaryTable(p->pTab) );
92873
+ pDflt = p->pTab->u.tab.pDfltList->a[pCol->iDflt-1].pExpr;
92874
+ rc = sqlite3ValueFromExpr(db, pDflt, ENC(db), pCol->affinity, &pVal);
92875
+ if( rc==SQLITE_OK && pVal==0 ){
92876
+ rc = SQLITE_CORRUPT_BKPT;
92877
+ }
92878
+ p->apDflt[iIdx] = pVal;
92879
+ }
92880
+ *ppValue = p->apDflt[iIdx];
92881
+ }else{
92882
+ *ppValue = (sqlite3_value *)columnNullValue();
92883
+ }
9285092884
}else if( p->pTab->aCol[iIdx].affinity==SQLITE_AFF_REAL ){
9285192885
if( pMem->flags & (MEM_Int|MEM_IntReal) ){
9285292886
testcase( pMem->flags & MEM_Int );
9285392887
testcase( pMem->flags & MEM_IntReal );
9285492888
sqlite3VdbeMemRealify(pMem);
@@ -108153,12 +108187,12 @@
108153108187
}
108154108188
108155108189
/* Resolve function names
108156108190
*/
108157108191
case TK_FUNCTION: {
108158
- ExprList *pList = pExpr->x.pList; /* The argument list */
108159
- int n = pList ? pList->nExpr : 0; /* Number of arguments */
108192
+ ExprList *pList; /* The argument list */
108193
+ int n; /* Number of arguments */
108160108194
int no_such_func = 0; /* True if no such function exists */
108161108195
int wrong_num_args = 0; /* True if wrong number of arguments */
108162108196
int is_agg = 0; /* True if is an aggregate function */
108163108197
const char *zId; /* The function name. */
108164108198
FuncDef *pDef; /* Information about the function */
@@ -108167,10 +108201,12 @@
108167108201
#ifndef SQLITE_OMIT_WINDOWFUNC
108168108202
Window *pWin = (IsWindowFunc(pExpr) ? pExpr->y.pWin : 0);
108169108203
#endif
108170108204
assert( !ExprHasProperty(pExpr, EP_xIsSelect|EP_IntValue) );
108171108205
assert( pExpr->pLeft==0 || pExpr->pLeft->op==TK_ORDER );
108206
+ pList = pExpr->x.pList;
108207
+ n = pList ? pList->nExpr : 0;
108172108208
zId = pExpr->u.zToken;
108173108209
pDef = sqlite3FindFunction(pParse->db, zId, n, enc, 0);
108174108210
if( pDef==0 ){
108175108211
pDef = sqlite3FindFunction(pParse->db, zId, -2, enc, 0);
108176108212
if( pDef==0 ){
@@ -128254,10 +128290,11 @@
128254128290
** 4) The table is a shadow table, the database connection is in
128255128291
** defensive mode, and the current sqlite3_prepare()
128256128292
** is for a top-level SQL statement.
128257128293
*/
128258128294
static int vtabIsReadOnly(Parse *pParse, Table *pTab){
128295
+ assert( IsVirtual(pTab) );
128259128296
if( sqlite3GetVTable(pParse->db, pTab)->pMod->pModule->xUpdate==0 ){
128260128297
return 1;
128261128298
}
128262128299
128263128300
/* Within triggers:
@@ -143399,16 +143436,28 @@
143399143436
#endif
143400143437
*ppStmt = 0;
143401143438
if( !sqlite3SafetyCheckOk(db)||zSql==0 ){
143402143439
return SQLITE_MISUSE_BKPT;
143403143440
}
143441
+
143442
+ /* Make sure nBytes is non-negative and correct. It should be the
143443
+ ** number of bytes until the end of the input buffer or until the first
143444
+ ** U+0000 character. If the input nBytes is odd, convert it into
143445
+ ** an even number. If the input nBytes is negative, then the input
143446
+ ** must be terminated by at least one U+0000 character */
143404143447
if( nBytes>=0 ){
143405143448
int sz;
143406143449
const char *z = (const char*)zSql;
143407143450
for(sz=0; sz<nBytes && (z[sz]!=0 || z[sz+1]!=0); sz += 2){}
143408143451
nBytes = sz;
143452
+ }else{
143453
+ int sz;
143454
+ const char *z = (const char*)zSql;
143455
+ for(sz=0; z[sz]!=0 || z[sz+1]!=0; sz += 2){}
143456
+ nBytes = sz;
143409143457
}
143458
+
143410143459
sqlite3_mutex_enter(db->mutex);
143411143460
zSql8 = sqlite3Utf16to8(db, zSql, nBytes, SQLITE_UTF16NATIVE);
143412143461
if( zSql8 ){
143413143462
rc = sqlite3LockAndPrepare(db, zSql8, -1, prepFlags, 0, ppStmt, &zTail8);
143414143463
}
@@ -143418,11 +143467,11 @@
143418143467
** equivalent pointer into the UTF-16 string by counting the unicode
143419143468
** characters between zSql8 and zTail8, and then returning a pointer
143420143469
** the same number of characters into the UTF-16 string.
143421143470
*/
143422143471
int chars_parsed = sqlite3Utf8CharLen(zSql8, (int)(zTail8-zSql8));
143423
- *pzTail = (u8 *)zSql + sqlite3Utf16ByteLen(zSql, chars_parsed);
143472
+ *pzTail = (u8 *)zSql + sqlite3Utf16ByteLen(zSql, nBytes, chars_parsed);
143424143473
}
143425143474
sqlite3DbFree(db, zSql8);
143426143475
rc = sqlite3ApiExit(db, rc);
143427143476
sqlite3_mutex_leave(db->mutex);
143428143477
return rc;
@@ -157010,10 +157059,11 @@
157010157059
assert( sParse.zErrMsg==0 );
157011157060
if( !pTab->aCol ){
157012157061
Table *pNew = sParse.pNewTable;
157013157062
Index *pIdx;
157014157063
pTab->aCol = pNew->aCol;
157064
+ assert( IsOrdinaryTable(pNew) );
157015157065
sqlite3ExprListDelete(db, pNew->u.tab.pDfltList);
157016157066
pTab->nNVCol = pTab->nCol = pNew->nCol;
157017157067
pTab->tabFlags |= pNew->tabFlags & (TF_WithoutRowid|TF_NoVisibleRowid);
157018157068
pNew->nCol = 0;
157019157069
pNew->aCol = 0;
@@ -164607,13 +164657,15 @@
164607164657
** Whether or not an error is returned, it is the responsibility of the
164608164658
** caller to eventually free p->idxStr if p->needToFreeIdxStr indicates
164609164659
** that this is required.
164610164660
*/
164611164661
static int vtabBestIndex(Parse *pParse, Table *pTab, sqlite3_index_info *p){
164612
- sqlite3_vtab *pVtab = sqlite3GetVTable(pParse->db, pTab)->pVtab;
164613164662
int rc;
164663
+ sqlite3_vtab *pVtab;
164614164664
164665
+ assert( IsVirtual(pTab) );
164666
+ pVtab = sqlite3GetVTable(pParse->db, pTab)->pVtab;
164615164667
whereTraceIndexInfoInputs(p, pTab);
164616164668
pParse->db->nSchemaLock++;
164617164669
rc = pVtab->pModule->xBestIndex(pVtab, p);
164618164670
pParse->db->nSchemaLock--;
164619164671
whereTraceIndexInfoOutputs(p, pTab);
@@ -184429,10 +184481,11 @@
184429184481
testcase( (1<<(flags&7))==0x04 ); /* READWRITE */
184430184482
testcase( (1<<(flags&7))==0x40 ); /* READWRITE | CREATE */
184431184483
if( ((1<<(flags&7)) & 0x46)==0 ){
184432184484
rc = SQLITE_MISUSE_BKPT; /* IMP: R-18321-05872 */
184433184485
}else{
184486
+ if( zFilename==0 ) zFilename = ":memory:";
184434184487
rc = sqlite3ParseUri(zVfs, zFilename, &flags, &db->pVfs, &zOpen, &zErrMsg);
184435184488
}
184436184489
if( rc!=SQLITE_OK ){
184437184490
if( rc==SQLITE_NOMEM ) sqlite3OomFault(db);
184438184491
sqlite3ErrorWithMsg(db, rc, zErrMsg ? "%s" : 0, zErrMsg);
@@ -227932,20 +227985,23 @@
227932227985
/* Figure out how large an allocation is required */
227933227986
nByte = sizeof(SessionChange);
227934227987
for(i=0; i<(pTab->nCol-pTab->bRowid); i++){
227935227988
sqlite3_value *p = 0;
227936227989
if( op!=SQLITE_INSERT ){
227937
- TESTONLY(int trc = ) pSession->hook.xOld(pSession->hook.pCtx, i, &p);
227938
- assert( trc==SQLITE_OK );
227990
+ /* This may fail if the column has a non-NULL default and was added
227991
+ ** using ALTER TABLE ADD COLUMN after this record was created. */
227992
+ rc = pSession->hook.xOld(pSession->hook.pCtx, i, &p);
227939227993
}else if( pTab->abPK[i] ){
227940227994
TESTONLY(int trc = ) pSession->hook.xNew(pSession->hook.pCtx, i, &p);
227941227995
assert( trc==SQLITE_OK );
227942227996
}
227943227997
227944
- /* This may fail if SQLite value p contains a utf-16 string that must
227945
- ** be converted to utf-8 and an OOM error occurs while doing so. */
227946
- rc = sessionSerializeValue(0, p, &nByte);
227998
+ if( rc==SQLITE_OK ){
227999
+ /* This may fail if SQLite value p contains a utf-16 string that must
228000
+ ** be converted to utf-8 and an OOM error occurs while doing so. */
228001
+ rc = sessionSerializeValue(0, p, &nByte);
228002
+ }
227947228003
if( rc!=SQLITE_OK ) goto error_out;
227948228004
}
227949228005
if( pTab->bRowid ){
227950228006
nByte += 9; /* Size of rowid field - an integer */
227951228007
}
@@ -231835,10 +231891,13 @@
231835231891
if( op==SQLITE_INSERT || (op==SQLITE_DELETE && pGrp->bPatch==0) ){
231836231892
/* Append the missing default column values to the record. */
231837231893
sessionAppendBlob(pOut, aRec, nRec, &rc);
231838231894
if( rc==SQLITE_OK && pTab->pDfltStmt==0 ){
231839231895
rc = sessionPrepareDfltStmt(pGrp->db, pTab, &pTab->pDfltStmt);
231896
+ if( rc==SQLITE_OK && SQLITE_ROW!=sqlite3_step(pTab->pDfltStmt) ){
231897
+ rc = sqlite3_errcode(pGrp->db);
231898
+ }
231840231899
}
231841231900
for(ii=nCol; rc==SQLITE_OK && ii<pTab->nCol; ii++){
231842231901
int eType = sqlite3_column_type(pTab->pDfltStmt, ii);
231843231902
sessionAppendByte(pOut, eType, &rc);
231844231903
switch( eType ){
@@ -231851,10 +231910,11 @@
231851231910
double rVal = sqlite3_column_int64(pTab->pDfltStmt, ii);
231852231911
memcpy(&iVal, &rVal, sizeof(i64));
231853231912
}
231854231913
if( SQLITE_OK==sessionBufferGrow(pOut, 8, &rc) ){
231855231914
sessionPutI64(&pOut->aBuf[pOut->nBuf], iVal);
231915
+ pOut->nBuf += 8;
231856231916
}
231857231917
break;
231858231918
}
231859231919
231860231920
case SQLITE_BLOB:
@@ -254665,11 +254725,11 @@
254665254725
int nArg, /* Number of args */
254666254726
sqlite3_value **apUnused /* Function arguments */
254667254727
){
254668254728
assert( nArg==0 );
254669254729
UNUSED_PARAM2(nArg, apUnused);
254670
- sqlite3_result_text(pCtx, "fts5: 2024-09-17 22:57:08 a63e412b6b2939422ecfa99d91fccb7a9c61e1533bb0db20ff12f3815ef41a2c", -1, SQLITE_TRANSIENT);
254730
+ sqlite3_result_text(pCtx, "fts5: 2024-09-21 15:57:06 62e11a3a78edf9853b74d6495ccd8ae9ac1966c7d78eb3682cf2d5885e3740ec", -1, SQLITE_TRANSIENT);
254671254731
}
254672254732
254673254733
/*
254674254734
** Implementation of fts5_locale(LOCALE, TEXT) function.
254675254735
**
254676254736
--- 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 ** a63e412b6b2939422ecfa99d91fccb7a9c61.
22 */
23 #define SQLITE_CORE 1
24 #define SQLITE_AMALGAMATION 1
25 #ifndef SQLITE_PRIVATE
26 # define SQLITE_PRIVATE static
@@ -462,11 +462,11 @@
462 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
463 ** [sqlite_version()] and [sqlite_source_id()].
464 */
465 #define SQLITE_VERSION "3.47.0"
466 #define SQLITE_VERSION_NUMBER 3047000
467 #define SQLITE_SOURCE_ID "2024-09-17 22:57:08 a63e412b6b2939422ecfa99d91fccb7a9c61e1533bb0db20ff12f3815ef41a2c"
468
469 /*
470 ** CAPI3REF: Run-Time Library Version Numbers
471 ** KEYWORDS: sqlite3_version sqlite3_sourceid
472 **
@@ -21381,11 +21381,11 @@
21381 SQLITE_PRIVATE int sqlite3AtoF(const char *z, double*, int, u8);
21382 SQLITE_PRIVATE int sqlite3GetInt32(const char *, int*);
21383 SQLITE_PRIVATE int sqlite3GetUInt32(const char*, u32*);
21384 SQLITE_PRIVATE int sqlite3Atoi(const char*);
21385 #ifndef SQLITE_OMIT_UTF16
21386 SQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *pData, int nChar);
21387 #endif
21388 SQLITE_PRIVATE int sqlite3Utf8CharLen(const char *pData, int nByte);
21389 SQLITE_PRIVATE u32 sqlite3Utf8Read(const u8**);
21390 SQLITE_PRIVATE int sqlite3Utf8ReadLimited(const u8*, int, u32*);
21391 SQLITE_PRIVATE LogEst sqlite3LogEst(u64);
@@ -23840,10 +23840,11 @@
23840 i64 iKey1; /* First key value passed to hook */
23841 i64 iKey2; /* Second key value passed to hook */
23842 Mem *aNew; /* Array of new.* values */
23843 Table *pTab; /* Schema object being updated */
23844 Index *pPk; /* PK index if pTab is WITHOUT ROWID */
 
23845 };
23846
23847 /*
23848 ** An instance of this object is used to pass an vector of values into
23849 ** OP_VFilter, the xFilter method of a virtual table. The vector is the
@@ -35078,24 +35079,26 @@
35078 assert( m.z || db->mallocFailed );
35079 return m.z;
35080 }
35081
35082 /*
35083 ** zIn is a UTF-16 encoded unicode string at least nChar characters long.
35084 ** Return the number of bytes in the first nChar unicode characters
35085 ** in pZ. nChar must be non-negative.
 
35086 */
35087 SQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *zIn, int nChar){
35088 int c;
35089 unsigned char const *z = zIn;
 
35090 int n = 0;
35091
35092 if( SQLITE_UTF16NATIVE==SQLITE_UTF16LE ) z++;
35093 while( n<nChar ){
35094 c = z[0];
35095 z += 2;
35096 if( c>=0xd8 && c<0xdc && z[0]>=0xdc && z[0]<0xe0 ) z += 2;
35097 n++;
35098 }
35099 return (int)(z-(unsigned char const *)zIn)
35100 - (SQLITE_UTF16NATIVE==SQLITE_UTF16LE);
35101 }
@@ -84551,11 +84554,12 @@
84551 if( apVal==0 ){
84552 rc = SQLITE_NOMEM_BKPT;
84553 goto value_from_function_out;
84554 }
84555 for(i=0; i<nVal; i++){
84556 rc = sqlite3ValueFromExpr(db, pList->a[i].pExpr, enc, aff, &apVal[i]);
 
84557 if( apVal[i]==0 || rc!=SQLITE_OK ) goto value_from_function_out;
84558 }
84559 }
84560
84561 pVal = valueNew(db, pCtx);
@@ -90615,10 +90619,17 @@
90615 for(i=0; i<pCsr->nField; i++){
90616 sqlite3VdbeMemRelease(&preupdate.aNew[i]);
90617 }
90618 sqlite3DbNNFreeNN(db, preupdate.aNew);
90619 }
 
 
 
 
 
 
 
90620 }
90621 #endif /* SQLITE_ENABLE_PREUPDATE_HOOK */
90622
90623 /************** End of vdbeaux.c *********************************************/
90624 /************** Begin file vdbeapi.c *****************************************/
@@ -92844,11 +92855,34 @@
92844
92845 pMem = *ppValue = &p->pUnpacked->aMem[iIdx];
92846 if( iIdx==p->pTab->iPKey ){
92847 sqlite3VdbeMemSetInt64(pMem, p->iKey1);
92848 }else if( iIdx>=p->pUnpacked->nField ){
92849 *ppValue = (sqlite3_value *)columnNullValue();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92850 }else if( p->pTab->aCol[iIdx].affinity==SQLITE_AFF_REAL ){
92851 if( pMem->flags & (MEM_Int|MEM_IntReal) ){
92852 testcase( pMem->flags & MEM_Int );
92853 testcase( pMem->flags & MEM_IntReal );
92854 sqlite3VdbeMemRealify(pMem);
@@ -108153,12 +108187,12 @@
108153 }
108154
108155 /* Resolve function names
108156 */
108157 case TK_FUNCTION: {
108158 ExprList *pList = pExpr->x.pList; /* The argument list */
108159 int n = pList ? pList->nExpr : 0; /* Number of arguments */
108160 int no_such_func = 0; /* True if no such function exists */
108161 int wrong_num_args = 0; /* True if wrong number of arguments */
108162 int is_agg = 0; /* True if is an aggregate function */
108163 const char *zId; /* The function name. */
108164 FuncDef *pDef; /* Information about the function */
@@ -108167,10 +108201,12 @@
108167 #ifndef SQLITE_OMIT_WINDOWFUNC
108168 Window *pWin = (IsWindowFunc(pExpr) ? pExpr->y.pWin : 0);
108169 #endif
108170 assert( !ExprHasProperty(pExpr, EP_xIsSelect|EP_IntValue) );
108171 assert( pExpr->pLeft==0 || pExpr->pLeft->op==TK_ORDER );
 
 
108172 zId = pExpr->u.zToken;
108173 pDef = sqlite3FindFunction(pParse->db, zId, n, enc, 0);
108174 if( pDef==0 ){
108175 pDef = sqlite3FindFunction(pParse->db, zId, -2, enc, 0);
108176 if( pDef==0 ){
@@ -128254,10 +128290,11 @@
128254 ** 4) The table is a shadow table, the database connection is in
128255 ** defensive mode, and the current sqlite3_prepare()
128256 ** is for a top-level SQL statement.
128257 */
128258 static int vtabIsReadOnly(Parse *pParse, Table *pTab){
 
128259 if( sqlite3GetVTable(pParse->db, pTab)->pMod->pModule->xUpdate==0 ){
128260 return 1;
128261 }
128262
128263 /* Within triggers:
@@ -143399,16 +143436,28 @@
143399 #endif
143400 *ppStmt = 0;
143401 if( !sqlite3SafetyCheckOk(db)||zSql==0 ){
143402 return SQLITE_MISUSE_BKPT;
143403 }
 
 
 
 
 
 
143404 if( nBytes>=0 ){
143405 int sz;
143406 const char *z = (const char*)zSql;
143407 for(sz=0; sz<nBytes && (z[sz]!=0 || z[sz+1]!=0); sz += 2){}
143408 nBytes = sz;
 
 
 
 
 
143409 }
 
143410 sqlite3_mutex_enter(db->mutex);
143411 zSql8 = sqlite3Utf16to8(db, zSql, nBytes, SQLITE_UTF16NATIVE);
143412 if( zSql8 ){
143413 rc = sqlite3LockAndPrepare(db, zSql8, -1, prepFlags, 0, ppStmt, &zTail8);
143414 }
@@ -143418,11 +143467,11 @@
143418 ** equivalent pointer into the UTF-16 string by counting the unicode
143419 ** characters between zSql8 and zTail8, and then returning a pointer
143420 ** the same number of characters into the UTF-16 string.
143421 */
143422 int chars_parsed = sqlite3Utf8CharLen(zSql8, (int)(zTail8-zSql8));
143423 *pzTail = (u8 *)zSql + sqlite3Utf16ByteLen(zSql, chars_parsed);
143424 }
143425 sqlite3DbFree(db, zSql8);
143426 rc = sqlite3ApiExit(db, rc);
143427 sqlite3_mutex_leave(db->mutex);
143428 return rc;
@@ -157010,10 +157059,11 @@
157010 assert( sParse.zErrMsg==0 );
157011 if( !pTab->aCol ){
157012 Table *pNew = sParse.pNewTable;
157013 Index *pIdx;
157014 pTab->aCol = pNew->aCol;
 
157015 sqlite3ExprListDelete(db, pNew->u.tab.pDfltList);
157016 pTab->nNVCol = pTab->nCol = pNew->nCol;
157017 pTab->tabFlags |= pNew->tabFlags & (TF_WithoutRowid|TF_NoVisibleRowid);
157018 pNew->nCol = 0;
157019 pNew->aCol = 0;
@@ -164607,13 +164657,15 @@
164607 ** Whether or not an error is returned, it is the responsibility of the
164608 ** caller to eventually free p->idxStr if p->needToFreeIdxStr indicates
164609 ** that this is required.
164610 */
164611 static int vtabBestIndex(Parse *pParse, Table *pTab, sqlite3_index_info *p){
164612 sqlite3_vtab *pVtab = sqlite3GetVTable(pParse->db, pTab)->pVtab;
164613 int rc;
 
164614
 
 
164615 whereTraceIndexInfoInputs(p, pTab);
164616 pParse->db->nSchemaLock++;
164617 rc = pVtab->pModule->xBestIndex(pVtab, p);
164618 pParse->db->nSchemaLock--;
164619 whereTraceIndexInfoOutputs(p, pTab);
@@ -184429,10 +184481,11 @@
184429 testcase( (1<<(flags&7))==0x04 ); /* READWRITE */
184430 testcase( (1<<(flags&7))==0x40 ); /* READWRITE | CREATE */
184431 if( ((1<<(flags&7)) & 0x46)==0 ){
184432 rc = SQLITE_MISUSE_BKPT; /* IMP: R-18321-05872 */
184433 }else{
 
184434 rc = sqlite3ParseUri(zVfs, zFilename, &flags, &db->pVfs, &zOpen, &zErrMsg);
184435 }
184436 if( rc!=SQLITE_OK ){
184437 if( rc==SQLITE_NOMEM ) sqlite3OomFault(db);
184438 sqlite3ErrorWithMsg(db, rc, zErrMsg ? "%s" : 0, zErrMsg);
@@ -227932,20 +227985,23 @@
227932 /* Figure out how large an allocation is required */
227933 nByte = sizeof(SessionChange);
227934 for(i=0; i<(pTab->nCol-pTab->bRowid); i++){
227935 sqlite3_value *p = 0;
227936 if( op!=SQLITE_INSERT ){
227937 TESTONLY(int trc = ) pSession->hook.xOld(pSession->hook.pCtx, i, &p);
227938 assert( trc==SQLITE_OK );
 
227939 }else if( pTab->abPK[i] ){
227940 TESTONLY(int trc = ) pSession->hook.xNew(pSession->hook.pCtx, i, &p);
227941 assert( trc==SQLITE_OK );
227942 }
227943
227944 /* This may fail if SQLite value p contains a utf-16 string that must
227945 ** be converted to utf-8 and an OOM error occurs while doing so. */
227946 rc = sessionSerializeValue(0, p, &nByte);
 
 
227947 if( rc!=SQLITE_OK ) goto error_out;
227948 }
227949 if( pTab->bRowid ){
227950 nByte += 9; /* Size of rowid field - an integer */
227951 }
@@ -231835,10 +231891,13 @@
231835 if( op==SQLITE_INSERT || (op==SQLITE_DELETE && pGrp->bPatch==0) ){
231836 /* Append the missing default column values to the record. */
231837 sessionAppendBlob(pOut, aRec, nRec, &rc);
231838 if( rc==SQLITE_OK && pTab->pDfltStmt==0 ){
231839 rc = sessionPrepareDfltStmt(pGrp->db, pTab, &pTab->pDfltStmt);
 
 
 
231840 }
231841 for(ii=nCol; rc==SQLITE_OK && ii<pTab->nCol; ii++){
231842 int eType = sqlite3_column_type(pTab->pDfltStmt, ii);
231843 sessionAppendByte(pOut, eType, &rc);
231844 switch( eType ){
@@ -231851,10 +231910,11 @@
231851 double rVal = sqlite3_column_int64(pTab->pDfltStmt, ii);
231852 memcpy(&iVal, &rVal, sizeof(i64));
231853 }
231854 if( SQLITE_OK==sessionBufferGrow(pOut, 8, &rc) ){
231855 sessionPutI64(&pOut->aBuf[pOut->nBuf], iVal);
 
231856 }
231857 break;
231858 }
231859
231860 case SQLITE_BLOB:
@@ -254665,11 +254725,11 @@
254665 int nArg, /* Number of args */
254666 sqlite3_value **apUnused /* Function arguments */
254667 ){
254668 assert( nArg==0 );
254669 UNUSED_PARAM2(nArg, apUnused);
254670 sqlite3_result_text(pCtx, "fts5: 2024-09-17 22:57:08 a63e412b6b2939422ecfa99d91fccb7a9c61e1533bb0db20ff12f3815ef41a2c", -1, SQLITE_TRANSIENT);
254671 }
254672
254673 /*
254674 ** Implementation of fts5_locale(LOCALE, TEXT) function.
254675 **
254676
--- 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 ** 62e11a3a78edf9853b74d6495ccd8ae9ac19.
22 */
23 #define SQLITE_CORE 1
24 #define SQLITE_AMALGAMATION 1
25 #ifndef SQLITE_PRIVATE
26 # define SQLITE_PRIVATE static
@@ -462,11 +462,11 @@
462 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
463 ** [sqlite_version()] and [sqlite_source_id()].
464 */
465 #define SQLITE_VERSION "3.47.0"
466 #define SQLITE_VERSION_NUMBER 3047000
467 #define SQLITE_SOURCE_ID "2024-09-21 15:57:06 62e11a3a78edf9853b74d6495ccd8ae9ac1966c7d78eb3682cf2d5885e3740ec"
468
469 /*
470 ** CAPI3REF: Run-Time Library Version Numbers
471 ** KEYWORDS: sqlite3_version sqlite3_sourceid
472 **
@@ -21381,11 +21381,11 @@
21381 SQLITE_PRIVATE int sqlite3AtoF(const char *z, double*, int, u8);
21382 SQLITE_PRIVATE int sqlite3GetInt32(const char *, int*);
21383 SQLITE_PRIVATE int sqlite3GetUInt32(const char*, u32*);
21384 SQLITE_PRIVATE int sqlite3Atoi(const char*);
21385 #ifndef SQLITE_OMIT_UTF16
21386 SQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *pData, int nByte, int nChar);
21387 #endif
21388 SQLITE_PRIVATE int sqlite3Utf8CharLen(const char *pData, int nByte);
21389 SQLITE_PRIVATE u32 sqlite3Utf8Read(const u8**);
21390 SQLITE_PRIVATE int sqlite3Utf8ReadLimited(const u8*, int, u32*);
21391 SQLITE_PRIVATE LogEst sqlite3LogEst(u64);
@@ -23840,10 +23840,11 @@
23840 i64 iKey1; /* First key value passed to hook */
23841 i64 iKey2; /* Second key value passed to hook */
23842 Mem *aNew; /* Array of new.* values */
23843 Table *pTab; /* Schema object being updated */
23844 Index *pPk; /* PK index if pTab is WITHOUT ROWID */
23845 sqlite3_value **apDflt; /* Array of default values, if required */
23846 };
23847
23848 /*
23849 ** An instance of this object is used to pass an vector of values into
23850 ** OP_VFilter, the xFilter method of a virtual table. The vector is the
@@ -35078,24 +35079,26 @@
35079 assert( m.z || db->mallocFailed );
35080 return m.z;
35081 }
35082
35083 /*
35084 ** zIn is a UTF-16 encoded unicode string at least nByte bytes long.
35085 ** Return the number of bytes in the first nChar unicode characters
35086 ** in pZ. nChar must be non-negative. Surrogate pairs count as a single
35087 ** character.
35088 */
35089 SQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *zIn, int nByte, int nChar){
35090 int c;
35091 unsigned char const *z = zIn;
35092 unsigned char const *zEnd = &z[nByte-1];
35093 int n = 0;
35094
35095 if( SQLITE_UTF16NATIVE==SQLITE_UTF16LE ) z++;
35096 while( n<nChar && ALWAYS(z<=zEnd) ){
35097 c = z[0];
35098 z += 2;
35099 if( c>=0xd8 && c<0xdc && z<=zEnd && z[0]>=0xdc && z[0]<0xe0 ) z += 2;
35100 n++;
35101 }
35102 return (int)(z-(unsigned char const *)zIn)
35103 - (SQLITE_UTF16NATIVE==SQLITE_UTF16LE);
35104 }
@@ -84551,11 +84554,12 @@
84554 if( apVal==0 ){
84555 rc = SQLITE_NOMEM_BKPT;
84556 goto value_from_function_out;
84557 }
84558 for(i=0; i<nVal; i++){
84559 rc = sqlite3Stat4ValueFromExpr(pCtx->pParse, pList->a[i].pExpr, aff,
84560 &apVal[i]);
84561 if( apVal[i]==0 || rc!=SQLITE_OK ) goto value_from_function_out;
84562 }
84563 }
84564
84565 pVal = valueNew(db, pCtx);
@@ -90615,10 +90619,17 @@
90619 for(i=0; i<pCsr->nField; i++){
90620 sqlite3VdbeMemRelease(&preupdate.aNew[i]);
90621 }
90622 sqlite3DbNNFreeNN(db, preupdate.aNew);
90623 }
90624 if( preupdate.apDflt ){
90625 int i;
90626 for(i=0; i<pTab->nCol; i++){
90627 sqlite3ValueFree(preupdate.apDflt[i]);
90628 }
90629 sqlite3DbFree(db, preupdate.apDflt);
90630 }
90631 }
90632 #endif /* SQLITE_ENABLE_PREUPDATE_HOOK */
90633
90634 /************** End of vdbeaux.c *********************************************/
90635 /************** Begin file vdbeapi.c *****************************************/
@@ -92844,11 +92855,34 @@
92855
92856 pMem = *ppValue = &p->pUnpacked->aMem[iIdx];
92857 if( iIdx==p->pTab->iPKey ){
92858 sqlite3VdbeMemSetInt64(pMem, p->iKey1);
92859 }else if( iIdx>=p->pUnpacked->nField ){
92860 /* This occurs when the table has been extended using ALTER TABLE
92861 ** ADD COLUMN. The value to return is the default value of the column. */
92862 Column *pCol = &p->pTab->aCol[iIdx];
92863 if( pCol->iDflt>0 ){
92864 if( p->apDflt==0 ){
92865 int nByte = sizeof(sqlite3_value*)*p->pTab->nCol;
92866 p->apDflt = (sqlite3_value**)sqlite3DbMallocZero(db, nByte);
92867 if( p->apDflt==0 ) goto preupdate_old_out;
92868 }
92869 if( p->apDflt[iIdx]==0 ){
92870 sqlite3_value *pVal = 0;
92871 Expr *pDflt;
92872 assert( p->pTab!=0 && IsOrdinaryTable(p->pTab) );
92873 pDflt = p->pTab->u.tab.pDfltList->a[pCol->iDflt-1].pExpr;
92874 rc = sqlite3ValueFromExpr(db, pDflt, ENC(db), pCol->affinity, &pVal);
92875 if( rc==SQLITE_OK && pVal==0 ){
92876 rc = SQLITE_CORRUPT_BKPT;
92877 }
92878 p->apDflt[iIdx] = pVal;
92879 }
92880 *ppValue = p->apDflt[iIdx];
92881 }else{
92882 *ppValue = (sqlite3_value *)columnNullValue();
92883 }
92884 }else if( p->pTab->aCol[iIdx].affinity==SQLITE_AFF_REAL ){
92885 if( pMem->flags & (MEM_Int|MEM_IntReal) ){
92886 testcase( pMem->flags & MEM_Int );
92887 testcase( pMem->flags & MEM_IntReal );
92888 sqlite3VdbeMemRealify(pMem);
@@ -108153,12 +108187,12 @@
108187 }
108188
108189 /* Resolve function names
108190 */
108191 case TK_FUNCTION: {
108192 ExprList *pList; /* The argument list */
108193 int n; /* Number of arguments */
108194 int no_such_func = 0; /* True if no such function exists */
108195 int wrong_num_args = 0; /* True if wrong number of arguments */
108196 int is_agg = 0; /* True if is an aggregate function */
108197 const char *zId; /* The function name. */
108198 FuncDef *pDef; /* Information about the function */
@@ -108167,10 +108201,12 @@
108201 #ifndef SQLITE_OMIT_WINDOWFUNC
108202 Window *pWin = (IsWindowFunc(pExpr) ? pExpr->y.pWin : 0);
108203 #endif
108204 assert( !ExprHasProperty(pExpr, EP_xIsSelect|EP_IntValue) );
108205 assert( pExpr->pLeft==0 || pExpr->pLeft->op==TK_ORDER );
108206 pList = pExpr->x.pList;
108207 n = pList ? pList->nExpr : 0;
108208 zId = pExpr->u.zToken;
108209 pDef = sqlite3FindFunction(pParse->db, zId, n, enc, 0);
108210 if( pDef==0 ){
108211 pDef = sqlite3FindFunction(pParse->db, zId, -2, enc, 0);
108212 if( pDef==0 ){
@@ -128254,10 +128290,11 @@
128290 ** 4) The table is a shadow table, the database connection is in
128291 ** defensive mode, and the current sqlite3_prepare()
128292 ** is for a top-level SQL statement.
128293 */
128294 static int vtabIsReadOnly(Parse *pParse, Table *pTab){
128295 assert( IsVirtual(pTab) );
128296 if( sqlite3GetVTable(pParse->db, pTab)->pMod->pModule->xUpdate==0 ){
128297 return 1;
128298 }
128299
128300 /* Within triggers:
@@ -143399,16 +143436,28 @@
143436 #endif
143437 *ppStmt = 0;
143438 if( !sqlite3SafetyCheckOk(db)||zSql==0 ){
143439 return SQLITE_MISUSE_BKPT;
143440 }
143441
143442 /* Make sure nBytes is non-negative and correct. It should be the
143443 ** number of bytes until the end of the input buffer or until the first
143444 ** U+0000 character. If the input nBytes is odd, convert it into
143445 ** an even number. If the input nBytes is negative, then the input
143446 ** must be terminated by at least one U+0000 character */
143447 if( nBytes>=0 ){
143448 int sz;
143449 const char *z = (const char*)zSql;
143450 for(sz=0; sz<nBytes && (z[sz]!=0 || z[sz+1]!=0); sz += 2){}
143451 nBytes = sz;
143452 }else{
143453 int sz;
143454 const char *z = (const char*)zSql;
143455 for(sz=0; z[sz]!=0 || z[sz+1]!=0; sz += 2){}
143456 nBytes = sz;
143457 }
143458
143459 sqlite3_mutex_enter(db->mutex);
143460 zSql8 = sqlite3Utf16to8(db, zSql, nBytes, SQLITE_UTF16NATIVE);
143461 if( zSql8 ){
143462 rc = sqlite3LockAndPrepare(db, zSql8, -1, prepFlags, 0, ppStmt, &zTail8);
143463 }
@@ -143418,11 +143467,11 @@
143467 ** equivalent pointer into the UTF-16 string by counting the unicode
143468 ** characters between zSql8 and zTail8, and then returning a pointer
143469 ** the same number of characters into the UTF-16 string.
143470 */
143471 int chars_parsed = sqlite3Utf8CharLen(zSql8, (int)(zTail8-zSql8));
143472 *pzTail = (u8 *)zSql + sqlite3Utf16ByteLen(zSql, nBytes, chars_parsed);
143473 }
143474 sqlite3DbFree(db, zSql8);
143475 rc = sqlite3ApiExit(db, rc);
143476 sqlite3_mutex_leave(db->mutex);
143477 return rc;
@@ -157010,10 +157059,11 @@
157059 assert( sParse.zErrMsg==0 );
157060 if( !pTab->aCol ){
157061 Table *pNew = sParse.pNewTable;
157062 Index *pIdx;
157063 pTab->aCol = pNew->aCol;
157064 assert( IsOrdinaryTable(pNew) );
157065 sqlite3ExprListDelete(db, pNew->u.tab.pDfltList);
157066 pTab->nNVCol = pTab->nCol = pNew->nCol;
157067 pTab->tabFlags |= pNew->tabFlags & (TF_WithoutRowid|TF_NoVisibleRowid);
157068 pNew->nCol = 0;
157069 pNew->aCol = 0;
@@ -164607,13 +164657,15 @@
164657 ** Whether or not an error is returned, it is the responsibility of the
164658 ** caller to eventually free p->idxStr if p->needToFreeIdxStr indicates
164659 ** that this is required.
164660 */
164661 static int vtabBestIndex(Parse *pParse, Table *pTab, sqlite3_index_info *p){
 
164662 int rc;
164663 sqlite3_vtab *pVtab;
164664
164665 assert( IsVirtual(pTab) );
164666 pVtab = sqlite3GetVTable(pParse->db, pTab)->pVtab;
164667 whereTraceIndexInfoInputs(p, pTab);
164668 pParse->db->nSchemaLock++;
164669 rc = pVtab->pModule->xBestIndex(pVtab, p);
164670 pParse->db->nSchemaLock--;
164671 whereTraceIndexInfoOutputs(p, pTab);
@@ -184429,10 +184481,11 @@
184481 testcase( (1<<(flags&7))==0x04 ); /* READWRITE */
184482 testcase( (1<<(flags&7))==0x40 ); /* READWRITE | CREATE */
184483 if( ((1<<(flags&7)) & 0x46)==0 ){
184484 rc = SQLITE_MISUSE_BKPT; /* IMP: R-18321-05872 */
184485 }else{
184486 if( zFilename==0 ) zFilename = ":memory:";
184487 rc = sqlite3ParseUri(zVfs, zFilename, &flags, &db->pVfs, &zOpen, &zErrMsg);
184488 }
184489 if( rc!=SQLITE_OK ){
184490 if( rc==SQLITE_NOMEM ) sqlite3OomFault(db);
184491 sqlite3ErrorWithMsg(db, rc, zErrMsg ? "%s" : 0, zErrMsg);
@@ -227932,20 +227985,23 @@
227985 /* Figure out how large an allocation is required */
227986 nByte = sizeof(SessionChange);
227987 for(i=0; i<(pTab->nCol-pTab->bRowid); i++){
227988 sqlite3_value *p = 0;
227989 if( op!=SQLITE_INSERT ){
227990 /* This may fail if the column has a non-NULL default and was added
227991 ** using ALTER TABLE ADD COLUMN after this record was created. */
227992 rc = pSession->hook.xOld(pSession->hook.pCtx, i, &p);
227993 }else if( pTab->abPK[i] ){
227994 TESTONLY(int trc = ) pSession->hook.xNew(pSession->hook.pCtx, i, &p);
227995 assert( trc==SQLITE_OK );
227996 }
227997
227998 if( rc==SQLITE_OK ){
227999 /* This may fail if SQLite value p contains a utf-16 string that must
228000 ** be converted to utf-8 and an OOM error occurs while doing so. */
228001 rc = sessionSerializeValue(0, p, &nByte);
228002 }
228003 if( rc!=SQLITE_OK ) goto error_out;
228004 }
228005 if( pTab->bRowid ){
228006 nByte += 9; /* Size of rowid field - an integer */
228007 }
@@ -231835,10 +231891,13 @@
231891 if( op==SQLITE_INSERT || (op==SQLITE_DELETE && pGrp->bPatch==0) ){
231892 /* Append the missing default column values to the record. */
231893 sessionAppendBlob(pOut, aRec, nRec, &rc);
231894 if( rc==SQLITE_OK && pTab->pDfltStmt==0 ){
231895 rc = sessionPrepareDfltStmt(pGrp->db, pTab, &pTab->pDfltStmt);
231896 if( rc==SQLITE_OK && SQLITE_ROW!=sqlite3_step(pTab->pDfltStmt) ){
231897 rc = sqlite3_errcode(pGrp->db);
231898 }
231899 }
231900 for(ii=nCol; rc==SQLITE_OK && ii<pTab->nCol; ii++){
231901 int eType = sqlite3_column_type(pTab->pDfltStmt, ii);
231902 sessionAppendByte(pOut, eType, &rc);
231903 switch( eType ){
@@ -231851,10 +231910,11 @@
231910 double rVal = sqlite3_column_int64(pTab->pDfltStmt, ii);
231911 memcpy(&iVal, &rVal, sizeof(i64));
231912 }
231913 if( SQLITE_OK==sessionBufferGrow(pOut, 8, &rc) ){
231914 sessionPutI64(&pOut->aBuf[pOut->nBuf], iVal);
231915 pOut->nBuf += 8;
231916 }
231917 break;
231918 }
231919
231920 case SQLITE_BLOB:
@@ -254665,11 +254725,11 @@
254725 int nArg, /* Number of args */
254726 sqlite3_value **apUnused /* Function arguments */
254727 ){
254728 assert( nArg==0 );
254729 UNUSED_PARAM2(nArg, apUnused);
254730 sqlite3_result_text(pCtx, "fts5: 2024-09-21 15:57:06 62e11a3a78edf9853b74d6495ccd8ae9ac1966c7d78eb3682cf2d5885e3740ec", -1, SQLITE_TRANSIENT);
254731 }
254732
254733 /*
254734 ** Implementation of fts5_locale(LOCALE, TEXT) function.
254735 **
254736
--- 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.47.0"
150150
#define SQLITE_VERSION_NUMBER 3047000
151
-#define SQLITE_SOURCE_ID "2024-09-17 22:57:08 a63e412b6b2939422ecfa99d91fccb7a9c61e1533bb0db20ff12f3815ef41a2c"
151
+#define SQLITE_SOURCE_ID "2024-09-21 15:57:06 62e11a3a78edf9853b74d6495ccd8ae9ac1966c7d78eb3682cf2d5885e3740ec"
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.47.0"
150 #define SQLITE_VERSION_NUMBER 3047000
151 #define SQLITE_SOURCE_ID "2024-09-17 22:57:08 a63e412b6b2939422ecfa99d91fccb7a9c61e1533bb0db20ff12f3815ef41a2c"
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.47.0"
150 #define SQLITE_VERSION_NUMBER 3047000
151 #define SQLITE_SOURCE_ID "2024-09-21 15:57:06 62e11a3a78edf9853b74d6495ccd8ae9ac1966c7d78eb3682cf2d5885e3740ec"
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