]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Get the LIKE and GLOB operators working again on systems using the
authordrh <drh@noemail.net>
Fri, 7 Dec 2007 18:39:04 +0000 (18:39 +0000)
committerdrh <drh@noemail.net>
Fri, 7 Dec 2007 18:39:04 +0000 (18:39 +0000)
EBCDIC character set. (CVS 4597)

FossilOrigin-Name: 754298a74e3d889f3767daba058262613d20a601

manifest
manifest.uuid
src/func.c

index 6c005e81734d6f52fc9ce4c52c758b7a7766510d..eb084eb06c55cc65ace349c610eef2ea3d0913d8 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\sleaking\sdatabase\sconnection\sin\sthe\svacuum2\stest\sscript.\nTicket\s#2827.\s(CVS\s4596)
-D 2007-12-06T17:41:28
+C Get\sthe\sLIKE\sand\sGLOB\soperators\sworking\sagain\son\ssystems\susing\sthe\nEBCDIC\scharacter\sset.\s(CVS\s4597)
+D 2007-12-07T18:39:05
 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
 F Makefile.in 30789bf70614bad659351660d76b8e533f3340e9
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -93,7 +93,7 @@ F src/date.c 49c5a6d2de6c12000905b4d36868b07d3011bbf6
 F src/delete.c 034b87768c4135a22038a86a205f9d2d5f68a143
 F src/experimental.c 1b2d1a6cd62ecc39610e97670332ca073c50792b
 F src/expr.c 8c32309dedd13b8ab220348eb90dc221ee0a5174
-F src/func.c 49f98cfe26b9ab507b96a34404295c4d89dfc620
+F src/func.c a8548fbc55373505c077cfb57baa43c1e48b71d2
 F src/hash.c 45a7005aac044b6c86bd7e49c44bc15d30006d6c
 F src/hash.h 031cd9f915aff27e12262cb9eb570ac1b8326b53
 F src/insert.c a090c7258f2be707cca8f0cf376142f141621241
@@ -597,7 +597,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P f015a38771d98996366d66787b9b066f9ef5e248
-R e9e837a4042d6084a729569c423b2c7a
+P f29deb5f0bfcd6d00795aeb66dece717a6c1768a
+R 914411460f2d77a89cfca0420655917f
 U drh
-Z 08cf3b638db479f84c486346a51305c0
+Z dab0e24c447ca0aa1c74119b9b014915
index dfbc1eb42266390f6c0ec8651b2362be9a27de26..be5d794c22bc3c1f048310d364dc159563b97a5b 100644 (file)
@@ -1 +1 @@
-f29deb5f0bfcd6d00795aeb66dece717a6c1768a
\ No newline at end of file
+754298a74e3d889f3767daba058262613d20a601
\ No newline at end of file
index 6bf4ed1f8d2c566fdecafc1908a9debdadb20dcb..b64454e207b8c173f403629b0efd373300b91291 100644 (file)
@@ -16,7 +16,7 @@
 ** sqliteRegisterBuildinFunctions() found at the bottom of the file.
 ** All other code has file scope.
 **
-** $Id: func.c,v 1.177 2007/11/28 22:36:41 drh Exp $
+** $Id: func.c,v 1.178 2007/12/07 18:39:05 drh Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -405,6 +405,19 @@ struct compareInfo {
   u8 noCase;
 };
 
+/*
+** 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.
+*/
+#if defined(SQLITE_EBCDIC)
+# define sqlite3Utf8Read(A,B,C)  (*(A++))
+# define UpperToLower(A)         A = sqlite3UpperToLower[A]
+#else
+# define UpperToLower(A)         if( A<0x80 ){ A = sqlite3UpperToLower[A]; }
+#endif
+
 static const struct compareInfo globInfo = { '*', '?', '[', 0 };
 /* The correct SQL-92 behavior is for the LIKE operator to ignore
 ** case.  Thus  'a' LIKE 'A' would be true. */
@@ -481,11 +494,11 @@ static int patternCompare(
       }
       while( (c2 = sqlite3Utf8Read(zString,0,&zString))!=0 ){
         if( noCase ){
-          c2 = c2<0x80 ? sqlite3UpperToLower[c2] : c2;
-          c = c<0x80 ? sqlite3UpperToLower[c] : c;
+          UpperToLower(c2);
+          UpperToLower(c);
           while( c2 != 0 && c2 != c ){
             c2 = sqlite3Utf8Read(zString, 0, &zString);
-            if( c2<0x80 ) c2 = sqlite3UpperToLower[c2];
+            UpperToLower(c2);
           }
         }else{
           while( c2 != 0 && c2 != c ){
@@ -537,8 +550,8 @@ static int patternCompare(
     }else{
       c2 = sqlite3Utf8Read(zString, 0, &zString);
       if( noCase ){
-        c = c<0x80 ? sqlite3UpperToLower[c] : c;
-        c2 = c2<0x80 ? sqlite3UpperToLower[c2] : c2;
+        UpperToLower(c);
+        UpperToLower(c2);
       }
       if( c!=c2 ){
         return 0;