summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.cc
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2003-01-29 10:38:56 +0200
committerunknown <bell@sanja.is.com.ua>2003-01-29 10:38:56 +0200
commitcec5bc1de7aa1107ec988601de6a3990c6397446 (patch)
tree6a44df5398a1db055b33e2b93ad62a7e8693ceda /sql/item_strfunc.cc
parent72455300841e1b00c312c3a03ace3bcbd57a4d2f (diff)
downloadmariadb-git-cec5bc1de7aa1107ec988601de6a3990c6397446.tar.gz
fixed functions to be able work with group function as argument
made bisone 1.75 compatible code mysql-test/r/group_by.result: test of function with agregate function inside mysql-test/t/group_by.test: test of function with agregate function inside sql/item_cmpfunc.cc: fixed functions to be able work with group function as argument sql/item_cmpfunc.h: fixed functions to be able work with group function as argument sql/item_func.cc: fixed functions to be able work with group function as argument sql/item_func.h: fixed functions to be able work with group function as argument sql/item_strfunc.cc: fixed functions to be able work with group function as argument sql/item_strfunc.h: fixed functions to be able work with group function as argument sql/sql_yacc.yy: made bisone 1.75 compatible code BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r--sql/item_strfunc.cc39
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;
}