summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2015-03-18 17:10:48 +0400
committerAlexander Barkov <bar@mariadb.org>2015-03-18 17:10:48 +0400
commite28a241907aa7a511b65b196703efaeea71e1dc4 (patch)
tree9456d75e69127d0416592f8036441b17cbe43724 /sql/item_strfunc.cc
parenta471b7098f50e21565ce4c86efcb05d8310e1d62 (diff)
downloadmariadb-git-e28a241907aa7a511b65b196703efaeea71e1dc4.tar.gz
MDEV-7661 Unexpected result for: CAST(0xHHHH AS CHAR CHARACTER SET xxx)
for incorrect byte sequences
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r--sql/item_strfunc.cc15
1 files changed, 6 insertions, 9 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 54fc8d555c8..32b6d6348ac 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -3378,15 +3378,12 @@ String *Item_func_conv_charset::val_str(String *str)
if (use_cached_value)
return null_value ? 0 : &str_value;
String *arg= args[0]->val_str(str);
- uint dummy_errors;
- if (args[0]->null_value)
- {
- null_value=1;
- return 0;
- }
- null_value= tmp_value.copy(arg->ptr(), arg->length(), arg->charset(),
- conv_charset, &dummy_errors);
- return null_value ? 0 : check_well_formed_result(&tmp_value);
+ String_copier_for_item copier(current_thd);
+ return ((null_value= args[0]->null_value ||
+ copier.copy_with_warn(conv_charset, &tmp_value,
+ arg->charset(), arg->ptr(),
+ arg->length(), arg->length()))) ?
+ 0 : &tmp_value;
}
void Item_func_conv_charset::fix_length_and_dec()