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.1994 05/09/22 14:42:36 bar@stripped +4 -0
Bug#12371: executing prepared statement fails (illegal mix of collations)
ctype_utf8.test:
ctype_utf8.result:
Adding test case.
item.cc, item.h:
Adding Item_param::safe_charset_converter()
mysql-test/r/ctype_utf8.result
1.75 05/09/22 14:41:30 bar@stripped +17 -0
Adding test case.
mysql-test/t/ctype_utf8.test
1.71 05/09/22 14:41:25 bar@stripped +16 -0
Adding test case
,
sql/item.cc
1.180 05/09/22 14:41:19 bar@stripped +27 -1
Bug#12371: executing prepared statement fails (illegal mix of collations)
sql/item.h
1.169 05/09/22 14:41:06 bar@stripped +1 -0
Bug#12371: executing prepared statement fails (illegal mix of collations)
# 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.12371
--- 1.179/sql/item.cc 2005-09-16 00:29:00 +05:00
+++ 1.180/sql/item.cc 2005-09-22 14:41:19 +05:00
@@ -696,6 +696,32 @@
}
+Item *Item_param::safe_charset_converter(CHARSET_INFO *tocs)
+{
+ if (const_item())
+ {
+ Item_string *conv;
+ uint conv_errors;
+ char buf[MAX_FIELD_WIDTH];
+ String tmp(buf, sizeof(buf), &my_charset_bin);
+ String cstr, *ostr= val_str(&tmp);
+ /*
+ As safe_charset_converter is not executed for
+ a parameter bound to NULL, ostr should never be 0.
+ */
+ 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.mark_as_const();
+ return conv;
+ }
+ return NULL;
+}
+
+
Item *Item_static_string_func::safe_charset_converter(CHARSET_INFO *tocs)
{
Item_string *conv;
@@ -1355,7 +1381,7 @@
been created in prepare. In this case register the change for
rollback.
*/
- if (arena)
+ if (arena && arena->is_conventional())
*arg= conv;
else
thd->change_item_tree(arg, conv);
--- 1.168/sql/item.h 2005-09-08 21:25:37 +05:00
+++ 1.169/sql/item.h 2005-09-22 14:41:06 +05:00
@@ -1197,6 +1197,7 @@
constant, assert otherwise. This method is called only if
basic_const_item returned TRUE.
*/
+ Item *safe_charset_converter(CHARSET_INFO *tocs);
Item *new_item();
/*
Implement by-value equality evaluation if parameter value
--- 1.74/mysql-test/r/ctype_utf8.result 2005-09-19 09:47:43 +05:00
+++ 1.75/mysql-test/r/ctype_utf8.result 2005-09-22 14:41:30 +05:00
@@ -1078,3 +1078,20 @@
i
い
drop table t1,t2;
+set names utf8;
+create table t1 (a char(10), b varchar(10));
+insert into t1 values ('bar','kostja');
+insert into t1 values ('kostja','bar');
+prepare my_stmt from "select * from t1 where a=?";
+set @a:='bar';
+execute my_stmt using @a;
+a b
+bar kostja
+set @a:='kostja';
+execute my_stmt using @a;
+a b
+kostja bar
+set @a:=null;
+execute my_stmt using @a;
+a b
+drop table if exists t1;
--- 1.70/mysql-test/t/ctype_utf8.test 2005-09-19 09:47:21 +05:00
+++ 1.71/mysql-test/t/ctype_utf8.test 2005-09-22 14:41:25 +05:00
@@ -892,3 +892,19 @@
insert into t1 values('i'),('i'),(0xE38184),(0xE38184);
select * from t1 union distinct select * from t2;
drop table t1,t2;
+
+#
+# Bug#12371: executing prepared statement fails (illegal mix of collations)
+#
+set names utf8;
+create table t1 (a char(10), b varchar(10));
+insert into t1 values ('bar','kostja');
+insert into t1 values ('kostja','bar');
+prepare my_stmt from "select * from t1 where a=?";
+set @a:='bar';
+execute my_stmt using @a;
+set @a:='kostja';
+execute my_stmt using @a;
+set @a:=null;
+execute my_stmt using @a;
+drop table if exists t1;
| Thread |
|---|
| • bk commit into 5.0 tree (bar:1.1994) BUG#12371 | bar | 22 Sep |