]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Additional comments to clarify the operation of the LIKE optimizer in
authordrh <drh@noemail.net>
Mon, 8 Jun 2009 19:44:36 +0000 (19:44 +0000)
committerdrh <drh@noemail.net>
Mon, 8 Jun 2009 19:44:36 +0000 (19:44 +0000)
where.c. (CVS 6731)

FossilOrigin-Name: cc9c12170c3f6f0f485977e47e7fbb75c50e82b1

manifest
manifest.uuid
src/where.c

index dcf0194dcfa83448fb808efde5d9702893f11f36..10ee8765b8bc1a75f44aef8735cabdaf5044a204 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Clarification\sof\sthe\soperation\sof\sthe\sOR-term\soptimizer\sin\swhere.c.\s(CVS\s6730)
-D 2009-06-08T17:11:08
+C Additional\scomments\sto\sclarify\sthe\soperation\sof\sthe\sLIKE\soptimizer\sin\nwhere.c.\s(CVS\s6731)
+D 2009-06-08T19:44:37
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in 8b8fb7823264331210cddf103831816c286ba446
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -212,7 +212,7 @@ F src/vdbeblob.c c25d7e7bc6d5917feeb17270bd275fa771f26e5c
 F src/vdbemem.c 05183d46094aa99b8f8350e5761b9369dbef35a8
 F src/vtab.c e2f4c92df7d06330b151448718c4724742ff444b
 F src/walker.c ec4b9742a4077ef80346e2f9aaf0f44c2d95087a
-F src/where.c 21555aa8b48345f5a1c706cf8ca485012f2cea03
+F src/where.c 70440f8c14ca866c6980153d2460840a88a729d7
 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
 F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87
 F test/all.test 14165b3e32715b700b5f0cbf8f6e3833dda0be45
@@ -733,7 +733,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746
-P 7863db904d6fc36417c923e3d135eb2c145b9013
-R 6ef9e53cd5ad2b3cbcbea9afea1bc9a7
+P 6b42dc3d04e98f91c203c277926ed6ead62a9270
+R 69d714b02afbfbf66f436fb2d5f497ad
 U drh
-Z aebb118da6ff464bb9146e5d93538e1c
+Z 112608f13ef95b6e8bc2968c1b5cb3e1
index 7fbf701eb756c7d8447d0d5ab0be876bc8cfe3ba..e19caec276251018e9630a225f9b077003979bdf 100644 (file)
@@ -1 +1 @@
-6b42dc3d04e98f91c203c277926ed6ead62a9270
\ No newline at end of file
+cc9c12170c3f6f0f485977e47e7fbb75c50e82b1
\ No newline at end of file
index a0b431ac49005e5c9c90879c0556080fda5674ea..3c21325a9c3cc52b6cc4ef8ea37f28ca7d057bc0 100644 (file)
@@ -16,7 +16,7 @@
 ** so is applicable.  Because this module is responsible for selecting
 ** indices, you might also think of this module as the "query optimizer".
 **
-** $Id: where.c,v 1.403 2009/06/08 17:11:08 drh Exp $
+** $Id: where.c,v 1.404 2009/06/08 19:44:37 drh Exp $
 */
 #include "sqliteInt.h"
 
@@ -1203,11 +1203,18 @@ static void exprAnalyze(
     if( pStr1 ) pStr1->u.zToken[nPattern] = 0;
     pStr2 = sqlite3ExprDup(db, pStr1, 0);
     if( !db->mallocFailed ){
-      u8 c, *pC;
+      u8 c, *pC;       /* Last character before the first wildcard */
       pC = (u8*)&pStr2->u.zToken[nPattern-1];
       c = *pC;
       if( noCase ){
-        if( c=='@' ) isComplete = 0;
+        /* The point is to increment the last character before the first
+        ** wildcard.  But if we increment '@', that will push it into the
+        ** alphabetic range where case conversions will mess up the 
+        ** inequality.  To avoid this, make sure to also run the full
+        ** LIKE on all candidate expressions by clearing the isComplete flag
+        */
+        if( c=='A'-1 ) isComplete = 0;
+
         c = sqlite3UpperToLower[c];
       }
       *pC = c + 1;