mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Coverage testing of the OP_SeekScan opcode. Fix a problem that comes up when
OP_SeekScan reaches the end of the table. FossilOrigin-Name: 9e57e758a6a33f54d28a546b4eebfb5cfacef30dc4e0207e43bb9d2c06fc3439
This commit is contained in:
35
src/vdbe.c
35
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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user