Commit be470c38 authored by bar@mysql.com's avatar bar@mysql.com

Merge abarkov@bk-internal.mysql.com:/home/bk/mysql-4.1

into  mysql.com:/usr/home/bar/mysql-4.1.b12371
parents 88af3ceb 8d5bfbfa
......@@ -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)
......
......@@ -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
#
......
......@@ -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())
......
......@@ -618,6 +618,7 @@ public:
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).
......
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