Commit 96e0cb8c authored by bar@mysql.com's avatar bar@mysql.com

ctype_utf8.result, ctype_utf8.test, item.cc:

  Bug#12371 executing prepared statement fails (illegal mix of collations)
  After review fixes.
parent be470c38
......@@ -1001,6 +1001,9 @@ set @a:='bar';
execute my_stmt using @a;
a b
bar kostja
set @a:=NULL;
execute my_stmt using @a;
a b
drop table t1;
CREATE TABLE t1 (
a varchar(255) NOT NULL default '',
......
......@@ -840,6 +840,8 @@ insert into t1 values ('bar','kostja');
prepare my_stmt from "select * from t1 where a=?";
set @a:='bar';
execute my_stmt using @a;
set @a:=NULL;
execute my_stmt using @a;
drop table t1;
......
......@@ -290,7 +290,13 @@ Item *Item_param::safe_charset_converter(CHARSET_INFO *tocs)
{
Item_string *conv;
uint conv_errors;
String tmp, cstr, *ostr= val_str(&tmp);
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(),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment