summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item_timefunc.cc')
-rw-r--r--sql/item_timefunc.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 3771706fb63..73b8b6047e0 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -2526,14 +2526,14 @@ String *Item_char_typecast::val_str(String *str)
{
// Convert character set if differ
uint dummy_errors;
- if (!(res= args[0]->val_str(&tmp_value)) ||
- str->copy(res->ptr(), res->length(), from_cs,
- cast_cs, &dummy_errors))
+ if (!(res= args[0]->val_str(str)) ||
+ tmp_value.copy(res->ptr(), res->length(), from_cs,
+ cast_cs, &dummy_errors))
{
null_value= 1;
return 0;
}
- res= str;
+ res= &tmp_value;
}
res->set_charset(cast_cs);
@@ -2568,9 +2568,9 @@ String *Item_char_typecast::val_str(String *str)
{
if (res->alloced_length() < (uint) cast_length)
{
- str->alloc(cast_length);
- str->copy(*res);
- res= str;
+ str_value.alloc(cast_length);
+ str_value.copy(*res);
+ res= &str_value;
}
bzero((char*) res->ptr() + res->length(),
(uint) cast_length - res->length());