diff options
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r-- | sql/item_strfunc.cc | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 54fc427edf0..323810398ec 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -310,6 +310,17 @@ null: return 0; } +void Item_func_concat_ws::split_sum_func(List<Item> &fields) +{ + if (separator->with_sum_func && separator->type() != SUM_FUNC_ITEM) + separator->split_sum_func(fields); + else if (separator->used_tables() || separator->type() == SUM_FUNC_ITEM) + { + fields.push_front(separator); + separator= new Item_ref((Item**) fields.head_ref(), 0, separator->name); + } + Item_str_func::split_sum_func(fields); +} void Item_func_concat_ws::fix_length_and_dec() { @@ -323,6 +334,7 @@ void Item_func_concat_ws::fix_length_and_dec() } used_tables_cache|=separator->used_tables(); const_item_cache&=separator->const_item(); + with_sum_func= with_sum_func || separator->with_sum_func; } void Item_func_concat_ws::update_used_tables() @@ -1221,6 +1233,19 @@ void Item_func_elt::fix_length_and_dec() } +void Item_func_elt::split_sum_func(List<Item> &fields) +{ + if (item->with_sum_func && item->type() != SUM_FUNC_ITEM) + item->split_sum_func(fields); + else if (item->used_tables() || item->type() == SUM_FUNC_ITEM) + { + fields.push_front(item); + item= new Item_ref((Item**) fields.head_ref(), 0, item->name); + } + Item_str_func::split_sum_func(fields); +} + + void Item_func_elt::update_used_tables() { Item_func::update_used_tables(); @@ -1267,6 +1292,19 @@ String *Item_func_elt::val_str(String *str) } +void Item_func_make_set::split_sum_func(List<Item> &fields) +{ + if (item->with_sum_func && item->type() != SUM_FUNC_ITEM) + item->split_sum_func(fields); + else if (item->used_tables() || item->type() == SUM_FUNC_ITEM) + { + fields.push_front(item); + item= new Item_ref((Item**) fields.head_ref(), 0, item->name); + } + Item_str_func::split_sum_func(fields); +} + + void Item_func_make_set::fix_length_and_dec() { max_length=arg_count-1; @@ -1274,6 +1312,7 @@ void Item_func_make_set::fix_length_and_dec() max_length+=args[i]->max_length; used_tables_cache|=item->used_tables(); const_item_cache&=item->const_item(); + with_sum_func= with_sum_func || item->with_sum_func; } |