List:Internals« Previous MessageNext Message »
From:bar Date:August 6 2005 1:58pm
Subject:bk commit into 4.1 tree (bar:1.2361) BUG#12371
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.2361 05/08/06 16:58:36 bar@stripped +4 -0
  Bug#12371 executing prepared statement fails (illegal mix of collations)
  
  item.cc:
  item.h:
    Adding Item_param::safe_charset_converter,
    not to return collation mix error if
    parameter can be converted into operation
    character set.
  
  ctype_utf8.result:
    adding test case
  ctype_utf8.test:
    adding test case

  mysql-test/r/ctype_utf8.result
    1.62 05/08/06 16:57:25 bar@stripped +9 -0
    adding 

  mysql-test/t/ctype_utf8.test
    1.64 05/08/06 16:57:12 bar@stripped +12 -0
    adding test case

  sql/item.cc
    1.214 05/08/06 16:57:06 bar@stripped +20 -0
    Bug #12371 executing prepared statement fails (illegal mix of collations)

  sql/item.h
    1.189 05/08/06 16:56:01 bar@stripped +1 -0
    Bug #12371 executing prepared statement fails (illegal mix of collations)
    Adding Item_param::safe_charset_converter,
    not to returm collation mix error if
    parameter can be converted into operation
    character set.

# 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.213/sql/item.cc	2005-07-26 12:50:39 +05:00
+++ 1.214/sql/item.cc	2005-08-06 16:57:06 +05:00
@@ -284,6 +284,26 @@
 }
 
 
+Item *Item_param::safe_charset_converter(CHARSET_INFO *tocs)
+{
+  if (const_item())
+  {
+    Item_string *conv;
+    uint conv_errors;
+    String tmp, cstr, *ostr= val_str(&tmp);
+    cstr.copy(ostr->ptr(), ostr->length(), ostr->charset(), tocs,
&conv_errors);
+    if (conv_errors || !(conv= new Item_string(cstr.ptr(), cstr.length(),
+                                               cstr.charset(),
+                                               collation.derivation)))
+      return NULL;
+    conv->str_value.copy();
+    conv->str_value.shrink_to_length();
+    return conv;
+  }
+  return NULL;
+}
+
+
 bool Item_string::eq(const Item *item, bool binary_cmp) const
 {
   if (type() == item->type() && item->basic_const_item())

--- 1.188/sql/item.h	2005-07-26 12:50:52 +05:00
+++ 1.189/sql/item.h	2005-08-06 16:56:01 +05:00
@@ -617,6 +617,7 @@
     basic_const_item returned TRUE.
   */
   Item *new_item();
+  Item *safe_charset_converter(CHARSET_INFO *tocs);
   /*
     Implement by-value equality evaluation if parameter value
     is set and is a basic constant (integer, real or string).

--- 1.61/mysql-test/r/ctype_utf8.result	2005-07-19 16:47:48 +05:00
+++ 1.62/mysql-test/r/ctype_utf8.result	2005-08-06 16:57:25 +05:00
@@ -993,6 +993,15 @@
 a
 abcd
 drop table t1;
+set names utf8;
+create table t1 (a char(3), b varchar(10));
+insert into t1 values ('bar','kostja');
+prepare my_stmt from "select * from t1 where a=?";
+set @a:='bar';
+execute my_stmt using @a;
+a	b
+bar	kostja
+drop table t1;
 CREATE TABLE t1 (
 a varchar(255) NOT NULL default '',
 KEY a (a)

--- 1.63/mysql-test/t/ctype_utf8.test	2005-07-28 05:21:40 +05:00
+++ 1.64/mysql-test/t/ctype_utf8.test	2005-08-06 16:57:12 +05:00
@@ -832,6 +832,18 @@
 
 
 #
+# Bug #12371 executing prepared statement fails (illegal mix of collations)
+#
+set names utf8;
+create table t1 (a char(3), b varchar(10));
+insert into t1 values ('bar','kostja');
+prepare my_stmt from "select * from t1 where a=?";
+set @a:='bar';
+execute my_stmt using @a;
+drop table t1;
+
+
+#
 # Bug#9557 MyISAM utf8 table crash
 #
 CREATE TABLE t1 (
Thread
bk commit into 4.1 tree (bar:1.2361) BUG#12371bar6 Aug