]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Further simplification of the EXPLAIN logic. Fix the test errors from
authordrh <drh@noemail.net>
Fri, 20 Mar 2020 17:49:37 +0000 (17:49 +0000)
committerdrh <drh@noemail.net>
Fri, 20 Mar 2020 17:49:37 +0000 (17:49 +0000)
the previous check-in.

FossilOrigin-Name: 5eaba9af1c35ea7b7c08cad7d0d9b5a4b63b11b3177bb84a570ce1cea44b9f57

manifest
manifest.uuid
src/vdbeaux.c

index b7a88540071c8d90c3ea7e2b9282533b7f48c8f7..d8366c29dd89f8a885f7cdfd1840aedea00a3459 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Revamp\sthe\sEXPLAIN\sinfrastructure\sto\sfacilitate\ssqlite3_stmt_mode().\s\sThe\ncurrently\scode\smostly\sworks,\sbut\sthere\sare\stest\sfailures.\s\sThis\sis\san\nincremental\scheck-in.
-D 2020-03-20T16:13:41.030
+C Further\ssimplification\sof\sthe\sEXPLAIN\slogic.\s\sFix\sthe\stest\serrors\sfrom\nthe\sprevious\scheck-in.
+D 2020-03-20T17:49:37.174
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -607,7 +607,7 @@ F src/vdbe.c b7b9ec1d604a12f4cafedf796027a297bc306f0d3afb340948898256cb4473b9
 F src/vdbe.h 51282fbe819ee0e8eeeaab176240860d334c20a12b14f3b363e7f1a4e05d60b9
 F src/vdbeInt.h 1a8807b7dfac4142f5b9047767295327be41f02c17f7bb6bd8ffef6219dac588
 F src/vdbeapi.c d840fb3b80bbbd25fd44e1bb2d4a209e297832f527d21ea718fa53502a2a2d97
-F src/vdbeaux.c 734cb197ffdf83322832f9c881e9841b43b27f43677b8c75ad444cd2ccee2802
+F src/vdbeaux.c 0ae1d7dbe395dcccbc749265988f39bc635d2a667abc5080618232ea71cb111a
 F src/vdbeblob.c 253ed82894924c362a7fa3079551d3554cd1cdace39aa833da77d3bc67e7c1b1
 F src/vdbemem.c 39b942ecca179f4f30a32b54579a85d74ccaefa5af2a0ad2700abe5ef0768b22
 F src/vdbesort.c 2be76d26998ce2b3324cdcc9f6443728e54b6c7677c553ad909c7d7cfab587df
@@ -1860,7 +1860,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 3cf7537b5e14e218218b18b3c0c668c950a71fcddc68a5faf0f197519718a6c2
-R 858f863db42629ad352a7a54d45b01f7
+P e9e17e2125dbbafd5da4adb3bd2893735fa4d0aaa5f3daee75f866cb32231a8d
+R 362bcd5e9bfbbf8f55dfb0975381a17c
 U drh
-Z acdb8ce72295d433409d053ae8da03ad
+Z 6ca8b6a14af1a859b37a7675560dfe61
index ce65b1e44e2cfe0ec7a5d4c7034122da865c637e..19ef35b09125d54a9c09b345264686cab8e81517 100644 (file)
@@ -1 +1 @@
-e9e17e2125dbbafd5da4adb3bd2893735fa4d0aaa5f3daee75f866cb32231a8d
\ No newline at end of file
+5eaba9af1c35ea7b7c08cad7d0d9b5a4b63b11b3177bb84a570ce1cea44b9f57
\ No newline at end of file
index d5f2a3b094662cee9b15c9f04c5e51ef6ee0d1b5..676ca93e330cd3f66d3dedd013cbe2aa45bbf566 100644 (file)
@@ -2053,8 +2053,6 @@ int sqlite3VdbeList(
     return SQLITE_ERROR;
   }
   pMem += VDBE_EXPLAIN_COLS;
-  releaseMemArray(pMem, VDBE_EXPLAIN_COLS);
-  p->pResultSet = pMem;
   p->nRes = 0;
 
   if( p->rc==SQLITE_NOMEM ){
@@ -2074,7 +2072,6 @@ int sqlite3VdbeList(
   nRow = p->nOp;
   if( bListSubprogs ){
     pSub = pMem++;
-    p->pResultSet = pMem;
     if( pSub->flags&MEM_Blob ){
       /* On the first call to sqlite3_step(), pSub will hold a NULL.  It is
       ** initialized to a BLOB by the P4_SUBPROGRAM processing logic below */
@@ -2085,6 +2082,7 @@ int sqlite3VdbeList(
       nRow += apSub[i]->nOp;
     }
   }
+  p->pResultSet = pMem;
 
   while(1){  /* Loop exits via break */
     i = p->pc++;
@@ -2130,7 +2128,7 @@ int sqlite3VdbeList(
         }
         apSub = (SubProgram **)pSub->z;
         apSub[nSub++] = pOp->p4.pProgram;
-        pSub->flags |= MEM_Blob;
+        MemSetTypeFlag(pSub, MEM_Blob);
         pSub->n = nSub*sizeof(SubProgram*);
         nRow += pOp->p4.pProgram->nOp;
       }
@@ -2148,29 +2146,13 @@ int sqlite3VdbeList(
     }else{
       char *zP4;
       if( p->explain==SQLITE_STMTMODE_EXPLAIN ){
-        pMem->flags = MEM_Int;
-        pMem->u.i = i;                                /* Program counter */
-        pMem++;
-    
-        pMem->flags = MEM_Static|MEM_Str|MEM_Term;
-        pMem->z = (char*)sqlite3OpcodeName(pOp->opcode); /* Opcode */
-        assert( pMem->z!=0 );
-        pMem->n = sqlite3Strlen30(pMem->z);
-        pMem->enc = SQLITE_UTF8;
-        pMem++;
+        sqlite3VdbeMemSetInt64(pMem++, i);            /* Program counter */
+        sqlite3VdbeMemSetStr(pMem++, (char*)sqlite3OpcodeName(pOp->opcode),
+                             -1, SQLITE_UTF8, SQLITE_STATIC);    
       }
-
-      pMem->flags = MEM_Int;
-      pMem->u.i = pOp->p1;                          /* P1 */
-      pMem++;
-
-      pMem->flags = MEM_Int;
-      pMem->u.i = pOp->p2;                          /* P2 */
-      pMem++;
-
-      pMem->flags = MEM_Int;
-      pMem->u.i = pOp->p3;                          /* P3 */
-      pMem++;
+      sqlite3VdbeMemSetInt64(pMem++, pOp->p1);       /* P1 */
+      sqlite3VdbeMemSetInt64(pMem++, pOp->p2);       /* P2 */
+      sqlite3VdbeMemSetInt64(pMem++, pOp->p3);       /* P3 */
 
       if( sqlite3VdbeMemClearAndResize(pMem, 100) ){ /* P4 */
         assert( p->db->mallocFailed );