summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.cc
diff options
context:
space:
mode:
authorunknown <andrey@lmy004.>2005-08-16 15:39:40 +0200
committerunknown <andrey@lmy004.>2005-08-16 15:39:40 +0200
commit8056a7df59a5298debcd6335328a6f6c3ba5b4e6 (patch)
treed952a0c28a0e63107ae7e4f4e4e170d426fcc120 /sql/item_cmpfunc.cc
parentef5cafdf6dc42051a3eb51851fe969f4507a92ab (diff)
downloadmariadb-git-8056a7df59a5298debcd6335328a6f6c3ba5b4e6.tar.gz
fix for bug #12595 (Escape character has to be exactly one)
mysql-test/r/select.result: results for test of bug 12595 mysql-test/t/select.test: test for bug #12595 sql/item_cmpfunc.cc: check whether the size of the escape string is exactly 1 (bug #12595)
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r--sql/item_cmpfunc.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 261f719e502..0a448f463e4 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -2792,8 +2792,14 @@ bool Item_func_like::fix_fields(THD *thd, Item **ref)
{
/* If we are on execution stage */
String *escape_str= escape_item->val_str(&tmp_value1);
+ /* ESCAPE must be 1 char in length.*/
+ if (escape_str && escape_str->numchars() != 1)
+ {
+ my_error(ER_WRONG_ARGUMENTS,MYF(0),"ESCAPE");
+ return TRUE;
+ }
escape= escape_str ? *(escape_str->ptr()) : '\\';
-
+
/*
We could also do boyer-more for non-const items, but as we would have to
recompute the tables for each row it's not worth it.