diff options
author | drh <drh@noemail.net> | 2016-02-25 18:54:30 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2016-02-25 18:54:30 +0000 |
commit | d3e1af4aa04113b379050119e0015ada3078cc4e (patch) | |
tree | d12ed8d1907415a474cf321b76498befd1312fc9 /src/wherecode.c | |
parent | 7f219fad58bb84f5e856134a7b6909c8c0482c9b (diff) | |
parent | eecb80e77e3556e9373237eff6ab0a8dad7eb5fb (diff) | |
download | sqlite-d3e1af4aa04113b379050119e0015ada3078cc4e.tar.gz sqlite-d3e1af4aa04113b379050119e0015ada3078cc4e.zip |
Merge all the latest changes from trunk.
FossilOrigin-Name: b86590043e17705ada90562cf30f69b3e3ef65a4
Diffstat (limited to 'src/wherecode.c')
-rw-r--r-- | src/wherecode.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/wherecode.c b/src/wherecode.c index bb48e5dc7..accc14086 100644 --- a/src/wherecode.c +++ b/src/wherecode.c @@ -1212,16 +1212,22 @@ Bitmask sqlite3WhereCodeOneLoopStart( start_constraints = 1; } codeApplyAffinity(pParse, regBase, nConstraint - bSeekPastNull, zStartAff); - op = aStartOp[(start_constraints<<2) + (startEq<<1) + bRev]; - assert( op!=0 ); - sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint); - VdbeCoverage(v); - VdbeCoverageIf(v, op==OP_Rewind); testcase( op==OP_Rewind ); - VdbeCoverageIf(v, op==OP_Last); testcase( op==OP_Last ); - VdbeCoverageIf(v, op==OP_SeekGT); testcase( op==OP_SeekGT ); - VdbeCoverageIf(v, op==OP_SeekGE); testcase( op==OP_SeekGE ); - VdbeCoverageIf(v, op==OP_SeekLE); testcase( op==OP_SeekLE ); - VdbeCoverageIf(v, op==OP_SeekLT); testcase( op==OP_SeekLT ); + if( pLoop->nSkip>0 && nConstraint==pLoop->nSkip ){ + /* The skip-scan logic inside the call to codeAllEqualityConstraints() + ** above has already left the cursor sitting on the correct row, + ** so no further seeking is needed */ + }else{ + op = aStartOp[(start_constraints<<2) + (startEq<<1) + bRev]; + assert( op!=0 ); + sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint); + VdbeCoverage(v); + VdbeCoverageIf(v, op==OP_Rewind); testcase( op==OP_Rewind ); + VdbeCoverageIf(v, op==OP_Last); testcase( op==OP_Last ); + VdbeCoverageIf(v, op==OP_SeekGT); testcase( op==OP_SeekGT ); + VdbeCoverageIf(v, op==OP_SeekGE); testcase( op==OP_SeekGE ); + VdbeCoverageIf(v, op==OP_SeekLE); testcase( op==OP_SeekLE ); + VdbeCoverageIf(v, op==OP_SeekLT); testcase( op==OP_SeekLT ); + } /* Load the value for the inequality constraint at the end of the ** range (if any). |