diff options
author | drh <drh@noemail.net> | 2014-09-25 00:56:00 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2014-09-25 00:56:00 +0000 |
commit | 328d913cbdb3aac68c244abbf433ef318f4593a4 (patch) | |
tree | fd096ec7bdd7d9e1b9d3aa68433b5cdbd9fd3258 /src/func.c | |
parent | 3fbb022b98a05d985571a188003f3dd1fb2b94a5 (diff) | |
download | sqlite-328d913cbdb3aac68c244abbf433ef318f4593a4.tar.gz sqlite-328d913cbdb3aac68c244abbf433ef318f4593a4.zip |
Size reduction and performance improvement in the LIKE and GLOB operators.
FossilOrigin-Name: b2c89ef49cd19b8031a8149a2dc47cea07dd04e0
Diffstat (limited to 'src/func.c')
-rw-r--r-- | src/func.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/func.c b/src/func.c index e1961118f..fc908ded3 100644 --- a/src/func.c +++ b/src/func.c @@ -622,10 +622,9 @@ static int patternCompare( u8 matchAll = pInfo->matchAll; u8 matchSet = pInfo->matchSet; u8 noCase = pInfo->noCase; - int prevEscape = 0; /* True if the previous character was 'escape' */ while( (c = sqlite3Utf8Read(&zPattern))!=0 ){ - if( c==matchAll && !prevEscape ){ + if( c==matchAll ){ while( (c=sqlite3Utf8Read(&zPattern)) == matchAll || c == matchOne ){ if( c==matchOne && sqlite3Utf8Read(&zString)==0 ){ @@ -664,7 +663,7 @@ static int patternCompare( if( patternCompare(zPattern,zString,pInfo,esc) ) return 1; } return 0; - }else if( c==matchOne && !prevEscape ){ + }else if( c==matchOne ){ if( sqlite3Utf8Read(&zString)==0 ){ return 0; } @@ -700,10 +699,11 @@ static int patternCompare( if( c2==0 || (seen ^ invert)==0 ){ return 0; } - }else if( esc==c && !prevEscape ){ - prevEscape = 1; }else{ c2 = sqlite3Utf8Read(&zString); + if( c==esc ){ + c = sqlite3Utf8Read(&zPattern); + } if( noCase ){ GlobUpperToLower(c); GlobUpperToLower(c2); @@ -711,7 +711,6 @@ static int patternCompare( if( c!=c2 ){ return 0; } - prevEscape = 0; } } return *zString==0; |