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*/
@@ -468,12 +468,12 @@ extern "C" {
468468** [sqlite3_libversion_number()], [sqlite3_sourceid()],
469469** [sqlite_version()] and [sqlite_source_id()].
470470*/
471- #define SQLITE_VERSION "3.51.0 "
472- #define SQLITE_VERSION_NUMBER 3051000
473- #define SQLITE_SOURCE_ID "2025-11-04 19:38:17 fb2c931ae597f8d00a37574ff67aeed3eced4e5547f9120744a-experimental "
474- #define SQLITE_SCM_BRANCH "unknown "
475- #define SQLITE_SCM_TAGS "unknown "
476- #define SQLITE_SCM_DATETIME "2025-11-04T19:38:17.314Z "
471+ #define SQLITE_VERSION "3.51.1 "
472+ #define SQLITE_VERSION_NUMBER 3051001
473+ #define SQLITE_SOURCE_ID "2025-11-28 17:28:25 281fc0e9afc38674b9b0991943b9e9d1e64c6cbdb133d35f6f5c87ff6af38a88 "
474+ #define SQLITE_SCM_BRANCH "branch-3.51 "
475+ #define SQLITE_SCM_TAGS "release version-3.51.1 "
476+ #define SQLITE_SCM_DATETIME "2025-11-28T17:28:25.933Z "
477477
478478/*
479479** CAPI3REF: Run-Time Library Version Numbers
@@ -10748,7 +10748,7 @@ SQLITE_API int sqlite3_vtab_in(sqlite3_index_info*, int iCons, int bHandle);
1074810748** ){
1074910749** // do something with pVal
1075010750** }
10751- ** if( rc!=SQLITE_OK ){
10751+ ** if( rc!=SQLITE_DONE ){
1075210752** // an error has occurred
1075310753** }
1075410754** </pre></blockquote>)^
@@ -38005,6 +38005,7 @@ SQLITE_PRIVATE void *sqlite3HashInsert(Hash *pH, const char *pKey, void *data){
3800538005 return 0;
3800638006}
3800738007
38008+
3800838009/************** End of hash.c ************************************************/
3800938010/************** Begin file opcodes.c *****************************************/
3801038011/* Automatically generated. Do not edit */
@@ -130656,6 +130657,7 @@ SQLITE_PRIVATE void sqlite3SchemaClear(void *p){
130656130657 for(pElem=sqliteHashFirst(&temp2); pElem; pElem=sqliteHashNext(pElem)){
130657130658 sqlite3DeleteTrigger(&xdb, (Trigger*)sqliteHashData(pElem));
130658130659 }
130660+
130659130661 sqlite3HashClear(&temp2);
130660130662 sqlite3HashInit(&pSchema->tblHash);
130661130663 for(pElem=sqliteHashFirst(&temp1); pElem; pElem=sqliteHashNext(pElem)){
@@ -160977,9 +160979,12 @@ SQLITE_PRIVATE int sqlite3VtabEponymousTableInit(Parse *pParse, Module *pMod){
160977160979 addModuleArgument(pParse, pTab, sqlite3DbStrDup(db, pTab->zName));
160978160980 addModuleArgument(pParse, pTab, 0);
160979160981 addModuleArgument(pParse, pTab, sqlite3DbStrDup(db, pTab->zName));
160982+ db->nSchemaLock++;
160980160983 rc = vtabCallConstructor(db, pTab, pMod, pModule->xConnect, &zErr);
160984+ db->nSchemaLock--;
160981160985 if( rc ){
160982160986 sqlite3ErrorMsg(pParse, "%s", zErr);
160987+ pParse->rc = rc;
160983160988 sqlite3DbFree(db, zErr);
160984160989 sqlite3VtabEponymousTableClear(db, pMod);
160985160990 }
@@ -174041,8 +174046,22 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){
174041174046 sqlite3VdbeAddOp2(v, OP_Goto, 1, pLevel->p2);
174042174047 }
174043174048#endif /* SQLITE_DISABLE_SKIPAHEAD_DISTINCT */
174044- if( pTabList->a[pLevel->iFrom].fg.fromExists ){
174045- sqlite3VdbeAddOp2(v, OP_Goto, 0, sqlite3VdbeCurrentAddr(v)+2);
174049+ if( pTabList->a[pLevel->iFrom].fg.fromExists && i==pWInfo->nLevel-1 ){
174050+ /* If the EXISTS-to-JOIN optimization was applied, then the EXISTS
174051+ ** loop(s) will be the inner-most loops of the join. There might be
174052+ ** multiple EXISTS loops, but they will all be nested, and the join
174053+ ** order will not have been changed by the query planner. If the
174054+ ** inner-most EXISTS loop sees a single successful row, it should
174055+ ** break out of *all* EXISTS loops. But only the inner-most of the
174056+ ** nested EXISTS loops should do this breakout. */
174057+ int nOuter = 0; /* Nr of outer EXISTS that this one is nested within */
174058+ while( nOuter<i ){
174059+ if( !pTabList->a[pLevel[-nOuter-1].iFrom].fg.fromExists ) break;
174060+ nOuter++;
174061+ }
174062+ testcase( nOuter>0 );
174063+ sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel[-nOuter].addrBrk);
174064+ VdbeComment((v, "EXISTS break"));
174046174065 }
174047174066 /* The common case: Advance to the next row */
174048174067 if( pLevel->addrCont ) sqlite3VdbeResolveLabel(v, pLevel->addrCont);
@@ -186242,6 +186261,7 @@ SQLITE_PRIVATE void sqlite3LeaveMutexAndCloseZombie(sqlite3 *db){
186242186261 /* Clear the TEMP schema separately and last */
186243186262 if( db->aDb[1].pSchema ){
186244186263 sqlite3SchemaClear(db->aDb[1].pSchema);
186264+ assert( db->aDb[1].pSchema->trigHash.count==0 );
186245186265 }
186246186266 sqlite3VtabUnlockList(db);
186247186267
@@ -187570,7 +187590,7 @@ SQLITE_API const char *sqlite3_errmsg(sqlite3 *db){
187570187590*/
187571187591SQLITE_API int sqlite3_set_errmsg(sqlite3 *db, int errcode, const char *zMsg){
187572187592 int rc = SQLITE_OK;
187573- if( !sqlite3SafetyCheckSickOrOk (db) ){
187593+ if( !sqlite3SafetyCheckOk (db) ){
187574187594 return SQLITE_MISUSE_BKPT;
187575187595 }
187576187596 sqlite3_mutex_enter(db->mutex);
@@ -249237,6 +249257,7 @@ static void fts5SegIterReverseInitPage(Fts5Index *p, Fts5SegIter *pIter){
249237249257 while( 1 ){
249238249258 u64 iDelta = 0;
249239249259
249260+ if( i>=n ) break;
249240249261 if( eDetail==FTS5_DETAIL_NONE ){
249241249262 /* todo */
249242249263 if( i<n && a[i]==0 ){
@@ -260300,7 +260321,7 @@ static void fts5SourceIdFunc(
260300260321){
260301260322 assert( nArg==0 );
260302260323 UNUSED_PARAM2(nArg, apUnused);
260303- sqlite3_result_text(pCtx, "fts5: 2025-11-04 19:38:17 fb2c931ae597f8d00a37574ff67aeed3eced4e5547f9120744ae4bfa8e74527b ", -1, SQLITE_TRANSIENT);
260324+ sqlite3_result_text(pCtx, "fts5: 2025-11-28 17:28:25 281fc0e9afc38674b9b0991943b9e9d1e64c6cbdb133d35f6f5c87ff6af38a88 ", -1, SQLITE_TRANSIENT);
260304260325}
260305260326
260306260327/*
@@ -265121,7 +265142,12 @@ static int fts5VocabOpenMethod(
265121265142 return rc;
265122265143}
265123265144
265145+ /*
265146+ ** Restore cursor pCsr to the state it was in immediately after being
265147+ ** created by the xOpen() method.
265148+ */
265124265149static void fts5VocabResetCursor(Fts5VocabCursor *pCsr){
265150+ int nCol = pCsr->pFts5->pConfig->nCol;
265125265151 pCsr->rowid = 0;
265126265152 sqlite3Fts5IterClose(pCsr->pIter);
265127265153 sqlite3Fts5StructureRelease(pCsr->pStruct);
@@ -265131,6 +265157,12 @@ static void fts5VocabResetCursor(Fts5VocabCursor *pCsr){
265131265157 pCsr->nLeTerm = -1;
265132265158 pCsr->zLeTerm = 0;
265133265159 pCsr->bEof = 0;
265160+ pCsr->iCol = 0;
265161+ pCsr->iInstPos = 0;
265162+ pCsr->iInstOff = 0;
265163+ pCsr->colUsed = 0;
265164+ memset(pCsr->aCnt, 0, sizeof(i64)*nCol);
265165+ memset(pCsr->aDoc, 0, sizeof(i64)*nCol);
265134265166}
265135265167
265136265168/*
0 commit comments