summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
authorunknown <bar@mysql.com>2005-08-06 16:58:36 +0500
committerunknown <bar@mysql.com>2005-08-06 16:58:36 +0500
commitc03d28b893af064364b0ae92971663801a136dc8 (patch)
treead88350f4d86a3b7b92d2050d94eb7aa18434a53 /sql/item.cc
parent75c06af27784e6fa6ba23f4cd6803bc7574f8253 (diff)
downloadmariadb-git-c03d28b893af064364b0ae92971663801a136dc8.tar.gz
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 sql/item.h: 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. sql/item.cc: Bug #12371 executing prepared statement fails (illegal mix of collations) mysql-test/t/ctype_utf8.test: adding test case mysql-test/r/ctype_utf8.result: adding
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 84dbc382a52..969604d6834 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -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())