]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix a bug in the LIKE optimization that was causing the pattern string
authordrh <drh@noemail.net>
Mon, 11 Jun 2007 12:56:15 +0000 (12:56 +0000)
committerdrh <drh@noemail.net>
Mon, 11 Jun 2007 12:56:15 +0000 (12:56 +0000)
to be dequoted twice.  Ticket #2407. (CVS 4056)

FossilOrigin-Name: abf64d1d0ae3e84c4482b38198eeb44b62cc5d9e

manifest
manifest.uuid
src/where.c
test/like.test

index 8439c6d730875c1790df729757b458dade992d6c..7c561d13eab61e193240cbee8e161a7edeb7b793 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sa\sREADME.txt\sfile\sfor\sthe\sICU\sextension.\s(CVS\s4055)
-D 2007-06-11T08:00:00
+C Fix\sa\sbug\sin\sthe\sLIKE\soptimization\sthat\swas\scausing\sthe\spattern\sstring\nto\sbe\sdequoted\stwice.\s\sTicket\s#2407.\s(CVS\s4056)
+D 2007-06-11T12:56:15
 F Makefile.in 31d9f7cd42c3d73ae117fcdb4b0ecd029fa8f50b
 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -143,7 +143,7 @@ F src/vdbeblob.c 96f3572fdc45eda5be06e6372b612bc30742d9f0
 F src/vdbefifo.c 3ca8049c561d5d67cbcb94dc909ae9bb68c0bf8f
 F src/vdbemem.c d86c25bbfe8102499ff7505fca44a779c68694d8
 F src/vtab.c c5ebebf615b2f29499fbe97a584c4bb342632aa0
-F src/where.c b5e7a9735db4010984b6d5c2febb1fa7ab4b1bd6
+F src/where.c 12387641659605318ae03d87f0687f223dfc9568
 F tclinstaller.tcl 4356d9d94d2b5ed5e68f9f0c80c4df3048dd7617
 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
 F test/all.test f0ea4b968d5fe05d85e9cab6fa491ec7e3b9fcc4
@@ -283,7 +283,7 @@ F test/join5.test 86675fc2919269aa923c84dd00ee4249b97990fe
 F test/journal1.test 36f2d1bb9bf03f790f43fbdb439e44c0657fab19
 F test/lastinsert.test 474d519c68cb79d07ecae56a763aa7f322c72f51
 F test/laststmtchanges.test 18ead86c8a87ade949a1d5658f6dc4bb111d1b02
-F test/like.test 5f7d76574752a9101cac13372c8a85999d0d91e6
+F test/like.test 9b8eb634d2c34b36b365c1baae115c9bd6e56674
 F test/limit.test 2a87b9cb2165abb49ca0ddcf5cb43cf24074581f
 F test/loadext.test 9ab2cb0226329c1a62dd45d204be95158a872201
 F test/loadext2.test 95ca7e2cb03fd3e068de97c3a2fe58dbdfd769e1
@@ -503,7 +503,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P fed9373e27b9d5338159a41772f8983420b902b0
-R c45d0693cbf40360dc0b5addeae5d9aa
-U danielk1977
-Z 7dc46a81cb300982dd5e07eef7c7a05c
+P 7b6927829f18d39052e67eebca4275e7aa496035
+R d6d46e4a7b82906dd6f96028e2072348
+U drh
+Z 8fc06e5a345de60554c57f06617628d9
index c06a82bb54044520a7863341fc5d3711101120bb..a3f94242181b6007a84f29c84c7d60725e799c3a 100644 (file)
@@ -1 +1 @@
-7b6927829f18d39052e67eebca4275e7aa496035
\ No newline at end of file
+abf64d1d0ae3e84c4482b38198eeb44b62cc5d9e
\ No newline at end of file
index aeb370885da720bdb29497ed5eaaab906fe97439..402f9c296a62069d93c2b3ece25bc9c1bc36af3a 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.252 2007/06/08 08:39:02 drh Exp $
+** $Id: where.c,v 1.253 2007/06/11 12:56:15 drh Exp $
 */
 #include "sqliteInt.h"
 
@@ -878,6 +878,7 @@ or_not_possible:
     if( pStr1 ){
       sqlite3TokenCopy(&pStr1->token, &pRight->token);
       pStr1->token.n = nPattern;
+      pStr1->flags = EP_Dequoted;
     }
     pStr2 = sqlite3ExprDup(pStr1);
     if( pStr2 ){
index 8efeb41617f2ff526bc4b49586866051eaefe83a..3d0f106af5e462863288cccad8e0358f350557e0 100644 (file)
@@ -13,7 +13,7 @@
 # in particular the optimizations that occur to help those operators
 # run faster.
 #
-# $Id: like.test,v 1.5 2006/06/14 08:48:26 danielk1977 Exp $
+# $Id: like.test,v 1.6 2007/06/11 12:56:15 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -382,5 +382,18 @@ do_test like-5.8 {
   set sqlite_like_count
 } 12
 
+# ticket #2407
+#
+# Make sure the LIKE prefix optimization does not strip off leading
+# characters of the like pattern that happen to be quote characters.
+#
+do_test like-6.1 {
+  foreach x { 'abc 'bcd 'def 'ax } {
+    db eval {INSERT INTO t2 VALUES($x)}
+  }
+  execsql {
+    SELECT * FROM t2 WHERE x LIKE '''a%'
+  }
+} {'abc 'ax}
 
 finish_test