summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.cc
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2005-02-02 08:21:11 -0800
committerunknown <jimw@mysql.com>2005-02-02 08:21:11 -0800
commit33e74b1427c1e211acc1f06e0384e44bd1edac24 (patch)
treef7feeb6b7dbdf2dd8b64422121decec13f0ae311 /sql/item_strfunc.cc
parent6b6e5d4a1612b2c80d5c5f71c3b0ba0ce19d3cc0 (diff)
parent22f839cdd23475075e0f1e9eeeb3c7201f9a4262 (diff)
downloadmariadb-git-33e74b1427c1e211acc1f06e0384e44bd1edac24.tar.gz
Merge fixes for #8248, #5569.
mysql-test/r/func_str.result: Update results mysql-test/t/func_str.test: Merge test sql/item_strfunc.cc: Set charset on output string sql/item_strfunc.h: Merge sql/sql_parse.cc: Merge vio/viosocket.c: Merge
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r--sql/item_strfunc.cc17
1 files changed, 6 insertions, 11 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index cee3316886a..1fb68561374 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -2614,18 +2614,13 @@ String *Item_func_quote::val_str(String *str)
for (from= (char*) arg->ptr(), end= from + arg_length; from < end; from++)
new_length+= get_esc_bit(escmask, (uchar) *from);
- /*
- We have to use realloc() instead of alloc() as we want to keep the
- old result in arg
- */
- if (arg->realloc(new_length))
+ if (tmp_value.alloc(new_length))
goto null;
/*
- As 'arg' and 'str' may be the same string, we must replace characters
- from the end to the beginning
+ We replace characters from the end to the beginning
*/
- to= (char*) arg->ptr() + new_length - 1;
+ to= (char*) tmp_value.ptr() + new_length - 1;
*to--= '\'';
for (start= (char*) arg->ptr(),end= start + arg_length; end-- != start; to--)
{
@@ -2653,10 +2648,10 @@ String *Item_func_quote::val_str(String *str)
}
}
*to= '\'';
- arg->length(new_length);
- str->set_charset(collation.collation);
+ tmp_value.length(new_length);
+ tmp_value.set_charset(collation.collation);
null_value= 0;
- return arg;
+ return &tmp_value;
null:
null_value= 1;