Improve the performance of the LIKE operator by using strcspn() to aid
wildcard matching. FossilOrigin-Name: 37284d4e8f501a37c582aa899419a3dfe0932e2a8e2ef2fdf59addd1d3cdacb4
This commit is contained in:
+10
-6
@@ -698,16 +698,20 @@ static int patternCompare(
|
||||
** c or cx.
|
||||
*/
|
||||
if( c<=0x80 ){
|
||||
u32 cx;
|
||||
char zStop[3];
|
||||
int bMatch;
|
||||
if( noCase ){
|
||||
cx = sqlite3Toupper(c);
|
||||
c = sqlite3Tolower(c);
|
||||
zStop[0] = sqlite3Toupper(c);
|
||||
zStop[1] = sqlite3Tolower(c);
|
||||
zStop[2] = 0;
|
||||
}else{
|
||||
cx = c;
|
||||
zStop[0] = c;
|
||||
zStop[1] = 0;
|
||||
}
|
||||
while( (c2 = *(zString++))!=0 ){
|
||||
if( c2!=c && c2!=cx ) continue;
|
||||
while(1){
|
||||
zString += strcspn((const char*)zString, zStop);
|
||||
if( zString[0]==0 ) break;
|
||||
zString++;
|
||||
bMatch = patternCompare(zPattern,zString,pInfo,matchOther);
|
||||
if( bMatch!=SQLITE_NOMATCH ) return bMatch;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user