diff options
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 53 |
1 files changed, 1 insertions, 52 deletions
diff --git a/src/util.c b/src/util.c index 00f20f6dc..637782d38 100644 --- a/src/util.c +++ b/src/util.c @@ -14,7 +14,7 @@ ** This file contains functions for allocating memory, comparing ** strings, and stuff like that. ** -** $Id: util.c,v 1.96 2004/06/02 00:41:10 drh Exp $ +** $Id: util.c,v 1.97 2004/06/06 09:44:05 danielk1977 Exp $ */ #include "sqliteInt.h" #include <stdarg.h> @@ -1056,57 +1056,6 @@ sqlite3GlobCompare(const unsigned char *zPattern, const unsigned char *zString){ } /* -** Compare two UTF-8 strings for equality using the "LIKE" operator of -** SQL. The '%' character matches any sequence of 0 or more -** characters and '_' matches any single character. Case is -** not significant. -** -** This routine is just an adaptation of the sqlite3GlobCompare() -** routine above. -*/ -int -sqlite3LikeCompare(const unsigned char *zPattern, const unsigned char *zString){ - register int c; - int c2; - - while( (c = UpperToLower[*zPattern])!=0 ){ - switch( c ){ - case '%': { - while( (c=zPattern[1]) == '%' || c == '_' ){ - if( c=='_' ){ - if( *zString==0 ) return 0; - sqliteNextChar(zString); - } - zPattern++; - } - if( c==0 ) return 1; - c = UpperToLower[c]; - while( (c2=UpperToLower[*zString])!=0 ){ - while( c2 != 0 && c2 != c ){ c2 = UpperToLower[*++zString]; } - if( c2==0 ) return 0; - if( sqlite3LikeCompare(&zPattern[1],zString) ) return 1; - sqliteNextChar(zString); - } - return 0; - } - case '_': { - if( *zString==0 ) return 0; - sqliteNextChar(zString); - zPattern++; - break; - } - default: { - if( c != UpperToLower[*zString] ) return 0; - zPattern++; - zString++; - break; - } - } - } - return *zString==0; -} - -/* ** Change the sqlite.magic from SQLITE_MAGIC_OPEN to SQLITE_MAGIC_BUSY. ** Return an error (non-zero) if the magic was not SQLITE_MAGIC_OPEN ** when this routine is called. |