Loading mysql-test/r/ctype_utf8.result +9 −0 Original line number Diff line number Diff line Loading @@ -993,6 +993,15 @@ select * from t1 where a like "%abc\d%"; 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) Loading mysql-test/t/ctype_utf8.test +12 −0 Original line number Diff line number Diff line Loading @@ -831,6 +831,18 @@ select * from t1 where a like "%abc\d%"; drop table t1; # # 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 # Loading sql/item.cc +20 −0 Original line number Diff line number Diff line Loading @@ -284,6 +284,26 @@ Item *Item_string::safe_charset_converter(CHARSET_INFO *tocs) } 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()) Loading sql/item.h +1 −0 Original line number Diff line number Diff line Loading @@ -618,6 +618,7 @@ class Item_param :public Item 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). Loading Loading
mysql-test/r/ctype_utf8.result +9 −0 Original line number Diff line number Diff line Loading @@ -993,6 +993,15 @@ select * from t1 where a like "%abc\d%"; 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) Loading
mysql-test/t/ctype_utf8.test +12 −0 Original line number Diff line number Diff line Loading @@ -831,6 +831,18 @@ select * from t1 where a like "%abc\d%"; drop table t1; # # 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 # Loading
sql/item.cc +20 −0 Original line number Diff line number Diff line Loading @@ -284,6 +284,26 @@ Item *Item_string::safe_charset_converter(CHARSET_INFO *tocs) } 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()) Loading
sql/item.h +1 −0 Original line number Diff line number Diff line Loading @@ -618,6 +618,7 @@ class Item_param :public Item 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). Loading