diff options
author | unknown <wax@kishkin.ru> | 2003-03-18 04:07:40 +0500 |
---|---|---|
committer | unknown <wax@kishkin.ru> | 2003-03-18 04:07:40 +0500 |
commit | 0b505fb437eedd1b31c99888247c2259539c095b (patch) | |
tree | d5655e0a1fd7bd5c629fbc934a708f44ea818663 /sql/sql_yacc.yy | |
parent | c312cd45786f22f0fed89d4cb2d6bba7c6c87644 (diff) | |
download | mariadb-git-0b505fb437eedd1b31c99888247c2259539c095b.tar.gz |
This is full commit of group_concat with support subselects
include/mysqld_error.h:
add warning
sql/field.h:
add friend class
sql/item_sum.cc:
add function
sql/item_sum.h:
add class
sql/lex.h:
add lex
sql/mysql_priv.h:
change push_warning
sql/mysqld.cc:
add new option
sql/set_var.cc:
add new system variable
sql/share/english/errmsg.txt:
add new message text
sql/sql_class.h:
change MY_ERROR class
sql/sql_error.cc:
change push_warning
sql/sql_lex.h:
add qorder_list for function
sql/sql_yacc.yy:
add structure of group_concat
BitKeeper/etc/logging_ok:
Logging to logging@openlogging.org accepted
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r-- | sql/sql_yacc.yy | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index b9c0167bc05..92cc2643073 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -332,6 +332,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); %token ROW_SYM %token RTREE_SYM %token SET +%token SEPARATOR_SYM %token SERIAL_SYM %token SERIALIZABLE_SYM %token SESSION_SYM @@ -457,6 +458,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); %token GEOMCOLLFROMTEXT %token GEOMFROMTEXT %token GEOMETRYCOLLECTION +%token GROUP_CONCAT_SYM %token GROUP_UNIQUE_USERS %token HOUR_MINUTE_SYM %token HOUR_SECOND_SYM @@ -567,13 +569,13 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); opt_escape %type <string> - text_string + text_string opt_gconcat_separator %type <num> type int_type real_type order_dir opt_field_spec lock_option udf_type if_exists opt_local opt_table_options table_options table_option opt_if_not_exists opt_var_type opt_var_ident_type - delete_option opt_temporary all_or_any + delete_option opt_temporary all_or_any opt_distinct %type <ulong_num> ULONG_NUM raid_types merge_insert_types @@ -2466,7 +2468,35 @@ sum_expr: | VARIANCE_SYM '(' in_sum_expr ')' { $$=new Item_sum_variance($3); } | SUM_SYM '(' in_sum_expr ')' - { $$=new Item_sum_sum($3); }; + { $$=new Item_sum_sum($3); } + | GROUP_CONCAT_SYM '(' opt_distinct expr_list opt_gorder_clause opt_gconcat_separator ')' + { + $$=new Item_func_group_concat($3,$4,Lex->gorder_list,$6); + $4->empty(); + }; + +opt_distinct: + /* empty */ { $$ = 0; } + |DISTINCT { $$ = 1; }; + +opt_gconcat_separator: + /* empty */ { $$ = new String(" ",1,default_charset_info); } + |SEPARATOR_SYM text_string { $$ = $2; }; + + +opt_gorder_clause: + /* empty */ + { + LEX *lex=Lex; + lex->gorder_list = NULL; + } + | order_clause + { + LEX *lex=Lex; + lex->gorder_list= (SQL_LIST*) sql_memdup((char*) &lex->current_select->order_list,sizeof(st_sql_list)); + lex->current_select->order_list.empty(); + }; + in_sum_expr: opt_all |