aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vdbe.c35
-rw-r--r--src/wherecode.c2
2 files changed, 28 insertions, 9 deletions
diff --git a/src/vdbe.c b/src/vdbe.c
index dacda1507..3b5266246 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -4477,28 +4477,47 @@ case OP_SeekScan: {
rc = sqlite3VdbeIdxKeyCompare(db, pC, &r, &res);
if( rc ) goto abort_due_to_error;
if( res>0 ){
+ seekscan_search_fail:
#ifdef SQLITE_DEBUG
- if( db->flags&SQLITE_VdbeTrace ){
- printf("... %d steps and then skip\n", pOp->p1 - n);
- }
+ if( db->flags&SQLITE_VdbeTrace ){
+ printf("... %d steps and then skip\n", pOp->p1 - n);
+ }
#endif
pOp++;
+ VdbeBranchTaken(1,3);
goto jump_to_p2;
}
if( res==0 ){
#ifdef SQLITE_DEBUG
- if( db->flags&SQLITE_VdbeTrace ){
- printf("... %d steps and then success\n", pOp->p1 - n);
- }
+ if( db->flags&SQLITE_VdbeTrace ){
+ printf("... %d steps and then success\n", pOp->p1 - n);
+ }
#endif
pOp += 2;
+ VdbeBranchTaken(2,3);
+ break;
+ }
+ if( n<=0 ){
+#ifdef SQLITE_DEBUG
+ if( db->flags&SQLITE_VdbeTrace ){
+ printf("... fall through after %d steps\n", pOp->p1);
+ }
+#endif
+ VdbeBranchTaken(0,3);
break;
}
- if( n<=0 ) break;
n--;
rc = sqlite3BtreeNext(pC->uc.pCursor, 0);
- if( rc ) goto abort_due_to_error;
+ if( rc ){
+ if( rc==SQLITE_DONE ){
+ rc = SQLITE_OK;
+ goto seekscan_search_fail;
+ }else{
+ goto abort_due_to_error;
+ }
+ }
}
+
break;
}
diff --git a/src/wherecode.c b/src/wherecode.c
index 4e10c79d8..9dbc1d4b0 100644
--- a/src/wherecode.c
+++ b/src/wherecode.c
@@ -1807,7 +1807,7 @@ Bitmask sqlite3WhereCodeOneLoopStart(
if( (pLoop->wsFlags & WHERE_IN_SEEKSCAN)!=0 ){
assert( op==OP_SeekGE );
assert( regBignull==0 );
- sqlite3VdbeAddOp1(v, OP_SeekScan, 10);
+ sqlite3VdbeAddOp1(v, OP_SeekScan, 10); VdbeCoverage(v);
}
sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint);
VdbeCoverage(v);