summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.cc
diff options
context:
space:
mode:
authorSergey Glukhov <Sergey.Glukhov@sun.com>2009-09-10 15:30:03 +0500
committerSergey Glukhov <Sergey.Glukhov@sun.com>2009-09-10 15:30:03 +0500
commit0412a7c753c869437cbc362b578f667be9026946 (patch)
tree6b8c339303465f2379325beece465a3c71bd3be9 /sql/item_strfunc.cc
parente436b8866be640b2160f0b756f85559437cff67d (diff)
parent10406ae65871de074e807e626f9ede686e9321d4 (diff)
downloadmariadb-git-0412a7c753c869437cbc362b578f667be9026946.tar.gz
5.0-bugteam->5.1-bugteam merge
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r--sql/item_strfunc.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index be94f19f597..39c4b8e7033 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -631,6 +631,7 @@ String *Item_func_concat_ws::val_str(String *str)
String tmp_sep_str(tmp_str_buff, sizeof(tmp_str_buff),default_charset_info),
*sep_str, *res, *res2,*use_as_buff;
uint i;
+ bool is_const= 0;
null_value=0;
if (!(sep_str= args[0]->val_str(&tmp_sep_str)))
@@ -644,7 +645,11 @@ String *Item_func_concat_ws::val_str(String *str)
// If not, return the empty string
for (i=1; i < arg_count; i++)
if ((res= args[i]->val_str(str)))
+ {
+ is_const= args[i]->const_item() || !args[i]->used_tables();
break;
+ }
+
if (i == arg_count)
return &my_empty_string;
@@ -662,7 +667,7 @@ String *Item_func_concat_ws::val_str(String *str)
current_thd->variables.max_allowed_packet);
goto null;
}
- if (res->alloced_length() >=
+ if (!is_const && res->alloced_length() >=
res->length() + sep_str->length() + res2->length())
{ // Use old buffer
res->append(*sep_str); // res->length() > 0 always