List:Internals« Previous MessageNext Message »
From:bar Date:September 7 2005 1:32pm
Subject:bk commit into 5.0 tree (bar:1.1977)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 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.1977 05/09/07 16:32:15 bar@stripped +5 -0
  Merge mysql.com:/usr/home/bar/mysql-4.1.b12611
  into  mysql.com:/usr/home/bar/mysql-5.0

  sql/item_cmpfunc.h
    1.109 05/09/07 16:32:07 bar@stripped +0 -0
    Auto merged

  sql/item_cmpfunc.cc
    1.172 05/09/07 16:32:07 bar@stripped +0 -0
    Auto merged

  mysql-test/t/ctype_utf8.test
    1.67 05/09/07 16:32:07 bar@stripped +0 -0
    Auto merged

  mysql-test/r/func_like.result
    1.17 05/09/07 16:32:07 bar@stripped +0 -0
    Auto merged

  mysql-test/r/ctype_utf8.result
    1.71 05/09/07 16:32:07 bar@stripped +0 -0
    Auto merged

# 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-5.0/RESYNC

--- 1.171/sql/item_cmpfunc.cc	2005-09-02 18:21:07 +05:00
+++ 1.172/sql/item_cmpfunc.cc	2005-09-07 16:32:07 +05:00
@@ -2811,7 +2811,42 @@
   {
     /* If we are on execution stage */
     String *escape_str= escape_item->val_str(&tmp_value1);
-    escape= escape_str ? *(escape_str->ptr()) : '\\';
+    if (escape_str)
+    {
+      CHARSET_INFO *cs= cmp.cmp_collation.collation;
+      if (use_mb(cs))
+      {
+        my_wc_t wc;
+        int rc= cs->cset->mb_wc(cs, &wc,
+                                (const uchar*) escape_str->ptr(),
+                                (const uchar*) escape_str->ptr() +
+                                               escape_str->length());
+        escape= (int) (rc > 0 ? wc : '\\');
+      }
+      else
+      {
+        /*
+          In the case of 8bit character set, we pass native
+          code instead of Unicode code as "escape" argument.
+          Convert to "cs" if charset of escape differs.
+        */
+        uint32 unused;
+        if (escape_str->needs_conversion(escape_str->length(),
+                                         escape_str->charset(), cs, &unused))
+        {
+          char ch;
+          uint errors;
+          uint32 cnvlen= copy_and_convert(&ch, 1, cs, escape_str->ptr(),
+                                          escape_str->length(),
+                                          escape_str->charset(), &errors);
+          escape= cnvlen ? ch : '\\';
+        }
+        else
+          escape= *(escape_str->ptr());
+      }
+    }
+    else
+      escape= '\\';
 
     /*
       We could also do boyer-more for non-const items, but as we would have to

--- 1.108/sql/item_cmpfunc.h	2005-08-31 01:39:41 +05:00
+++ 1.109/sql/item_cmpfunc.h	2005-09-07 16:32:07 +05:00
@@ -966,7 +966,7 @@
   Item *escape_item;
 
 public:
-  char escape;
+  int escape;
 
   Item_func_like(Item *a,Item *b, Item *escape_arg)
     :Item_bool_func2(a,b), canDoTurboBM(FALSE), pattern(0), pattern_len(0), 

--- 1.70/mysql-test/r/ctype_utf8.result	2005-08-29 22:15:37 +05:00
+++ 1.71/mysql-test/r/ctype_utf8.result	2005-09-07 16:32:07 +05:00
@@ -955,6 +955,10 @@
 2	4	ан
 drop table t1;
 set names utf8;
+select 'andre%' like 'andreñ%' escape 'ñ';
+'andre%' like 'andreñ%' escape 'ñ'
+1
+set names utf8;
 select 'a\\' like 'a\\';
 'a\\' like 'a\\'
 1

--- 1.66/mysql-test/t/ctype_utf8.test	2005-08-29 22:15:47 +05:00
+++ 1.67/mysql-test/t/ctype_utf8.test	2005-09-07 16:32:07 +05:00
@@ -810,6 +810,12 @@
 select char_length(a), length(a), a from t1 order by a;
 drop table t1;
 
+#
+# Bugs#12611
+# ESCAPE + LIKE do not work when the escape char is a multibyte one
+#
+set names utf8;
+select 'andre%' like 'andreñ%' escape 'ñ';
 
 #
 # Bugs#11754: SET NAMES utf8 followed by SELECT "A\\" LIKE "A\\" returns 0

--- 1.16/mysql-test/r/func_like.result	2004-12-06 04:00:08 +04:00
+++ 1.17/mysql-test/r/func_like.result	2005-09-07 16:32:07 +05:00
@@ -158,3 +158,10 @@
 select _cp866'aaaaaaaaa' like _cp866'%aaaa%' collate cp866_bin;
 _cp866'aaaaaaaaa' like _cp866'%aaaa%' collate cp866_bin
 1
+set names koi8r;
+select 'andre%' like 'andreÊ%' escape 'Ê';
+'andre%' like 'andreÊ%' escape 'Ê'
+1
+select _cp1251'andre%' like convert('andreÊ%' using cp1251)  escape 'Ê';
+_cp1251'andre%' like convert('andreÊ%' using cp1251)  escape 'Ê'
+1
Thread
bk commit into 5.0 tree (bar:1.1977)bar7 Sep