Below is the list of changes that have just been committed into a local
5.0 repository of andrey. When andrey does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.1983 05/08/16 15:39:40 andrey@lmy004. +3 -0
fix for bug #12595 (Escape character has to be exactly one)
sql/item_cmpfunc.cc
1.166 05/08/16 15:39:33 andrey@lmy004. +7 -1
check whether the size of the escape string is exactly 1 (bug #12595)
mysql-test/t/select.test
1.63 05/08/16 15:39:33 andrey@lmy004. +11 -0
test for bug #12595
mysql-test/r/select.result
1.77 05/08/16 15:39:32 andrey@lmy004. +11 -0
results for test of bug 12595
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: andrey
# Host: lmy004.
# Root: /work/mysql-5.0-bug12595
--- 1.165/sql/item_cmpfunc.cc 2005-08-11 13:02:43 +02:00
+++ 1.166/sql/item_cmpfunc.cc 2005-08-16 15:39:33 +02:00
@@ -2792,8 +2792,14 @@
{
/* 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.
--- 1.76/mysql-test/r/select.result 2005-08-12 16:57:13 +02:00
+++ 1.77/mysql-test/r/select.result 2005-08-16 15:39:32 +02:00
@@ -2739,3 +2739,14 @@
select x'10' + 0, X'10' + 0, b'10' + 0, B'10' + 0;
x'10' + 0 X'10' + 0 b'10' + 0 B'10' + 0
16 16 2 2
+CREATE TABLE BUG_12595(a varchar(100));
+INSERT INTO BUG_12595 VALUES ('hakan%'), ('hakank'), ("ha%an");
+SELECT * FROM BUG_12595 WHERE a LIKE 'hakan*%' ESCAPE '*';
+a
+hakan%
+SELECT * FROM BUG_12595 WHERE a LIKE 'hakan**%' ESCAPE '**';
+ERROR HY000: Incorrect arguments to ESCAPE
+SELECT * FROM BUG_12595 WHERE a LIKE 'ha%%an' ESCAPE '%';
+a
+ha%an
+DROP TABLE BUG_12595;
--- 1.62/mysql-test/t/select.test 2005-08-12 16:57:14 +02:00
+++ 1.63/mysql-test/t/select.test 2005-08-16 15:39:33 +02:00
@@ -2350,3 +2350,14 @@
#
select x'10' + 0, X'10' + 0, b'10' + 0, B'10' + 0;
+
+#
+# BUG #12595
+#
+CREATE TABLE BUG_12595(a varchar(100));
+INSERT INTO BUG_12595 VALUES ('hakan%'), ('hakank'), ("ha%an");
+SELECT * FROM BUG_12595 WHERE a LIKE 'hakan*%' ESCAPE '*';
+-- error 1210
+SELECT * FROM BUG_12595 WHERE a LIKE 'hakan**%' ESCAPE '**';
+SELECT * FROM BUG_12595 WHERE a LIKE 'ha%%an' ESCAPE '%';
+DROP TABLE BUG_12595;
| Thread |
|---|
| • bk commit into 5.0 tree (andrey:1.1983) BUG#12595 | ahristov | 16 Aug |