]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Allow LIKE operators that appear in a WHERE clause to be included in the cursor-hint... cursor-hints
authordan <dan@noemail.net>
Mon, 20 Jun 2016 17:22:06 +0000 (17:22 +0000)
committerdan <dan@noemail.net>
Mon, 20 Jun 2016 17:22:06 +0000 (17:22 +0000)
FossilOrigin-Name: 7455d932f5079ffe40462a8c119fc22b8a9bcbcc

manifest
manifest.uuid
src/wherecode.c
test/cursorhint2.test

index be6f9cf0da25cac9054167723e2a5f834ac4a6e4..a231acf0827809599a4459de66cd4db4c9a9e0eb 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Include\sWHERE\sterms\sin\sthe\scursor-hint\spassed\sto\sa\scursor\sopened\sfor\sthe\srhs\sof\sa\sLEFT\sJOIN\siff\swe\scan\sbe\ssure\sthat\sthose\sterms\swill\snot\sevaluate\sto\strue\sif\sthe\sLEFT\sJOIN\sgenerates\sa\srow\sof\sNULLs.
-D 2016-06-17T19:27:13.114
+C Allow\sLIKE\soperators\sthat\sappear\sin\sa\sWHERE\sclause\sto\sbe\sincluded\sin\sthe\scursor-hint\sfor\sa\scursor\son\sthe\srhs\sof\sa\sLEFT\sJOIN.
+D 2016-06-20T17:22:06.973
 F Makefile.in f3f7d2060ce03af4584e711ef3a626ef0b1d6340
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc 50149765ef72f4e652b9a0f1f6462c4784bb9423
@@ -464,7 +464,7 @@ F src/wal.h 2f7c831cf3b071fa548bf2d5cac640846a7ff19c
 F src/walker.c 0f142b5bd3ed2041fc52d773880748b212e63354
 F src/where.c 74f0798525b6306682d7234f230ea93f86959b9b
 F src/whereInt.h e5b939701a7ceffc5a3a8188a37f9746416ebcd0
-F src/wherecode.c c1b11ad09468577afd3c36cd8c854fb6dd77f258
+F src/wherecode.c e20cb381ff621e56a4684c71e31999aca2547ca6
 F src/whereexpr.c c32d47085dbaca0b8fd013210f56693c7d220d48
 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
 F test/affinity2.test a6d901b436328bd67a79b41bb0ac2663918fe3bd
@@ -617,7 +617,7 @@ F test/cse.test 277350a26264495e86b1785f34d2d0c8600e021c
 F test/csv01.test 0929a9ce47021519512be92861f29e32d2538e5f
 F test/ctime.test 7bd009071e242aac4f18521581536b652b789a47
 F test/cursorhint.test 7bc346788390475e77a345da2b92270d04d35856
-F test/cursorhint2.test cef69bab25b9141071b4239fa5c3b4ce18eeafd0
+F test/cursorhint2.test 2b45341d32d1aae9991a00ef31ebca339b274255
 F test/date.test 984ac1e3e5e031386866f034006148d3972b4a65
 F test/dbstatus.test 8de104bb5606f19537d23cd553b41349b5ab1204
 F test/dbstatus2.test e93ab03bfae6d62d4d935f20de928c19ca0ed0ab
@@ -1502,7 +1502,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P fcd12b69cee1335224a65aa6d22c4e302b889398
-R aa7c436ce5d8105be03298dc84afa8de
+P 998095aba01b75f685ed981b377e1dfe650d9bbf
+R 6b36cf1cbd5dc0e94253a2a90e40c230
 U dan
-Z a2cf93e232f8c6f0bcf6400999626f67
+Z 7f5e55d96c0f8c6a30345a5c923b92ab
index efb8ac03359248cffcc53b681c3fe37a00e09b34..a65de1e449eb2e185e9cde78322095c5f0cf2318 100644 (file)
@@ -1 +1 @@
-998095aba01b75f685ed981b377e1dfe650d9bbf
\ No newline at end of file
+7455d932f5079ffe40462a8c119fc22b8a9bcbcc
\ No newline at end of file
index e6294de5321159b6009c7bbbc89b1a1cc51ef0be..a017b40c7d5b3c8f07e0e6606768205ac9c4f59a 100644 (file)
@@ -642,12 +642,19 @@ static int codeCursorHintCheckExpr(Walker *pWalker, Expr *pExpr){
 **   CASE WHEN col THEN 0 ELSE 1 END
 */
 static int codeCursorHintIsOrFunction(Walker *pWalker, Expr *pExpr){
-  if( pExpr->op==TK_IS || pExpr->op==TK_FUNCTION 
+  if( pExpr->op==TK_IS 
    || pExpr->op==TK_ISNULL || pExpr->op==TK_ISNOT 
    || pExpr->op==TK_NOTNULL || pExpr->op==TK_CASE 
   ){
     pWalker->eCode = 1;
+  }else if( pExpr->op==TK_FUNCTION ){
+    int d1;
+    char d2[3];
+    if( 0==sqlite3IsLikeFunction(pWalker->pParse->db, pExpr, &d1, d2) ){
+      pWalker->eCode = 1;
+    }
   }
+
   return WRC_Continue;
 }
 
index b42227cdfb89a8906c3e596f8db4e2033430c3ef..3444fdf441bea756b54504b7fb413ca54a599697 100644 (file)
@@ -164,5 +164,17 @@ do_extract_hints_test 2.10 {
   x2 {AND(EQ(c1,ADD(32,32)),EQ(c0,r[2]))}
 }
 
+do_extract_hints_test 2.11 {
+  SELECT * FROM x1 LEFT JOIN x2 ON (a=x) WHERE x2.b LIKE 'abc%'
+} {
+  x2 {AND(expr,EQ(c0,r[2]))}
+}
+
+do_extract_hints_test 2.11 {
+  SELECT * FROM x1 LEFT JOIN x2 ON (a=x) WHERE coalesce(x2.b, 1)
+} {
+  x2 {EQ(c0,r[2])}
+}
+
 finish_test