aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/where.c20
-rw-r--r--src/whereInt.h4
2 files changed, 9 insertions, 15 deletions
diff --git a/src/where.c b/src/where.c
index 1c2c0931b..aad979921 100644
--- a/src/where.c
+++ b/src/where.c
@@ -1259,7 +1259,7 @@ static void exprAnalyze(
pTerm->u.leftColumn = pLeft->iColumn;
pTerm->eOperator = operatorMask(op) & opMask;
}
- if( op==TK_IS ) pTerm->wtFlags |= TERM_NULLOK;
+ if( op==TK_IS ) pTerm->wtFlags |= TERM_IS;
if( pRight && pRight->op==TK_COLUMN ){
WhereTerm *pNew;
Expr *pDup;
@@ -1284,7 +1284,7 @@ static void exprAnalyze(
pTerm->eOperator |= WO_EQUIV;
eExtraOp = WO_EQUIV;
}
- if( op==TK_IS ) pNew->wtFlags |= TERM_NULLOK;
+ if( op==TK_IS ) pNew->wtFlags |= TERM_IS;
}else{
pDup = pExpr;
pNew = pTerm;
@@ -1475,8 +1475,7 @@ static void exprAnalyze(
** as "x>NULL" if x is not an INTEGER PRIMARY KEY. So construct a
** virtual term of that form.
**
- ** Note that the virtual term must be tagged with both TERM_VNULL
- ** and TERM_NULLOK.
+ ** Note that the virtual term must be tagged with TERM_VNULL.
*/
if( pExpr->op==TK_NOTNULL
&& pExpr->pLeft->op==TK_COLUMN
@@ -1493,7 +1492,7 @@ static void exprAnalyze(
sqlite3PExpr(pParse, TK_NULL, 0, 0, 0), 0);
idxNew = whereClauseInsert(pWC, pNewExpr,
- TERM_VIRTUAL|TERM_DYNAMIC|TERM_VNULL|TERM_NULLOK);
+ TERM_VIRTUAL|TERM_DYNAMIC|TERM_VNULL);
if( idxNew ){
pNewTerm = &pWC->a[idxNew];
pNewTerm->prereqRight = 0;
@@ -2983,10 +2982,7 @@ static int codeAllEqualityTerms(
testcase( pTerm->eOperator & WO_IN );
if( (pTerm->eOperator & (WO_ISNULL|WO_IN))==0 ){
Expr *pRight = pTerm->pExpr->pRight;
- testcase( pTerm->pExpr->op==TK_IS );
- if( (pTerm->wtFlags & TERM_NULLOK)==0
- && sqlite3ExprCanBeNull(pRight)
- ){
+ if( (pTerm->wtFlags & TERM_IS)==0 && sqlite3ExprCanBeNull(pRight) ){
sqlite3VdbeAddOp2(v, OP_IsNull, regBase+j, pLevel->addrBrk);
VdbeCoverage(v);
}
@@ -3635,8 +3631,7 @@ static Bitmask codeOneLoopStart(
Expr *pRight = pRangeStart->pExpr->pRight;
sqlite3ExprCode(pParse, pRight, regBase+nEq);
whereLikeOptimizationStringFixup(v, pLevel, pRangeStart);
- testcase( pRangeStart->pExpr->op==TK_IS );
- if( (pRangeStart->wtFlags & TERM_NULLOK)==0
+ if( (pRangeStart->wtFlags & TERM_VNULL)==0
&& sqlite3ExprCanBeNull(pRight)
){
sqlite3VdbeAddOp2(v, OP_IsNull, regBase+nEq, addrNxt);
@@ -3682,8 +3677,7 @@ static Bitmask codeOneLoopStart(
sqlite3ExprCacheRemove(pParse, regBase+nEq, 1);
sqlite3ExprCode(pParse, pRight, regBase+nEq);
whereLikeOptimizationStringFixup(v, pLevel, pRangeEnd);
- testcase( pRangeEnd->pExpr->op==TK_IS );
- if( (pRangeEnd->wtFlags & TERM_NULLOK)==0
+ if( (pRangeEnd->wtFlags & TERM_VNULL)==0
&& sqlite3ExprCanBeNull(pRight)
){
sqlite3VdbeAddOp2(v, OP_IsNull, regBase+nEq, addrNxt);
diff --git a/src/whereInt.h b/src/whereInt.h
index 915d7b8d6..e7730d71e 100644
--- a/src/whereInt.h
+++ b/src/whereInt.h
@@ -280,7 +280,7 @@ struct WhereTerm {
#define TERM_LIKEOPT 0x100 /* Virtual terms from the LIKE optimization */
#define TERM_LIKECOND 0x200 /* Conditionally this LIKE operator term */
#define TERM_LIKE 0x400 /* The original LIKE operator */
-#define TERM_NULLOK 0x800 /* Comparison operators against NULL work */
+#define TERM_IS 0x800 /* Term.pExpr is an IS operator */
/*
** An instance of the WhereScan object is used as an iterator for locating
@@ -430,7 +430,7 @@ struct WhereInfo {
** particular WhereTerms within a WhereClause.
*/
#define WO_IN 0x001
-#define WO_EQ 0x002
+#define WO_EQ 0x002 /* Used for both == and IS */
#define WO_LT (WO_EQ<<(TK_LT-TK_EQ))
#define WO_LE (WO_EQ<<(TK_LE-TK_EQ))
#define WO_GT (WO_EQ<<(TK_GT-TK_EQ))