Commit 232dc91b authored by Sergei Golubchik's avatar Sergei Golubchik

bugfix: Item_func_like::print() was losing ESCAPE clause

parent 660355c1
......@@ -254,3 +254,11 @@ DROP TABLE t1;
#
# End of 10.1 tests
#
create view v1 as select 'foo!' like 'foo!!', 'foo!' like 'foo!!' escape '!';
show create view v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select ('foo!' like 'foo!!') AS `'foo!' like 'foo!!'`,('foo!' like 'foo!!' escape '!') AS `'foo!' like 'foo!!' escape '!'` koi8r koi8r_general_ci
select * from v1;
'foo!' like 'foo!!' 'foo!' like 'foo!!' escape '!'
0 1
drop view v1;
......@@ -185,3 +185,11 @@ DROP TABLE t1;
--echo #
--echo # End of 10.1 tests
--echo #
#
# Item_func_line::print()
#
create view v1 as select 'foo!' like 'foo!!', 'foo!' like 'foo!!' escape '!';
show create view v1;
select * from v1;
drop view v1;
......@@ -5076,6 +5076,22 @@ bool Item_bool_func2::count_sargable_conds(void *arg)
return 0;
}
void Item_func_like::print(String *str, enum_query_type query_type)
{
str->append('(');
args[0]->print(str, query_type);
str->append(' ');
str->append(func_name());
str->append(' ');
args[1]->print(str, query_type);
if (escape_used_in_parsing)
{
str->append(STRING_WITH_LEN(" escape "));
escape_item->print(str, query_type);
}
str->append(')');
}
longlong Item_func_like::val_int()
{
......
......@@ -1868,10 +1868,7 @@ class Item_func_like :public Item_bool_func2
escape_used_in_parsing(escape_used), use_sampling(0) {}
longlong val_int();
enum Functype functype() const { return LIKE_FUNC; }
void print(String *str, enum_query_type query_type)
{
Item_func::print_op(str, query_type);
}
void print(String *str, enum_query_type query_type);
CHARSET_INFO *compare_collation() const
{ return cmp_collation.collation; }
cond_result eq_cmp_result() const
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment