diff options
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r-- | sql/sql_yacc.yy | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 99b8caed784..1c2dde5d278 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -32,7 +32,6 @@ #define Select Lex->current_select #include "mysql_priv.h" #include "slave.h" -#include "sql_acl.h" #include "lex_symbol.h" #include "item_create.h" #include "sp_head.h" @@ -675,7 +674,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %type <simple_string> remember_name remember_end opt_ident opt_db text_or_password - opt_constraint constraint + opt_constraint constraint ident_or_empty %type <string> text_string opt_gconcat_separator @@ -3236,7 +3235,7 @@ alter: } alter_list {} - | ALTER DATABASE ident + | ALTER DATABASE ident_or_empty { Lex->create_info.default_table_charset= NULL; Lex->create_info.used_fields= 0; @@ -3245,7 +3244,7 @@ alter: { LEX *lex=Lex; lex->sql_command=SQLCOM_ALTER_DB; - lex->name=$3.str; + lex->name= $3; } | ALTER PROCEDURE sp_name { @@ -3289,6 +3288,10 @@ alter: {} ; +ident_or_empty: + /* empty */ { $$= 0; } + | ident { $$= $1.str; }; + alter_list: | DISCARD TABLESPACE { Lex->alter_info.tablespace_op= DISCARD_TABLESPACE; } | IMPORT TABLESPACE { Lex->alter_info.tablespace_op= IMPORT_TABLESPACE; } @@ -5714,19 +5717,7 @@ expr_or_default: opt_insert_update: /* empty */ | ON DUPLICATE_SYM - { - LEX *lex= Lex; - /* - For simplicity, let's forget about INSERT ... SELECT ... UPDATE - for a moment. - */ - if (lex->sql_command != SQLCOM_INSERT) - { - yyerror(ER(ER_SYNTAX_ERROR)); - YYABORT; - } - } - KEY_SYM UPDATE_SYM update_list + KEY_SYM UPDATE_SYM insert_update_list ; /* Update rows in a table */ @@ -5762,16 +5753,26 @@ update: ; update_list: - update_list ',' simple_ident_nospvar equal expr_or_default + update_list ',' update_elem + | update_elem; + +update_elem: + simple_ident_nospvar equal expr_or_default + { + }; + +insert_update_list: + insert_update_list ',' insert_update_elem + | insert_update_elem; + +insert_update_elem: + simple_ident_nospvar equal expr_or_default { - if (add_item_to_list(YYTHD, $3) || add_value_to_list(YYTHD, $5)) + LEX *lex= Lex; + if (lex->update_list.push_back($1) || + lex->value_list.push_back($3)) YYABORT; - } - | simple_ident_nospvar equal expr_or_default - { - if (add_item_to_list(YYTHD, $1) || add_value_to_list(YYTHD, $3)) - YYABORT; - }; + }; opt_low_priority: /* empty */ { $$= YYTHD->update_lock_default; } |