1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

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

This commit is contained in:
Sergei Golubchik
2016-11-03 22:40:19 +01:00
parent 660355c1ac
commit 232dc91bc9
4 changed files with 33 additions and 4 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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()
{

View File

@ -1868,10 +1868,7 @@ public:
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