11/******************************************************************************
22** This file is an amalgamation of many separate C source files from SQLite
3- ** version 3.51.0 . By combining all the individual C code files into this
3+ ** version 3.51.1 . By combining all the individual C code files into this
44** single large file, the entire code can be compiled as a single translation
55** unit. This allows many compilers to do optimizations that would not be
66** possible if the files were compiled separately. Performance improvements
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- ** fb2c931ae597f8d00a37574ff67aeed3eced with changes in files:
21+ ** 281fc0e9afc38674b9b0991943b9e9d1e64c with changes in files:
2222**
2323**
2424*/
@@ -467,12 +467,12 @@ extern "C" {
467467** [sqlite3_libversion_number()], [sqlite3_sourceid()],
468468** [sqlite_version()] and [sqlite_source_id()].
469469*/
470- #define SQLITE_VERSION "3.51.0 "
471- #define SQLITE_VERSION_NUMBER 3051000
472- #define SQLITE_SOURCE_ID "2025-11-04 19:38:17 fb2c931ae597f8d00a37574ff67aeed3eced4e5547f9120744ae4bfa8e74527b "
473- #define SQLITE_SCM_BRANCH "trunk "
474- #define SQLITE_SCM_TAGS "release major-release version-3.51.0 "
475- #define SQLITE_SCM_DATETIME "2025-11-04T19:38:17.314Z "
470+ #define SQLITE_VERSION "3.51.1 "
471+ #define SQLITE_VERSION_NUMBER 3051001
472+ #define SQLITE_SOURCE_ID "2025-11-28 17:28:25 281fc0e9afc38674b9b0991943b9e9d1e64c6cbdb133d35f6f5c87ff6af38a88 "
473+ #define SQLITE_SCM_BRANCH "branch-3.51 "
474+ #define SQLITE_SCM_TAGS "release version-3.51.1 "
475+ #define SQLITE_SCM_DATETIME "2025-11-28T17:28:25.933Z "
476476
477477/*
478478** CAPI3REF: Run-Time Library Version Numbers
@@ -10747,7 +10747,7 @@ SQLITE_API int sqlite3_vtab_in(sqlite3_index_info*, int iCons, int bHandle);
1074710747** ){
1074810748** // do something with pVal
1074910749** }
10750- ** if( rc!=SQLITE_OK ){
10750+ ** if( rc!=SQLITE_DONE ){
1075110751** // an error has occurred
1075210752** }
1075310753** </pre></blockquote>)^
@@ -38004,6 +38004,7 @@ SQLITE_PRIVATE void *sqlite3HashInsert(Hash *pH, const char *pKey, void *data){
3800438004 return 0;
3800538005}
3800638006
38007+
3800738008/************** End of hash.c ************************************************/
3800838009/************** Begin file opcodes.c *****************************************/
3800938010/* Automatically generated. Do not edit */
@@ -130655,6 +130656,7 @@ SQLITE_PRIVATE void sqlite3SchemaClear(void *p){
130655130656 for(pElem=sqliteHashFirst(&temp2); pElem; pElem=sqliteHashNext(pElem)){
130656130657 sqlite3DeleteTrigger(&xdb, (Trigger*)sqliteHashData(pElem));
130657130658 }
130659+
130658130660 sqlite3HashClear(&temp2);
130659130661 sqlite3HashInit(&pSchema->tblHash);
130660130662 for(pElem=sqliteHashFirst(&temp1); pElem; pElem=sqliteHashNext(pElem)){
@@ -160976,9 +160978,12 @@ SQLITE_PRIVATE int sqlite3VtabEponymousTableInit(Parse *pParse, Module *pMod){
160976160978 addModuleArgument(pParse, pTab, sqlite3DbStrDup(db, pTab->zName));
160977160979 addModuleArgument(pParse, pTab, 0);
160978160980 addModuleArgument(pParse, pTab, sqlite3DbStrDup(db, pTab->zName));
160981+ db->nSchemaLock++;
160979160982 rc = vtabCallConstructor(db, pTab, pMod, pModule->xConnect, &zErr);
160983+ db->nSchemaLock--;
160980160984 if( rc ){
160981160985 sqlite3ErrorMsg(pParse, "%s", zErr);
160986+ pParse->rc = rc;
160982160987 sqlite3DbFree(db, zErr);
160983160988 sqlite3VtabEponymousTableClear(db, pMod);
160984160989 }
@@ -174040,8 +174045,22 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){
174040174045 sqlite3VdbeAddOp2(v, OP_Goto, 1, pLevel->p2);
174041174046 }
174042174047#endif /* SQLITE_DISABLE_SKIPAHEAD_DISTINCT */
174043- if( pTabList->a[pLevel->iFrom].fg.fromExists ){
174044- sqlite3VdbeAddOp2(v, OP_Goto, 0, sqlite3VdbeCurrentAddr(v)+2);
174048+ if( pTabList->a[pLevel->iFrom].fg.fromExists && i==pWInfo->nLevel-1 ){
174049+ /* If the EXISTS-to-JOIN optimization was applied, then the EXISTS
174050+ ** loop(s) will be the inner-most loops of the join. There might be
174051+ ** multiple EXISTS loops, but they will all be nested, and the join
174052+ ** order will not have been changed by the query planner. If the
174053+ ** inner-most EXISTS loop sees a single successful row, it should
174054+ ** break out of *all* EXISTS loops. But only the inner-most of the
174055+ ** nested EXISTS loops should do this breakout. */
174056+ int nOuter = 0; /* Nr of outer EXISTS that this one is nested within */
174057+ while( nOuter<i ){
174058+ if( !pTabList->a[pLevel[-nOuter-1].iFrom].fg.fromExists ) break;
174059+ nOuter++;
174060+ }
174061+ testcase( nOuter>0 );
174062+ sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel[-nOuter].addrBrk);
174063+ VdbeComment((v, "EXISTS break"));
174045174064 }
174046174065 /* The common case: Advance to the next row */
174047174066 if( pLevel->addrCont ) sqlite3VdbeResolveLabel(v, pLevel->addrCont);
@@ -186225,6 +186244,7 @@ SQLITE_PRIVATE void sqlite3LeaveMutexAndCloseZombie(sqlite3 *db){
186225186244 /* Clear the TEMP schema separately and last */
186226186245 if( db->aDb[1].pSchema ){
186227186246 sqlite3SchemaClear(db->aDb[1].pSchema);
186247+ assert( db->aDb[1].pSchema->trigHash.count==0 );
186228186248 }
186229186249 sqlite3VtabUnlockList(db);
186230186250
@@ -187553,7 +187573,7 @@ SQLITE_API const char *sqlite3_errmsg(sqlite3 *db){
187553187573*/
187554187574SQLITE_API int sqlite3_set_errmsg(sqlite3 *db, int errcode, const char *zMsg){
187555187575 int rc = SQLITE_OK;
187556- if( !sqlite3SafetyCheckSickOrOk (db) ){
187576+ if( !sqlite3SafetyCheckOk (db) ){
187557187577 return SQLITE_MISUSE_BKPT;
187558187578 }
187559187579 sqlite3_mutex_enter(db->mutex);
@@ -249220,6 +249240,7 @@ static void fts5SegIterReverseInitPage(Fts5Index *p, Fts5SegIter *pIter){
249220249240 while( 1 ){
249221249241 u64 iDelta = 0;
249222249242
249243+ if( i>=n ) break;
249223249244 if( eDetail==FTS5_DETAIL_NONE ){
249224249245 /* todo */
249225249246 if( i<n && a[i]==0 ){
@@ -260283,7 +260304,7 @@ static void fts5SourceIdFunc(
260283260304){
260284260305 assert( nArg==0 );
260285260306 UNUSED_PARAM2(nArg, apUnused);
260286- sqlite3_result_text(pCtx, "fts5: 2025-11-04 19:38:17 fb2c931ae597f8d00a37574ff67aeed3eced4e5547f9120744ae4bfa8e74527b ", -1, SQLITE_TRANSIENT);
260307+ sqlite3_result_text(pCtx, "fts5: 2025-11-28 17:28:25 281fc0e9afc38674b9b0991943b9e9d1e64c6cbdb133d35f6f5c87ff6af38a88 ", -1, SQLITE_TRANSIENT);
260287260308}
260288260309
260289260310/*
@@ -265104,7 +265125,12 @@ static int fts5VocabOpenMethod(
265104265125 return rc;
265105265126}
265106265127
265128+ /*
265129+ ** Restore cursor pCsr to the state it was in immediately after being
265130+ ** created by the xOpen() method.
265131+ */
265107265132static void fts5VocabResetCursor(Fts5VocabCursor *pCsr){
265133+ int nCol = pCsr->pFts5->pConfig->nCol;
265108265134 pCsr->rowid = 0;
265109265135 sqlite3Fts5IterClose(pCsr->pIter);
265110265136 sqlite3Fts5StructureRelease(pCsr->pStruct);
@@ -265114,6 +265140,12 @@ static void fts5VocabResetCursor(Fts5VocabCursor *pCsr){
265114265140 pCsr->nLeTerm = -1;
265115265141 pCsr->zLeTerm = 0;
265116265142 pCsr->bEof = 0;
265143+ pCsr->iCol = 0;
265144+ pCsr->iInstPos = 0;
265145+ pCsr->iInstOff = 0;
265146+ pCsr->colUsed = 0;
265147+ memset(pCsr->aCnt, 0, sizeof(i64)*nCol);
265148+ memset(pCsr->aDoc, 0, sizeof(i64)*nCol);
265117265149}
265118265150
265119265151/*
0 commit comments