-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
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
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
-6b42dc3d04e98f91c203c277926ed6ead62a9270
\ No newline at end of file
+cc9c12170c3f6f0f485977e47e7fbb75c50e82b1
\ No newline at end of file
** 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"
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;