From 4c670550d266d66a7ab0f0883b6e3994346872dc Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 22 Jun 2004 19:27:16 +0400 Subject: Fix for Bug# 4200 "Parse error on LIKE ESCAPE with parameter binding" Now ESCAPE in LIKE will accept not only string literal but constant delimited expression. mysql-test/r/func_like.result: Added test for bug# 4200 "Parse error on LIKE ESCAPE with parameter binding" mysql-test/t/func_like.test: Added test for bug# 4200 "Parse error on LIKE ESCAPE with parameter binding" sql/item_cmpfunc.cc: Added support for accepting of constant delimited expression as ESCAPE argument to Item_func_like. sql/item_cmpfunc.h: Now ESCAPE clause in LIKE will accept not only string literal but constant delimited expression. Thus added member to Item_func_like for storing Item corresponding to this expression and changed third argument of cons to be Item* instead of char*. sql/sql_help.cc: Item_func_like now accepts Item* as third argument. sql/sql_yacc.yy: Now ESCAPE clause of LIKE accepts not only string literal but constant delimited expression (the most important case is prepared statement parameter of course). --- mysql-test/t/func_like.test | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/func_like.test b/mysql-test/t/func_like.test index 91f55af48cc..ad83202afa0 100644 --- a/mysql-test/t/func_like.test +++ b/mysql-test/t/func_like.test @@ -25,14 +25,23 @@ select * from t1 where a like "%abc\d%"; drop table t1; +create table t1 (a varchar(10), key(a)); + # # Bug #2231 # - -create table t1 (a varchar(10), key(a)); insert into t1 values ('a'), ('a\\b'); select * from t1 where a like 'a\\%' escape '#'; select * from t1 where a like 'a\\%' escape '#' and a like 'a\\\\b'; + +# +# Bug #4200: Prepared statement parameter as argument to ESCAPE +# +prepare stmt1 from 'select * from t1 where a like \'a\\%\' escape ?'; +set @esc='#'; +execute stmt1 using @esc; +deallocate prepare stmt1; + drop table t1; # -- cgit v1.2.1