Performance optimization and comment fixes for the LIKE and GLOB operators.
FossilOrigin-Name: c89d772628564a808173f6f73bc1798ec714276b
This commit is contained in:
parent
c5b41ac8ee
commit
b0870486aa
12
manifest
12
manifest
@ -1,5 +1,5 @@
|
||||
C Make\sgetCellInfo()\sa\sreal\sfunction\sinstead\sof\sa\smacro,\sfor\sa\ssize\sreduction\nand\sa\s0.2%\sperformance\sgain.
|
||||
D 2015-06-17T02:11:46.631
|
||||
C Performance\soptimization\sand\scomment\sfixes\sfor\sthe\sLIKE\sand\sGLOB\soperators.
|
||||
D 2015-06-17T13:20:54.580
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in 1063c58075b7400d93326b0eb332b48a54f53025
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
@ -205,7 +205,7 @@ F src/delete.c 8857a6f27560718f65d43bdbec86c967ae1f8dfa
|
||||
F src/expr.c fbde754df3fa10bbd3a1dcea08e77b0f1684d188
|
||||
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
|
||||
F src/fkey.c c9b63a217d86582c22121699a47f22f524608869
|
||||
F src/func.c 5b8b8e77a0fb644eaf8947d413804622e32692b6
|
||||
F src/func.c a98ea5880dc50e9ca6dd6f57079a37b9cfcdecf1
|
||||
F src/global.c 4f77cadbc5427d00139ba43d0f3979804cbb700e
|
||||
F src/hash.c 4263fbc955f26c2e8cdc0cf214bc42435aa4e4f5
|
||||
F src/hash.h c8f3c31722cf3277d03713909761e152a5b81094
|
||||
@ -1286,7 +1286,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
P 66d033b9c9a8c16b9a342be0b325bd85b8487c03
|
||||
R b009f7bdded8eda946c7f086260f521c
|
||||
P 55c393ea14197ae5fa56ebca7a47e7d980511fa7
|
||||
R 1acc9fb214636b090a14b1a72649aa22
|
||||
U drh
|
||||
Z e2dd593dbc0c1057f97a55b340af2663
|
||||
Z f92b296584755a34dfd3307b30aabfde
|
||||
|
@ -1 +1 @@
|
||||
55c393ea14197ae5fa56ebca7a47e7d980511fa7
|
||||
c89d772628564a808173f6f73bc1798ec714276b
|
23
src/func.c
23
src/func.c
@ -575,17 +575,15 @@ struct compareInfo {
|
||||
|
||||
/*
|
||||
** For LIKE and GLOB matching on EBCDIC machines, assume that every
|
||||
** character is exactly one byte in size. Also, all characters are
|
||||
** able to participate in upper-case-to-lower-case mappings in EBCDIC
|
||||
** whereas only characters less than 0x80 do in ASCII.
|
||||
** character is exactly one byte in size. Also, provde the Utf8Read()
|
||||
** macro for fast reading of the next character in the common case where
|
||||
** the next character is ASCII.
|
||||
*/
|
||||
#if defined(SQLITE_EBCDIC)
|
||||
# define sqlite3Utf8Read(A) (*((*A)++))
|
||||
# define GlobUpperToLower(A) A = sqlite3UpperToLower[A]
|
||||
# define GlobUpperToLowerAscii(A) A = sqlite3UpperToLower[A]
|
||||
# define Utf8Read(A) (*(A++))
|
||||
#else
|
||||
# define GlobUpperToLower(A) if( A<=0x7f ){ A = sqlite3UpperToLower[A]; }
|
||||
# define GlobUpperToLowerAscii(A) A = sqlite3UpperToLower[A]
|
||||
# define Utf8Read(A) (A[0]<0x80?*(A++):sqlite3Utf8Read(&A))
|
||||
#endif
|
||||
|
||||
static const struct compareInfo globInfo = { '*', '?', '[', 0 };
|
||||
@ -627,7 +625,7 @@ static const struct compareInfo likeInfoAlt = { '%', '_', 0, 0 };
|
||||
** Ec Where E is the "esc" character and c is any other
|
||||
** character, including '%', '_', and esc, match exactly c.
|
||||
**
|
||||
** The comments through this routine usually assume glob matching.
|
||||
** The comments within this routine usually assume glob matching.
|
||||
**
|
||||
** This routine is usually quick, but can be N**2 in the worst case.
|
||||
*/
|
||||
@ -651,13 +649,12 @@ static int patternCompare(
|
||||
*/
|
||||
matchOther = esc ? esc : pInfo->matchSet;
|
||||
|
||||
while( (c = sqlite3Utf8Read(&zPattern))!=0 ){
|
||||
while( (c = Utf8Read(zPattern))!=0 ){
|
||||
if( c==matchAll ){ /* Match "*" */
|
||||
/* Skip over multiple "*" characters in the pattern. If there
|
||||
** are also "?" characters, skip those as well, but consume a
|
||||
** single character of the input string for each "?" skipped */
|
||||
while( (c=sqlite3Utf8Read(&zPattern)) == matchAll
|
||||
|| c == matchOne ){
|
||||
while( (c=Utf8Read(zPattern)) == matchAll || c == matchOne ){
|
||||
if( c==matchOne && sqlite3Utf8Read(&zString)==0 ){
|
||||
return 0;
|
||||
}
|
||||
@ -702,7 +699,7 @@ static int patternCompare(
|
||||
if( patternCompare(zPattern,zString,pInfo,esc) ) return 1;
|
||||
}
|
||||
}else{
|
||||
while( (c2 = sqlite3Utf8Read(&zString))!=0 ){
|
||||
while( (c2 = Utf8Read(zString))!=0 ){
|
||||
if( c2!=c ) continue;
|
||||
if( patternCompare(zPattern,zString,pInfo,esc) ) return 1;
|
||||
}
|
||||
@ -748,7 +745,7 @@ static int patternCompare(
|
||||
continue;
|
||||
}
|
||||
}
|
||||
c2 = sqlite3Utf8Read(&zString);
|
||||
c2 = Utf8Read(zString);
|
||||
if( c==c2 ) continue;
|
||||
if( noCase && c<0x80 && c2<0x80 && sqlite3Tolower(c)==sqlite3Tolower(c2) ){
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user