Commit 371850a4 authored by konstantin@mysql.com's avatar konstantin@mysql.com

Cleanup of Item_func_group_concat

parent 60e7da0a
...@@ -166,7 +166,7 @@ set group_concat_max_len = 1024; ...@@ -166,7 +166,7 @@ set group_concat_max_len = 1024;
select group_concat(sum(a)) from t1 group by grp; select group_concat(sum(a)) from t1 group by grp;
ERROR HY000: Invalid use of group function ERROR HY000: Invalid use of group function
select grp,group_concat(c order by 2) from t1 group by grp; select grp,group_concat(c order by 2) from t1 group by grp;
ERROR 42S22: Unknown column '2' in 'group statement' ERROR 42S22: Unknown column '2' in 'order clause'
drop table t1; drop table t1;
create table t1 ( URL_ID int(11), URL varchar(80)); create table t1 ( URL_ID int(11), URL varchar(80));
create table t2 ( REQ_ID int(11), URL_ID int(11)); create table t2 ( REQ_ID int(11), URL_ID int(11));
......
This diff is collapsed.
...@@ -834,15 +834,26 @@ class MYSQL_ERROR; ...@@ -834,15 +834,26 @@ class MYSQL_ERROR;
class Item_func_group_concat : public Item_sum class Item_func_group_concat : public Item_sum
{ {
THD *item_thd;
TMP_TABLE_PARAM *tmp_table_param; TMP_TABLE_PARAM *tmp_table_param;
uint max_elements_in_tree;
MYSQL_ERROR *warning; MYSQL_ERROR *warning;
uint key_length; String result;
bool tree_mode; String *separator;
TREE tree_base;
TREE *tree;
TABLE *table;
ORDER **order;
TABLE_LIST *tables_list;
uint arg_count_order; // total count of ORDER BY items
uint arg_count_field; // count of arguments
uint count_cut_values;
bool distinct; bool distinct;
bool warning_for_row; bool warning_for_row;
bool always_null; bool always_null;
/*
Following is 0 normal object and pointer to original one for copy
(to correctly free resources)
*/
Item_func_group_concat *original;
friend int group_concat_key_cmp_with_distinct(void* arg, byte* key1, friend int group_concat_key_cmp_with_distinct(void* arg, byte* key1,
byte* key2); byte* key2);
...@@ -854,30 +865,12 @@ class Item_func_group_concat : public Item_sum ...@@ -854,30 +865,12 @@ class Item_func_group_concat : public Item_sum
friend int dump_leaf_key(byte* key, uint32 count __attribute__((unused)), friend int dump_leaf_key(byte* key, uint32 count __attribute__((unused)),
Item_func_group_concat *group_concat_item); Item_func_group_concat *group_concat_item);
public: public:
String result;
String *separator;
TREE tree_base;
TREE *tree;
TABLE *table;
ORDER **order;
TABLE_LIST *tables_list;
ulong group_concat_max_len;
uint arg_count_order;
uint arg_count_field;
uint field_list_offset;
uint count_cut_values;
/*
Following is 0 normal object and pointer to original one for copy
(to correctly free resources)
*/
Item_func_group_concat *original;
Item_func_group_concat(bool is_distinct,List<Item> *is_select, Item_func_group_concat(bool is_distinct,List<Item> *is_select,
SQL_LIST *is_order,String *is_separator); SQL_LIST *is_order,String *is_separator);
Item_func_group_concat(THD *thd, Item_func_group_concat *item); Item_func_group_concat(THD *thd, Item_func_group_concat *item);
~Item_func_group_concat(); ~Item_func_group_concat() {}
void cleanup(); void cleanup();
enum Sumfunctype sum_func () const {return GROUP_CONCAT_FUNC;} enum Sumfunctype sum_func () const {return GROUP_CONCAT_FUNC;}
...@@ -885,11 +878,11 @@ class Item_func_group_concat : public Item_sum ...@@ -885,11 +878,11 @@ class Item_func_group_concat : public Item_sum
virtual Item_result result_type () const { return STRING_RESULT; } virtual Item_result result_type () const { return STRING_RESULT; }
void clear(); void clear();
bool add(); bool add();
void reset_field(); void reset_field() {} // not used
void update_field() {} // not used
bool fix_fields(THD *, TABLE_LIST *, Item **); bool fix_fields(THD *, TABLE_LIST *, Item **);
bool setup(THD *thd); bool setup(THD *thd);
void make_unique(); void make_unique();
virtual void update_field() {}
double val_real() double val_real()
{ {
String *res; res=val_str(&str_value); String *res; res=val_str(&str_value);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment