diff options
author | Georgi Kodinov <Georgi.Kodinov@Oracle.com> | 2010-08-20 14:22:46 +0300 |
---|---|---|
committer | Georgi Kodinov <Georgi.Kodinov@Oracle.com> | 2010-08-20 14:22:46 +0300 |
commit | a54c3dd5c0080bd6d2834478f5f5b4fc637fcc99 (patch) | |
tree | abdc965c92ac02057c93a78984ba3e9958312d87 /sql/item_sum.cc | |
parent | 3166b9153a4b879446de8bc34802a1c1ab9345ad (diff) | |
parent | bbaad8880e4329d8e01c359051fc39eb3192dda0 (diff) | |
download | mariadb-git-a54c3dd5c0080bd6d2834478f5f5b4fc637fcc99.tar.gz |
merge
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r-- | sql/item_sum.cc | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 611faff66a2..bd6e96aedc6 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -3059,7 +3059,6 @@ Item_func_group_concat::Item_func_group_concat(THD *thd, tree(item->tree), unique_filter(item->unique_filter), table(item->table), - order(item->order), context(item->context), arg_count_order(item->arg_count_order), arg_count_field(item->arg_count_field), @@ -3072,6 +3071,24 @@ Item_func_group_concat::Item_func_group_concat(THD *thd, { quick_group= item->quick_group; result.set_charset(collation.collation); + + /* + Since the ORDER structures pointed to by the elements of the 'order' array + may be modified in find_order_in_list() called from + Item_func_group_concat::setup(), create a copy of those structures so that + such modifications done in this object would not have any effect on the + object being copied. + */ + ORDER *tmp; + if (!(order= (ORDER **) thd->alloc(sizeof(ORDER *) * arg_count_order + + sizeof(ORDER) * arg_count_order))) + return; + tmp= (ORDER *)(order + arg_count_order); + for (uint i= 0; i < arg_count_order; i++, tmp++) + { + memcpy(tmp, item->order[i], sizeof(ORDER)); + order[i]= tmp; + } } |