diff options
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r-- | sql/sql_yacc.yy | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index d94118ebfc6..8be025d0423 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -579,7 +579,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); insert_values update delete truncate rename show describe load alter optimize flush reset purge begin commit rollback slave master_def master_defs - repair restore backup analyze check + repair restore backup analyze check start field_list field_list_item field_spec kill select_item_list select_item values_list no_braces limit_clause delete_limit_clause fields opt_values values @@ -657,6 +657,7 @@ verb_clause: | select | set | slave + | start | show | truncate | handler @@ -1328,6 +1329,11 @@ slave: lex->type = 0; }; +start: + START_SYM TRANSACTION_SYM { Lex->sql_command = SQLCOM_BEGIN;} + {} + ; + slave_thread_opts: slave_thread_opt | slave_thread_opts ',' slave_thread_opt; @@ -1999,7 +2005,7 @@ sum_expr: { $$=new Item_sum_and($3); } | BIT_OR '(' in_sum_expr ')' { $$=new Item_sum_or($3); } - | COUNT_SYM '(' '*' ')' + | COUNT_SYM '(' opt_all '*' ')' { $$=new Item_sum_count(new Item_int((int32) 0L,1)); } | COUNT_SYM '(' in_sum_expr ')' { $$=new Item_sum_count($3); } @@ -2017,11 +2023,12 @@ sum_expr: { $$=new Item_sum_sum($3); }; in_sum_expr: + opt_all { Select->in_sum_expr++; } expr { Select->in_sum_expr--; - $$=$2; + $$=$3; }; cast_type: @@ -2092,19 +2099,22 @@ opt_pad: join_table_list: '(' join_table_list ')' { $$=$2; } | join_table { $$=$1; } + | join_table_list ',' join_table_list { $$=$3; } | join_table_list normal_join join_table_list { $$=$3; } | join_table_list STRAIGHT_JOIN join_table_list { $$=$3 ; $$->straight=1; } - | join_table_list INNER_SYM JOIN_SYM join_table_list ON expr - { add_join_on($4,$6); $$=$4; } - | join_table_list INNER_SYM JOIN_SYM join_table_list + | join_table_list normal_join join_table_list ON expr + { add_join_on($3,$5); $$=$3; } + | join_table_list normal_join join_table_list + USING { SELECT_LEX *sel=Select; sel->db1=$1->db; sel->table1=$1->alias; - sel->db2=$4->db; sel->table2=$4->alias; + sel->db2=$3->db; sel->table2=$3->alias; } - USING '(' using_list ')' - { add_join_on($4,$8); $$=$4; } + '(' using_list ')' + { add_join_on($3,$7); $$=$3; } + | join_table_list LEFT opt_outer JOIN_SYM join_table_list ON expr { add_join_on($5,$7); $5->outer_join|=JOIN_TYPE_LEFT; $$=$5; } | join_table_list LEFT opt_outer JOIN_SYM join_table_list @@ -2133,9 +2143,10 @@ join_table_list: { add_join_natural($1,$4); $$=$4; }; normal_join: - ',' {} - | JOIN_SYM {} - | CROSS JOIN_SYM {}; + JOIN_SYM {} + | INNER_SYM JOIN_SYM {} + | CROSS JOIN_SYM {} + ; join_table: { @@ -2232,6 +2243,10 @@ opt_table_alias: | table_alias ident { $$= (LEX_STRING*) sql_memdup(&$2,sizeof(LEX_STRING)); }; +opt_all: + /* empty */ + | ALL + ; where_clause: /* empty */ { Select->where= 0; } |