]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Avoid calling sqlite3VdbeCursorMoveto() from more than one point in vdbe.c. Doing... onepass-delete
authordan <dan@noemail.net>
Mon, 14 Sep 2015 09:23:47 +0000 (09:23 +0000)
committerdan <dan@noemail.net>
Mon, 14 Sep 2015 09:23:47 +0000 (09:23 +0000)
FossilOrigin-Name: 166d5af8914c6954fb24a06e9686f194c0d0acde

manifest
manifest.uuid
src/vdbe.c
src/wherecode.c

index 782e7b6568e04a65b81078d4fc49bf5465cded85..892c86e00d1d06b63ab53edd9ae77f579a8b2f57 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\scompiler\swarnings\sin\sdelete.c.
-D 2015-09-12T19:50:58.177
+C Avoid\scalling\ssqlite3VdbeCursorMoveto()\sfrom\smore\sthan\sone\spoint\sin\svdbe.c.\sDoing\sso\sprevents\sit\sfrom\sbeing\sinlined\sas\spart\sof\sOP_Column.
+D 2015-09-14T09:23:47.876
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in f85066ce844a28b671aaeeff320921cd0ce36239
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -403,7 +403,7 @@ F src/update.c eb7ab3ff2928628692a4f14be397c95f4a681d97
 F src/utf.c fc6b889ba0779b7722634cdeaa25f1930d93820c
 F src/util.c fc612367108b74573c5fd13a85d0a23027f438bd
 F src/vacuum.c 2ddd5cad2a7b9cef7f9e431b8c7771634c6b1701
-F src/vdbe.c 5587d76bd5a4fb4f7ca023f161a6c6adbb1de26c
+F src/vdbe.c a8a5cb1126bf79104e00326abd6a7d22ac3bc4c3
 F src/vdbe.h 4bc88bd0e06f8046ee6ab7487c0015e85ad949ad
 F src/vdbeInt.h 8b867eac234e28627ffcace3cd4b4b79bbec664b
 F src/vdbeapi.c 0d890f57caf143b114a95ce699e59af51359c508
@@ -419,7 +419,7 @@ F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
 F src/walker.c 2e14d17f592d176b6dc879c33fbdec4fbccaa2ba
 F src/where.c 98cbedead64380fc26a098350f43d92237c8fa17
 F src/whereInt.h 292d3ac90da4eab1e03ac8452f1add746bcafaa1
-F src/wherecode.c 6ac8599523f4840d9efac335329f627ebf3f79fd
+F src/wherecode.c 780cccf12a07ddc1ea0c6f6eb95895a3d8f79a6e
 F src/whereexpr.c 2473e4350e30f9b55d1c6a8f66ca23c689f23f1d
 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
 F test/affinity2.test a6d901b436328bd67a79b41bb0ac2663918fe3bd
@@ -1387,7 +1387,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P eaeb2b80f6f8f83679c8323a81bb39570ec946fe
-R eb15fa201d3086c36456da6232a12264
+P 0a4d285e18b78cd529483ba5c8c607ab62a443d4
+R 96a467fbd50feb4126a3810f2f5f97d3
 U dan
-Z 7f9a5cfb9accd4d1fdad39fe13d7d9ec
+Z 9af565931700230812c8ce5da8bff453
index 717bd41b6c531cf71bab0325026fde49fa1b3118..40f469b0aa78c54db6d020ca5d4e373c6495258e 100644 (file)
@@ -1 +1 @@
-0a4d285e18b78cd529483ba5c8c607ab62a443d4
\ No newline at end of file
+166d5af8914c6954fb24a06e9686f194c0d0acde
\ No newline at end of file
index fc0884b5be3bf34c7856b42260295c5d2ef91418..0d1035e5a0f6ad808f197542f86bf033b68465f2 100644 (file)
@@ -3968,9 +3968,10 @@ case OP_Found: {        /* jump, in3 */
 **
 ** P1 is the index of a cursor open on an SQL table btree (with integer
 ** keys).  P3 is an integer rowid.  If P1 does not contain a record with
-** rowid P3 then jump immediately to P2.  If P1 does contain a record
-** with rowid P3 then leave the cursor pointing at that record and fall
-** through to the next instruction.
+** rowid P3 then jump immediately to P2.  Or, if P2 is 0, raise an
+** SQLITE_CORRUPT error. If P1 does contain a record with rowid P3 then 
+** leave the cursor pointing at that record and fall through to the next
+** instruction.
 **
 ** The OP_NotFound opcode performs the same operation on index btrees
 ** (with arbitrary multi-value keys).
@@ -4008,7 +4009,10 @@ case OP_NotExists: {        /* jump, in3 */
   pC->deferredMoveto = 0;
   VdbeBranchTaken(res!=0,2);
   pC->seekResult = res;
-  if( res!=0 ) goto jump_to_p2;
+  if( res!=0 ){
+    if( pOp->p2==0 && rc==SQLITE_OK ) rc = SQLITE_CORRUPT_BKPT;
+    goto jump_to_p2;
+  }
   break;
 }
 
@@ -4302,11 +4306,9 @@ case OP_Delete: {
   pC = p->apCsr[pOp->p1];
   assert( pC!=0 );
   assert( pC->pCursor!=0 );  /* Only valid for real tables, no pseudotables */
+  assert( pC->deferredMoveto==0 );
 
-  if( pC->deferredMoveto ){
-    rc = sqlite3VdbeCursorMoveto(pC);
-    if( rc!=SQLITE_OK ) goto abort_due_to_error;
-  }else if( pOp->p5 && db->xUpdateCallback && pOp->p4.z && pC->isTable ){
+  if( pOp->p5 && db->xUpdateCallback && pOp->p4.z && pC->isTable ){
     sqlite3BtreeKeySize(pC->pCursor, &pC->movetoTarget);
   }
 
index ecf3d3e7c46d1ff2035a49c24240642796790e27..09a4a4136885fc74869401f440cb2bb0f67abeed 100644 (file)
@@ -1069,7 +1069,11 @@ Bitmask sqlite3WhereCodeOneLoopStart(
       iRowidReg = ++pParse->nMem;
       sqlite3VdbeAddOp2(v, OP_IdxRowid, iIdxCur, iRowidReg);
       sqlite3ExprCacheStore(pParse, iCur, -1, iRowidReg);
-      sqlite3VdbeAddOp2(v, OP_Seek, iCur, iRowidReg);  /* Deferred seek */
+      if( pWInfo->okOnePass ){
+        sqlite3VdbeAddOp3(v, OP_NotExists, iCur, 0, iRowidReg);
+      }else{
+        sqlite3VdbeAddOp2(v, OP_Seek, iCur, iRowidReg);  /* Deferred seek */
+      }
     }else if( iCur!=iIdxCur ){
       Index *pPk = sqlite3PrimaryKeyIndex(pIdx->pTable);
       iRowidReg = sqlite3GetTempRange(pParse, pPk->nKeyCol);