summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
authorunknown <bar@mysql.com>2005-08-29 16:49:01 +0500
committerunknown <bar@mysql.com>2005-08-29 16:49:01 +0500
commit593f03d94b638420810b64d9ec1b8ddfabbae909 (patch)
tree8e19ec70dde02ef35c1a5589dca67d650f4b202a /sql/item.cc
parent527a9cad7efab705503790c6e759bb33e3cca597 (diff)
downloadmariadb-git-593f03d94b638420810b64d9ec1b8ddfabbae909.tar.gz
ctype_utf8.result, ctype_utf8.test, item.cc:
Bug#12371 executing prepared statement fails (illegal mix of collations) After review fixes. sql/item.cc: Bug#12371 executing prepared statement fails (illegal mix of collations) After review fixes. mysql-test/t/ctype_utf8.test: Bug#12371 executing prepared statement fails (illegal mix of collations) After review fixes. mysql-test/r/ctype_utf8.result: Bug#12371 executing prepared statement fails (illegal mix of collations) After review fixes.
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 53640c4e44a..2d4f9138a51 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -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(),