diff options
Diffstat (limited to 'src/where.c')
-rw-r--r-- | src/where.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/where.c b/src/where.c index 4e355e802..3e59338ec 100644 --- a/src/where.c +++ b/src/where.c @@ -16,7 +16,7 @@ ** so is applicable. Because this module is responsible for selecting ** indices, you might also think of this module as the "query optimizer". ** -** $Id: where.c,v 1.165 2005/08/24 03:52:19 drh Exp $ +** $Id: where.c,v 1.166 2005/08/28 17:00:25 drh Exp $ */ #include "sqliteInt.h" @@ -479,8 +479,11 @@ static int isLikeOrGlob( Expr *pRight, *pLeft; ExprList *pList; int c, cnt; + int noCase; char wc[3]; - if( !sqlite3IsLikeFunction(db, pExpr, wc) ){ + CollSeq *pColl; + + if( !sqlite3IsLikeFunction(db, pExpr, &noCase, wc) ){ return 0; } pList = pExpr->pList; @@ -492,6 +495,14 @@ static int isLikeOrGlob( if( pLeft->op!=TK_COLUMN ){ return 0; } + pColl = pLeft->pColl; + if( pColl==0 ){ + pColl = db->pDfltColl; + } + if( (pColl->type!=SQLITE_COLL_BINARY || noCase) && + (pColl->type!=SQLITE_COLL_NOCASE || !noCase) ){ + return 0; + } sqlite3DequoteExpr(pRight); z = pRight->token.z; for(cnt=0; (c=z[cnt])!=0 && c!=wc[0] && c!=wc[1] && c!=wc[2]; cnt++){} |