]> 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:31:40 +0000 (19:31 +0000)
committerdrh <>
Sun, 8 Mar 2026 19:31:40 +0000 (19:31 +0000)
while running queries.

FossilOrigin-Name: eebcdcceef8a436e5fb1397cad6eb5bcf0722060fe1cd6acb26cdf1e86f07293

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 219dbd8253550e6cc28f3f255307406386e03de8..9c226cd52eafe55c5a75b6cc2b75ab89095a26b0 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:50:35.538
+C Fix\sthe\scompletion.c\sTVF\sso\sthat\sthe\sxNext\smethod\sreports\serrors\sit\sencounters\nwhile\srunning\squeries.
+D 2026-03-08T19:31:40.426
 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
@@ -2192,8 +2192,8 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee
 F tool/warnings.sh d924598cf2f55a4ecbc2aeb055c10bd5f48114793e7ba25f9585435da29e7e98
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
 F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c
-P 77846c8c7aa4625729a5e113c12e7d16efc88c1306c01ba36f47240aac450b0f
-R a756ed3fd63cf7cc47a1e12edb8d7d54
+P d0e23423d1bdd0482db4b74ef0fde2fbc2bbad02a7b92ba45a27ca57f4740e16
+R 696b1859587bbdaa9b360e1479bf8272
 U drh
-Z d8105cfe6e2ec1bd1dccf656d79dfdcd
+Z 3bd2617ab7e2ff87d1210b38e63ada46
 # Remove this line to create a well-formed Fossil manifest.
index 931d97373496a5e9bea5124075ef0d89c2616323..5e2af7fe72cae2066982205dc5679a43a9579829 100644 (file)
@@ -1 +1 @@
-d0e23423d1bdd0482db4b74ef0fde2fbc2bbad02a7b92ba45a27ca57f4740e16
+eebcdcceef8a436e5fb1397cad6eb5bcf0722060fe1cd6acb26cdf1e86f07293