|
|
|
@ -151,32 +151,11 @@ void ORAerror(THD *thd, const char *s) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static sp_head *make_sp_head(THD *thd, sp_name *name, |
|
|
|
enum stored_procedure_type type) |
|
|
|
{ |
|
|
|
LEX *lex= thd->lex; |
|
|
|
sp_head *sp; |
|
|
|
|
|
|
|
/* Order is important here: new - reset - init */ |
|
|
|
if ((sp= new sp_head())) |
|
|
|
{ |
|
|
|
sp->reset_thd_mem_root(thd); |
|
|
|
sp->init(lex); |
|
|
|
sp->m_type= type; |
|
|
|
if (name) |
|
|
|
sp->init_sp_name(thd, name); |
|
|
|
sp->m_chistics= &lex->sp_chistics; |
|
|
|
lex->sphead= sp; |
|
|
|
} |
|
|
|
bzero(&lex->sp_chistics, sizeof(lex->sp_chistics)); |
|
|
|
return sp; |
|
|
|
} |
|
|
|
|
|
|
|
static bool maybe_start_compound_statement(THD *thd) |
|
|
|
{ |
|
|
|
if (!thd->lex->sphead) |
|
|
|
{ |
|
|
|
if (!make_sp_head(thd, NULL, TYPE_ENUM_PROCEDURE)) |
|
|
|
if (!thd->lex->make_sp_head(thd, NULL, TYPE_ENUM_PROCEDURE)) |
|
|
|
return 1; |
|
|
|
|
|
|
|
Lex->sp_chistics.suid= SP_IS_NOT_SUID; |
|
|
|
@ -322,10 +301,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); |
|
|
|
%parse-param { THD *thd } |
|
|
|
%lex-param { THD *thd } |
|
|
|
/* |
|
|
|
Currently there are 104 shift/reduce conflicts. |
|
|
|
Currently there are 102 shift/reduce conflicts. |
|
|
|
We should not introduce new conflicts any more. |
|
|
|
*/ |
|
|
|
%expect 104 |
|
|
|
%expect 102 |
|
|
|
|
|
|
|
/* |
|
|
|
Comments for TOKENS. |
|
|
|
@ -2157,7 +2136,8 @@ ev_sql_stmt: |
|
|
|
if (lex->sphead) |
|
|
|
my_yyabort_error((ER_EVENT_RECURSION_FORBIDDEN, MYF(0))); |
|
|
|
|
|
|
|
if (!make_sp_head(thd, lex->event_parse_data->identifier, TYPE_ENUM_PROCEDURE)) |
|
|
|
if (!lex->make_sp_head(thd, lex->event_parse_data->identifier, |
|
|
|
TYPE_ENUM_PROCEDURE)) |
|
|
|
MYSQL_YYABORT; |
|
|
|
|
|
|
|
lex->sp_chistics.suid= SP_IS_SUID; //always the definer! |
|
|
|
@ -13834,7 +13814,6 @@ keyword_directly_assignable: |
|
|
|
| EXCLUDE_SYM {} |
|
|
|
| EXECUTE_SYM {} |
|
|
|
| FLUSH_SYM {} |
|
|
|
| FOLLOWS_SYM {} |
|
|
|
| FOLLOWING_SYM {} |
|
|
|
| FORMAT_SYM {} |
|
|
|
| GET_SYM {} |
|
|
|
@ -13843,11 +13822,9 @@ keyword_directly_assignable: |
|
|
|
| INSTALL_SYM {} |
|
|
|
| OPTION {} |
|
|
|
| OPTIONS_SYM {} |
|
|
|
| OTHERS_SYM {} |
|
|
|
| OWNER_SYM {} |
|
|
|
| PARSER_SYM {} |
|
|
|
| PORT_SYM {} |
|
|
|
| PRECEDES_SYM {} |
|
|
|
| PRECEDING_SYM {} |
|
|
|
| PREPARE_SYM {} |
|
|
|
| REMOVE_SYM {} |
|
|
|
@ -13902,6 +13879,13 @@ keyword_directly_assignable: |
|
|
|
TODO: Allow these variables as SP lables when sql_mode=ORACLE. |
|
|
|
TODO: Allow assigning of "SP characteristics" marked variables |
|
|
|
inside compound blocks. |
|
|
|
TODO: Allow "follows" and "precedes" as variables in compound blocks: |
|
|
|
BEGIN |
|
|
|
follows := 10; |
|
|
|
END; |
|
|
|
as they conflict only with non-block FOR EACH ROW statement: |
|
|
|
CREATE TRIGGER .. FOR EACH ROW follows:= 10; |
|
|
|
CREATE TRIGGER .. FOR EACH ROW FOLLOWS tr1 a:= 10; |
|
|
|
*/ |
|
|
|
keyword_directly_not_assignable: |
|
|
|
CONTAINS_SYM { /* SP characteristic */ } |
|
|
|
@ -13917,6 +13901,8 @@ keyword_directly_not_assignable: |
|
|
|
| TRUNCATE_SYM { /* Verb clause. Reserved in Oracle */ } |
|
|
|
| BEGIN_SYM { /* Compound. Reserved in Oracle */ } |
|
|
|
| END { /* Compound. Reserved in Oracle */ } |
|
|
|
| FOLLOWS_SYM { /* Conflicts with assignment in FOR EACH */} |
|
|
|
| PRECEDES_SYM { /* Conflicts with assignment in FOR EACH */} |
|
|
|
; |
|
|
|
|
|
|
|
/* |
|
|
|
@ -15943,7 +15929,7 @@ trigger_tail: |
|
|
|
(*static_cast<st_trg_execution_order*>(&lex->trg_chistics))= ($18); |
|
|
|
lex->trg_chistics.ordering_clause_end= lip->get_cpp_ptr(); |
|
|
|
|
|
|
|
if (!make_sp_head(thd, $5, TYPE_ENUM_TRIGGER)) |
|
|
|
if (!lex->make_sp_head(thd, $5, TYPE_ENUM_TRIGGER)) |
|
|
|
MYSQL_YYABORT; |
|
|
|
|
|
|
|
lex->sphead->set_body_start(thd, lip->get_cpp_tok_start()); |
|
|
|
@ -16005,51 +15991,46 @@ sf_tail: |
|
|
|
FUNCTION_SYM /* $1 */ |
|
|
|
opt_if_not_exists /* $2 */ |
|
|
|
sp_name /* $3 */ |
|
|
|
'(' /* $4 */ |
|
|
|
{ /* $5 */ |
|
|
|
{ |
|
|
|
if (!Lex->make_sp_head_no_recursive(thd, $2, $3, TYPE_ENUM_FUNCTION)) |
|
|
|
MYSQL_YYABORT; |
|
|
|
Lex->spname= $3; |
|
|
|
} |
|
|
|
'(' /* $5 */ |
|
|
|
{ /* $6 */ |
|
|
|
LEX *lex= Lex; |
|
|
|
Lex_input_stream *lip= YYLIP; |
|
|
|
const char* tmp_param_begin; |
|
|
|
|
|
|
|
if (lex->add_create_options_with_check($2)) |
|
|
|
MYSQL_YYABORT; |
|
|
|
lex->spname= $3; |
|
|
|
|
|
|
|
if (lex->sphead) |
|
|
|
my_yyabort_error((ER_SP_NO_RECURSIVE_CREATE, MYF(0), "FUNCTION")); |
|
|
|
|
|
|
|
if (!make_sp_head(thd, $3, TYPE_ENUM_FUNCTION)) |
|
|
|
MYSQL_YYABORT; |
|
|
|
|
|
|
|
tmp_param_begin= lip->get_cpp_tok_start(); |
|
|
|
tmp_param_begin++; |
|
|
|
lex->sphead->m_param_begin= tmp_param_begin; |
|
|
|
} |
|
|
|
sp_fdparam_list /* $6 */ |
|
|
|
')' /* $7 */ |
|
|
|
{ /* $8 */ |
|
|
|
sp_fdparam_list /* $7 */ |
|
|
|
')' /* $8 */ |
|
|
|
{ /* $9 */ |
|
|
|
Lex->sphead->m_param_end= YYLIP->get_cpp_tok_start(); |
|
|
|
} |
|
|
|
RETURNS_SYM /* $9 */ |
|
|
|
{ /* $10 */ |
|
|
|
RETURNS_SYM /* $10 */ |
|
|
|
{ /* $11 */ |
|
|
|
LEX *lex= Lex; |
|
|
|
lex->init_last_field(&lex->sphead->m_return_field_def, NULL, |
|
|
|
thd->variables.collation_database); |
|
|
|
} |
|
|
|
type_with_opt_collate /* $11 */ |
|
|
|
{ /* $12 */ |
|
|
|
type_with_opt_collate /* $12 */ |
|
|
|
{ /* $13 */ |
|
|
|
if (Lex->sphead->fill_field_definition(thd, Lex->last_field)) |
|
|
|
MYSQL_YYABORT; |
|
|
|
} |
|
|
|
sp_c_chistics /* $13 */ |
|
|
|
{ /* $14 */ |
|
|
|
sp_c_chistics /* $14 */ |
|
|
|
{ /* $15 */ |
|
|
|
LEX *lex= thd->lex; |
|
|
|
Lex_input_stream *lip= YYLIP; |
|
|
|
|
|
|
|
lex->sphead->set_body_start(thd, lip->get_cpp_tok_start()); |
|
|
|
} |
|
|
|
sp_tail_is /* $15 */ |
|
|
|
sp_body /* $16 */ |
|
|
|
sp_tail_is /* $16 */ |
|
|
|
sp_body /* $17 */ |
|
|
|
{ |
|
|
|
LEX *lex= thd->lex; |
|
|
|
sp_head *sp= lex->sphead; |
|
|
|
@ -16070,13 +16051,8 @@ sf_tail: |
|
|
|
sp_tail: |
|
|
|
PROCEDURE_SYM opt_if_not_exists sp_name |
|
|
|
{ |
|
|
|
if (Lex->add_create_options_with_check($2)) |
|
|
|
MYSQL_YYABORT; |
|
|
|
|
|
|
|
if (Lex->sphead) |
|
|
|
my_yyabort_error((ER_SP_NO_RECURSIVE_CREATE, MYF(0), "PROCEDURE")); |
|
|
|
|
|
|
|
if (!make_sp_head(thd, $3, TYPE_ENUM_PROCEDURE)) |
|
|
|
if (!Lex->make_sp_head_no_recursive(thd, $2, $3, |
|
|
|
TYPE_ENUM_PROCEDURE)) |
|
|
|
MYSQL_YYABORT; |
|
|
|
Lex->spname= $3; |
|
|
|
} |
|
|
|
|