summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.cc
diff options
context:
space:
mode:
authorunknown <knielsen@knielsen-hq.org>2009-11-16 21:49:51 +0100
committerunknown <knielsen@knielsen-hq.org>2009-11-16 21:49:51 +0100
commita962160eec233c265900e2754ed2a63ef5e27c5a (patch)
treef1b33a7aed53016189b17cd3f50243b3c8a022de /sql/item_strfunc.cc
parent166e0683c0d45a79716d8913ec9ecaf3177343fa (diff)
parent9b7a7f06c1a56f49a4528f019ec821d3a01934b6 (diff)
downloadmariadb-git-a962160eec233c265900e2754ed2a63ef5e27c5a.tar.gz
Merge with MySQL 5.1, with following additions:
- Moved some code from innodb_plugin to xtradb, to ensure that all tests runs - Did changes in pbxt and maria storage engines becasue of changes in thd->query - Reverted wrong code in sql_table.cc for how ROW_FORMAT is used. This is a re-commit of Monty's merge to eliminate an extra commit from MySQL-5.1.42 that was accidentally included in the merge. This is a merge of the MySQL 5.1.41 clone-off (clone-5.1.41-build). In case there are any extra changes done before final MySQL 5.1.41 release, these will need to be merged later before MariaDB 5.1.41 release.
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 8efc3c98328..5e2c161bbe2 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -632,6 +632,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)))
@@ -645,7 +646,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;
@@ -663,7 +668,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