summaryrefslogtreecommitdiff
path: root/sql/sql_yacc.yy
diff options
context:
space:
mode:
authorunknown <pem@mysql.comhem.se>2004-11-03 13:49:54 +0100
committerunknown <pem@mysql.comhem.se>2004-11-03 13:49:54 +0100
commitebbe5e39edbc41af3c0872ba7320ec296b2e3bd7 (patch)
treefe64f63c422d061ad805d690aa855312e1bfd9fb /sql/sql_yacc.yy
parent09e0503538cbf882cdb1c215a45becfd3826d67a (diff)
downloadmariadb-git-ebbe5e39edbc41af3c0872ba7320ec296b2e3bd7.tar.gz
Various syntax fixes in sql/sql_yacc.yy for stored procedures:
- No RESTICT|CASCADE in DROP SP (since it's not implemented) - Added optional "noise" to FETCH: [[NEXT] FROM] - At least one statement required in all block constructs except BEGIN-END (where zero is allowed) mysql-test/r/sp.result: Modified test cases for optional [[NEXT] FROM] in FETCH. mysql-test/t/sp.test: Modified test cases for optional [[NEXT] FROM] in FETCH. sql/sql_yacc.yy: Various syntax fixes for stored procedures: - No RESTICT|CASCADE in DROP SP (since it's not implemented) - Added optional "noise" to FETCH: [[NEXT] FROM] - At least one statement required in all block constructs except BEGIN-END (where zero is allowed)
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r--sql/sql_yacc.yy36
1 files changed, 23 insertions, 13 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index ca6757f6e4f..55e4381875e 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -792,7 +792,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
sp_c_chistics sp_a_chistics sp_chistic sp_c_chistic
END_OF_INPUT
-%type <NONE> call sp_proc_stmts sp_proc_stmt
+%type <NONE> call sp_proc_stmts sp_proc_stmts1 sp_proc_stmt
%type <num> sp_decl_idents sp_opt_inout sp_handler_type sp_hcond_list
%type <spcondtype> sp_cond sp_hcond
%type <spblock> sp_decls sp_decl
@@ -1507,7 +1507,11 @@ sp_opt_inout:
sp_proc_stmts:
/* Empty */ {}
| sp_proc_stmts { Lex->query_tables= 0; } sp_proc_stmt ';'
+ ;
+sp_proc_stmts1:
+ sp_proc_stmt ';' {}
+ | sp_proc_stmts1 { Lex->query_tables= 0; } sp_proc_stmt ';'
;
sp_decls:
@@ -2070,16 +2074,16 @@ sp_proc_stmt:
i= new sp_instr_copen(sp->instructions(), lex->spcont, offset);
sp->add_instr(i);
}
- | FETCH_SYM ident INTO
+ | FETCH_SYM sp_opt_fetch_noise ident INTO
{
LEX *lex= Lex;
sp_head *sp= lex->sphead;
uint offset;
sp_instr_cfetch *i;
- if (! lex->spcont->find_cursor(&$2, &offset))
+ if (! lex->spcont->find_cursor(&$3, &offset))
{
- net_printf(YYTHD, ER_SP_CURSOR_MISMATCH, $2.str);
+ net_printf(YYTHD, ER_SP_CURSOR_MISMATCH, $3.str);
YYABORT;
}
i= new sp_instr_cfetch(sp->instructions(), lex->spcont, offset);
@@ -2104,6 +2108,12 @@ sp_proc_stmt:
}
;
+sp_opt_fetch_noise:
+ /* Empty */
+ | NEXT_SYM FROM
+ | FROM
+ ;
+
sp_fetch_list:
ident
{
@@ -2164,7 +2174,7 @@ sp_if:
sp->push_backpatch(i, ctx->push_label((char *)"", 0));
sp->add_instr(i);
}
- sp_proc_stmts
+ sp_proc_stmts1
{
sp_head *sp= Lex->sphead;
sp_pcontext *ctx= Lex->spcont;
@@ -2186,7 +2196,7 @@ sp_if:
sp_elseifs:
/* Empty */
| ELSEIF_SYM sp_if
- | ELSE sp_proc_stmts
+ | ELSE sp_proc_stmts1
;
sp_case:
@@ -2218,7 +2228,7 @@ sp_case:
lex->query_tables= 0;
sp->add_instr(i);
}
- sp_proc_stmts
+ sp_proc_stmts1
{
sp_head *sp= Lex->sphead;
sp_pcontext *ctx= Lex->spcont;
@@ -2247,7 +2257,7 @@ sp_whens:
sp->add_instr(i);
}
- | ELSE sp_proc_stmts {}
+ | ELSE sp_proc_stmts1 {}
| WHEN_SYM sp_case {}
;
@@ -2325,7 +2335,7 @@ sp_unlabeled_control:
lex->spcont= ctx->pop_context();
}
| LOOP_SYM
- sp_proc_stmts END LOOP_SYM
+ sp_proc_stmts1 END LOOP_SYM
{
LEX *lex= Lex;
uint ip= lex->sphead->instructions();
@@ -2348,7 +2358,7 @@ sp_unlabeled_control:
lex->query_tables= 0;
sp->add_instr(i);
}
- sp_proc_stmts END WHILE_SYM
+ sp_proc_stmts1 END WHILE_SYM
{
LEX *lex= Lex;
uint ip= lex->sphead->instructions();
@@ -2357,7 +2367,7 @@ sp_unlabeled_control:
lex->sphead->add_instr(i);
}
- | REPEAT_SYM sp_proc_stmts UNTIL_SYM expr END REPEAT_SYM
+ | REPEAT_SYM sp_proc_stmts1 UNTIL_SYM expr END REPEAT_SYM
{
LEX *lex= Lex;
uint ip= lex->sphead->instructions();
@@ -5473,7 +5483,7 @@ drop:
lex->drop_if_exists=$3;
lex->name=$4.str;
}
- | DROP FUNCTION_SYM if_exists sp_name opt_restrict
+ | DROP FUNCTION_SYM if_exists sp_name
{
LEX *lex=Lex;
if (lex->sphead)
@@ -5485,7 +5495,7 @@ drop:
lex->drop_if_exists= $3;
lex->spname= $4;
}
- | DROP PROCEDURE if_exists sp_name opt_restrict
+ | DROP PROCEDURE if_exists sp_name
{
LEX *lex=Lex;
if (lex->sphead)