diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/where.c | 8 | ||||
-rw-r--r-- | src/whereInt.h | 2 | ||||
-rw-r--r-- | src/wherecode.c | 12 |
3 files changed, 8 insertions, 14 deletions
diff --git a/src/where.c b/src/where.c index 00aa5f366..1dbeb0e06 100644 --- a/src/where.c +++ b/src/where.c @@ -5218,13 +5218,7 @@ void sqlite3WhereEnd(WhereInfo *pWInfo){ VdbeCoverageIf(v, pLevel->op==OP_VNext); if( pLevel->regBignull ){ sqlite3VdbeResolveLabel(v, pLevel->addrBignull); - addr = sqlite3VdbeAddOp1(v, OP_If, pLevel->regBignull); - VdbeComment((v, "If NULL-scan done")); - VdbeCoverage(v); - sqlite3VdbeAddOp2(v, OP_Integer, 1, pLevel->regBignull); - sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel->p2-1); - VdbeComment((v, "Do the NULL-scan")); - sqlite3VdbeJumpHere(v, addr); + sqlite3VdbeAddOp2(v, OP_IfNotZero, pLevel->regBignull, pLevel->p2-1); } #ifndef SQLITE_DISABLE_SKIPAHEAD_DISTINCT if( addrSeek ) sqlite3VdbeJumpHere(v, addrSeek); diff --git a/src/whereInt.h b/src/whereInt.h index d1fc3515a..e63ca46d5 100644 --- a/src/whereInt.h +++ b/src/whereInt.h @@ -71,7 +71,7 @@ struct WhereLevel { int addrCont; /* Jump here to continue with the next loop cycle */ int addrFirst; /* First instruction of interior of the loop */ int addrBody; /* Beginning of the body of this loop */ - int regBignull; /* big-null flag reg. True if NULLs not yet scanned */ + int regBignull; /* big-null flag reg. True if a NULL-scan is needed */ int addrBignull; /* Jump here for next part of big-null scan */ #ifndef SQLITE_LIKE_DOESNT_MATCH_BLOBS u32 iLikeRepCntr; /* LIKE range processing counter register (times 2) */ diff --git a/src/wherecode.c b/src/wherecode.c index 12ed0d7af..2aff70554 100644 --- a/src/wherecode.c +++ b/src/wherecode.c @@ -1690,8 +1690,8 @@ Bitmask sqlite3WhereCodeOneLoopStart( sqlite3VdbeAddOp1(v, OP_SeekHit, iIdxCur); } if( regBignull ){ - sqlite3VdbeAddOp2(v, OP_Integer, 0, regBignull); - VdbeComment((v, "NULL-scan flag")); + sqlite3VdbeAddOp2(v, OP_Integer, 1, regBignull); + VdbeComment((v, "NULL-scan needed flag")); } op = aStartOp[(start_constraints<<2) + (startEq<<1) + bRev]; @@ -1776,8 +1776,8 @@ Bitmask sqlite3WhereCodeOneLoopStart( /* Check if the index cursor is past the end of the range. */ if( nConstraint ){ if( regBignull ){ - sqlite3VdbeAddOp2(v, OP_If, regBignull, sqlite3VdbeCurrentAddr(v)+3); - VdbeComment((v, "If in NULL-scan")); + sqlite3VdbeAddOp2(v, OP_IfNot, regBignull, sqlite3VdbeCurrentAddr(v)+3); + VdbeComment((v, "If NULL-scan active")); VdbeCoverage(v); } op = aEndOp[bRev*2 + endEq]; @@ -1788,8 +1788,8 @@ Bitmask sqlite3WhereCodeOneLoopStart( testcase( op==OP_IdxLE ); VdbeCoverageIf(v, op==OP_IdxLE ); } if( regBignull ){ - sqlite3VdbeAddOp2(v, OP_IfNot, regBignull, sqlite3VdbeCurrentAddr(v)+2); - VdbeComment((v, "If not in NULL-scan")); + sqlite3VdbeAddOp2(v, OP_If, regBignull, sqlite3VdbeCurrentAddr(v)+2); + VdbeComment((v, "If NULL-scan pending")); VdbeCoverage(v); if( bStopAtNull ){ op = aEndOp[bRev*2 + 0]; |