diff options
author | drh <drh@noemail.net> | 2009-05-01 21:13:36 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2009-05-01 21:13:36 +0000 |
commit | 24fb627afa360cc7efed23c6ddf1932a85c99b07 (patch) | |
tree | f3c7ecfe0f31f0ad33671e34bebe55f6fb36a3c1 /src/where.c | |
parent | d51397a614dd2b5a20697e6084bc9eae260c49b1 (diff) | |
download | sqlite-24fb627afa360cc7efed23c6ddf1932a85c99b07.tar.gz sqlite-24fb627afa360cc7efed23c6ddf1932a85c99b07.zip |
Record within the Token structure itself whether or not the token has
been dequoted. This steals one bit from the length of a token and
thus limits the size of tokens to 1GiB. (CVS 6589)
FossilOrigin-Name: 12bcb03d9b9e1a31c1a3c67cbb4263cc0af2f3d0
Diffstat (limited to 'src/where.c')
-rw-r--r-- | src/where.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/where.c b/src/where.c index 3f850d6d2..436c24684 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.391 2009/04/29 11:50:54 danielk1977 Exp $ +** $Id: where.c,v 1.392 2009/05/01 21:13:37 drh Exp $ */ #include "sqliteInt.h" @@ -625,6 +625,7 @@ static int isLikeOrGlob( Expr *pRight, *pLeft; /* Right and left size of LIKE operator */ ExprList *pList; /* List of operands to the LIKE operator */ int c; /* One character in z[] */ + int n; /* Length of string z[] */ int cnt; /* Number of non-wildcard prefix characters */ char wc[3]; /* Wildcard characters */ CollSeq *pColl; /* Collating sequence for LHS */ @@ -655,11 +656,13 @@ static int isLikeOrGlob( (pColl->type!=SQLITE_COLL_NOCASE || !*pnoCase) ){ return 0; } - sqlite3DequoteExpr(pRight); - z = (char *)pRight->token.z; + z = (const char*)pRight->token.z; cnt = 0; if( z ){ - while( (c=z[cnt])!=0 && c!=wc[0] && c!=wc[1] && c!=wc[2] ){ cnt++; } + n = pRight->token.n; + while( cnt<n && (c=z[cnt])!=0 && c!=wc[0] && c!=wc[1] && c!=wc[2] ){ + cnt++; + } } if( cnt==0 || 255==(u8)z[cnt-1] ){ return 0; @@ -1160,7 +1163,6 @@ static void exprAnalyze( if( pStr1 ){ sqlite3TokenCopy(db, &pStr1->token, &pRight->token); pStr1->token.n = nPattern; - pStr1->flags = EP_Dequoted; } pStr2 = sqlite3ExprDup(db, pStr1, 0); if( !db->mallocFailed ){ |