List:Internals« Previous MessageNext Message »
From:bar Date:July 19 2005 1:48pm
Subject:bk commit into 4.1 tree (bar:1.2342) BUG#11754
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of bar. When bar 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.2342 05/07/19 16:48:12 bar@stripped +3 -0
  ctype_utf8.result, ctype_utf8.test:
    added test case
  ctype-utf8.c:
    bug#11754: SET NAMES utf8 followed by SELECT "A\\" LIKE "A\\" returns 0

  mysql-test/r/ctype_utf8.result
    1.61 05/07/19 16:47:48 bar@stripped +39 -0
    added test case

  mysql-test/t/ctype_utf8.test
    1.62 05/07/19 16:47:39 bar@stripped +21 -0
    added test case

  strings/ctype-utf8.c
    1.86 05/07/19 16:47:11 bar@stripped +10 -8
    bug#11754: SET NAMES utf8 followed by SELECT "A\\" LIKE "A\\" returns 0

# 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:	bar
# Host:	bar.intranet.mysql.r18.ru
# Root:	/usr/home/bar/mysql-4.1

--- 1.60/mysql-test/r/ctype_utf8.result	2005-07-14 10:46:08 +05:00
+++ 1.61/mysql-test/r/ctype_utf8.result	2005-07-19 16:47:48 +05:00
@@ -954,6 +954,45 @@
 2	2	12
 2	4	ан
 drop table t1;
+set names utf8;
+select 'a\\' like 'a\\';
+'a\\' like 'a\\'
+1
+select 'aa\\' like 'a%\\';
+'aa\\' like 'a%\\'
+1
+create table t1 (a char(10), key(a)) character set utf8;
+insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test");
+select * from t1 where a like "abc%";
+a
+abc
+abcd
+select * from t1 where a like concat("abc","%");
+a
+abc
+abcd
+select * from t1 where a like "ABC%";
+a
+abc
+abcd
+select * from t1 where a like "test%";
+a
+test
+select * from t1 where a like "te_t";
+a
+test
+select * from t1 where a like "%a%";
+a
+a
+abc
+abcd
+select * from t1 where a like "%abcd%";
+a
+abcd
+select * from t1 where a like "%abc\d%";
+a
+abcd
+drop table t1;
 CREATE TABLE t1 (
 a varchar(255) NOT NULL default '',
 KEY a (a)

--- 1.61/mysql-test/t/ctype_utf8.test	2005-07-18 14:31:08 +05:00
+++ 1.62/mysql-test/t/ctype_utf8.test	2005-07-19 16:47:39 +05:00
@@ -810,6 +810,27 @@
 select char_length(a), length(a), a from t1 order by a;
 drop table t1;
 
+
+#
+# Bugs#11754: SET NAMES utf8 followed by SELECT "A\\" LIKE "A\\" returns 0
+#
+set names utf8;
+select 'a\\' like 'a\\';
+select 'aa\\' like 'a%\\';
+
+create table t1 (a char(10), key(a)) character set utf8;
+insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test");
+select * from t1 where a like "abc%";
+select * from t1 where a like concat("abc","%");
+select * from t1 where a like "ABC%";
+select * from t1 where a like "test%";
+select * from t1 where a like "te_t";
+select * from t1 where a like "%a%";
+select * from t1 where a like "%abcd%";
+select * from t1 where a like "%abc\d%";
+drop table t1;
+
+
 #
 # Bug#9557 MyISAM utf8 table crash
 #

--- 1.85/strings/ctype-utf8.c	2005-06-28 14:56:39 +05:00
+++ 1.86/strings/ctype-utf8.c	2005-07-19 16:47:11 +05:00
@@ -1557,7 +1557,7 @@
       }
 
       wildstr+= scan;
-      if (w_wc ==  (my_wc_t)escape)
+      if (w_wc ==  (my_wc_t)escape && wildstr < wildend)
       {
         if ((scan= mb_wc(cs, &w_wc, (const uchar*)wildstr,
                          (const uchar*)wildend)) <= 0)
@@ -1629,13 +1629,17 @@
       if ((scan= mb_wc(cs, &w_wc, (const uchar*)wildstr,
                        (const uchar*)wildend)) <=0)
         return 1;
+      wildstr+= scan;
       
       if (w_wc ==  (my_wc_t)escape)
       {
-        wildstr+= scan;
-        if ((scan= mb_wc(cs, &w_wc, (const uchar*)wildstr,
-                         (const uchar*)wildend)) <=0)
-          return 1;
+        if (wildstr < wildend)
+        {
+          if ((scan= mb_wc(cs, &w_wc, (const uchar*)wildstr,
+                           (const uchar*)wildend)) <=0)
+            return 1;
+          wildstr+= scan;
+        }
       }
       
       while (1)
@@ -1661,14 +1665,12 @@
         if (str == str_end)
           return -1;
         
+        str+= scan;
         result= my_wildcmp_unicode(cs, str, str_end, wildstr, wildend,
                                    escape, w_one, w_many,
                                    weights);
-        
         if (result <= 0)
           return result;
-        
-        str+= scan;
       } 
     }
   }
Thread
bk commit into 4.1 tree (bar:1.2342) BUG#11754bar19 Jul