]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix the completion.c TVF so that the xNext method reports errors it encounters
authordrh <>
Sun, 8 Mar 2026 19:36:17 +0000 (19:36 +0000)
committerdrh <>
Sun, 8 Mar 2026 19:36:17 +0000 (19:36 +0000)
while running queries.

FossilOrigin-Name: 96a82dda7a0bb24729c3a3f492d7131fa394dd8fc128de438c7c11217a74611c

ext/misc/completion.c
manifest
manifest.uuid

index 42d78ab86bc913161f3070306cb8495a9fcc2d82..4b0776064dc453b5fbd89d3bb9c78b4cc72b6bb0 100644 (file)
@@ -199,6 +199,7 @@ static int completionNext(sqlite3_vtab_cursor *cur){
   completion_cursor *pCur = (completion_cursor*)cur;
   int eNextPhase = 0;  /* Next phase to try if current phase reaches end */
   int iCol = -1;       /* If >=0, step pCur->pStmt and use the i-th column */
+  int rc;
   pCur->iRowid++;
   while( pCur->ePhase!=COMPLETION_EOF ){
     switch( pCur->ePhase ){
@@ -237,11 +238,14 @@ static int completionNext(sqlite3_vtab_cursor *cur){
             );
             zSep = " UNION ";
           }
-          sqlite3_finalize(pS2);
+          rc = sqlite3_finalize(pS2);
           zSql = sqlite3_str_finish(pStr);
           if( zSql==0 ) return SQLITE_NOMEM;
-          sqlite3_prepare_v2(pCur->db, zSql, -1, &pCur->pStmt, 0);
+          if( rc==SQLITE_OK ){
+            sqlite3_prepare_v2(pCur->db, zSql, -1, &pCur->pStmt, 0);
+          }
           sqlite3_free(zSql);
+          if( rc ) return rc;
         }
         iCol = 0;
         eNextPhase = COMPLETION_COLUMNS;
@@ -265,11 +269,14 @@ static int completionNext(sqlite3_vtab_cursor *cur){
             );
             zSep = " UNION ";
           }
-          sqlite3_finalize(pS2);
+          rc = sqlite3_finalize(pS2);
           zSql = sqlite3_str_finish(pStr);
           if( zSql==0 ) return SQLITE_NOMEM;
-          sqlite3_prepare_v2(pCur->db, zSql, -1, &pCur->pStmt, 0);
+          if( rc==SQLITE_OK ){
+            sqlite3_prepare_v2(pCur->db, zSql, -1, &pCur->pStmt, 0);
+          }
           sqlite3_free(zSql);
+          if( rc ) return rc;
         }
         iCol = 0;
         eNextPhase = COMPLETION_EOF;
@@ -286,9 +293,10 @@ static int completionNext(sqlite3_vtab_cursor *cur){
         pCur->szRow = sqlite3_column_bytes(pCur->pStmt, iCol);
       }else{
         /* When all rows are finished, advance to the next phase */
-        sqlite3_finalize(pCur->pStmt);
+        rc = sqlite3_finalize(pCur->pStmt);
         pCur->pStmt = 0;
         pCur->ePhase = eNextPhase;
+        if( rc ) return rc;
         continue;
       }
     }
index 173efa5c9118b1263a8437b6baef0d025f0a05a3..bfac0a16927e9bf85df5e5e180fe99b62dcac46d 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C In\sthe\sdecimal.c\sextension,\sset\sa\sdefault\sMAX_DIGITS\sto\s100\smillion.\nDo\snot\sallow\sinteger\soverflow\sof\sthe\sN\sparameter\sto\sthe\sinternal\ndecimal_round()\sfunction.
-D 2026-03-08T18:53:10.361
+C Fix\sthe\scompletion.c\sTVF\sso\sthat\sthe\sxNext\smethod\sreports\serrors\sit\sencounters\nwhile\srunning\squeries.
+D 2026-03-08T19:36:17.619
 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
@@ -366,7 +366,7 @@ F ext/misc/blobio.c a867c4c4617f6ec223a307ebfe0eabb45e0992f74dd47722b96f3e631c0e
 F ext/misc/btreeinfo.c 13bc9e9f1c13cde370d0e4a6a2683e9f1926a4cead7fb72c71871b11a06d78a1
 F ext/misc/cksumvfs.c 9d7d0cf1a8893ac5d48922bfe9f3f217b4a61a6265f559263a02bb2001259913
 F ext/misc/closure.c 5559daf1daf742228431db929d1aa86dd535a4224cc634a81d2fd0d1e6ad7839
-F ext/misc/completion.c 99589a9f04113e9a169312d132730131963451a30abd6704d780862333cb091c
+F ext/misc/completion.c fd94e8231bb286a2eef7225368938565162daa72a8e8d06f946cc30ce15bf600
 F ext/misc/compress.c 8191118b9b73e7796c961790db62d35d9b0fb724b045e005a5713dc9e0795565
 F ext/misc/csv.c e82124eabee0e692d7b90ab8b2c34fadbf7b375279f102567fa06e4da4b771bf
 F ext/misc/dbdump.c 678f1b9ae2317b4473f65d03132a2482c3f4b08920799ed80feedd2941a06680
@@ -2189,9 +2189,9 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee
 F tool/warnings.sh d924598cf2f55a4ecbc2aeb055c10bd5f48114793e7ba25f9585435da29e7e98
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
 F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c
-P a334868f27afa7b8efa4e7b1b3a56518309d296a00c81a99eda1f0bac3e57854
-Q +d0e23423d1bdd0482db4b74ef0fde2fbc2bbad02a7b92ba45a27ca57f4740e16
-R bbd0485ce535f1d29eb853167c845c3e
+P a4807bb5f4c81829f5a226f255e9bc505e250e3e66e6103542f83855d7ffef7a
+Q +eebcdcceef8a436e5fb1397cad6eb5bcf0722060fe1cd6acb26cdf1e86f07293
+R 8621c4cb4bd9789ba2d63dfbc0e280cd
 U drh
-Z 6fab010aaa020d4df89b7425b681f3f5
+Z 52cffa55f121c67152b6f2ab59f1b60c
 # Remove this line to create a well-formed Fossil manifest.
index e1c1cc43f416a84b9664a48393229718c830a552..b0a9236bf9331e8cc34a8bf033fedd6094d13b38 100644 (file)
@@ -1 +1 @@
-a4807bb5f4c81829f5a226f255e9bc505e250e3e66e6103542f83855d7ffef7a
+96a82dda7a0bb24729c3a3f492d7131fa394dd8fc128de438c7c11217a74611c