aboutsummaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authordanielk1977 <danielk1977@noemail.net>2004-06-06 09:44:03 +0000
committerdanielk1977 <danielk1977@noemail.net>2004-06-06 09:44:03 +0000
commitd02eb1fdf4b939e4065d13a64c7c38afda443826 (patch)
treeeaa8c797fe0e44eeb81ce6761c5b5bb2fe35ef8a /src/util.c
parent51c6d9633f52eb6d06b0291005d1a0b5fd552bd9 (diff)
downloadsqlite-d02eb1fdf4b939e4065d13a64c7c38afda443826.tar.gz
sqlite-d02eb1fdf4b939e4065d13a64c7c38afda443826.zip
Enhance user function API to support association of meta-data with constant
arguments and the specification of text encoding preference. The LIKE operator takes advantage of both. (CVS 1534) FossilOrigin-Name: 92337d8f79b9754cd61c73e7db2e792a1f482f50
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c53
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.