summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/gen_lex_token.cc2
-rw-r--r--sql/lex.h2
-rw-r--r--sql/sql_lex.cc1
-rw-r--r--sql/sql_yacc.yy34
-rw-r--r--sql/sql_yacc_ora.yy7
5 files changed, 27 insertions, 19 deletions
diff --git a/sql/gen_lex_token.cc b/sql/gen_lex_token.cc
index f8c511e53ff..7e0cfd097f9 100644
--- a/sql/gen_lex_token.cc
+++ b/sql/gen_lex_token.cc
@@ -33,7 +33,7 @@
from bison.
See also YYMAXUTOK.
*/
-#define MY_MAX_TOKEN 1000
+#define MY_MAX_TOKEN 1100
/** Generated token. */
struct gen_lex_token_string
{
diff --git a/sql/lex.h b/sql/lex.h
index 9f0be46e905..9add4e060af 100644
--- a/sql/lex.h
+++ b/sql/lex.h
@@ -176,7 +176,7 @@ static SYMBOL symbols[] = {
{ "DEALLOCATE", SYM(DEALLOCATE_SYM)},
{ "DEC", SYM(DECIMAL_SYM)},
{ "DECIMAL", SYM(DECIMAL_SYM)},
- { "DECLARE", SYM(DECLARE_SYM)},
+ { "DECLARE", SYM(DECLARE_MARIADB_SYM)},
{ "DEFAULT", SYM(DEFAULT)},
{ "DEFINER", SYM(DEFINER_SYM)},
{ "DELAYED", SYM(DELAYED_SYM)},
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index b0072b10c9c..8edb7803943 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -844,6 +844,7 @@ int Lex_input_stream::find_keyword(Lex_ident_cli_st *kwd,
case BEGIN_MARIADB_SYM: return BEGIN_ORACLE_SYM;
case BODY_MARIADB_SYM: return BODY_ORACLE_SYM;
case CONTINUE_MARIADB_SYM: return CONTINUE_ORACLE_SYM;
+ case DECLARE_MARIADB_SYM: return DECLARE_ORACLE_SYM;
case DECODE_MARIADB_SYM: return DECODE_ORACLE_SYM;
case ELSEIF_MARIADB_SYM: return ELSEIF_ORACLE_SYM;
case ELSIF_MARIADB_SYM: return ELSIF_ORACLE_SYM;
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 6a075e70cc5..fe21cf82db9 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -967,7 +967,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token DAY_SECOND_SYM
%token DECIMAL_NUM
%token DECIMAL_SYM /* SQL-2003-R */
-%token DECLARE_SYM /* SQL-2003-R */
+%token DECLARE_MARIADB_SYM /* SQL-2003-R */
+%token DECLARE_ORACLE_SYM /* Oracle-R */
%token DEFAULT /* SQL-2003-R */
%token DELETE_DOMAIN_ID_SYM
%token DELETE_SYM /* SQL-2003-R */
@@ -2149,6 +2150,7 @@ END_OF_INPUT
%type <num> sp_decl_idents sp_decl_idents_init_vars
%type <num> sp_handler_type sp_hcond_list
%type <spcondvalue> sp_cond sp_hcond sqlstate signal_value opt_signal_value
+%type <spblock> sp_decl_handler
%type <spblock> sp_decls sp_decl sp_decl_body sp_decl_variable_list
%type <spname> sp_name
%type <spvar> sp_param_name sp_param_name_and_type
@@ -3503,7 +3505,7 @@ sp_decls:
;
sp_decl:
- DECLARE_SYM sp_decl_body { $$= $2; }
+ DECLARE_MARIADB_SYM sp_decl_body { $$= $2; }
;
@@ -3619,18 +3621,7 @@ sp_decl_body:
$$.vars= $$.hndlrs= $$.curs= 0;
$$.conds= 1;
}
- | sp_handler_type HANDLER_SYM FOR_SYM
- {
- if (unlikely(Lex->sp_handler_declaration_init(thd, $1)))
- MYSQL_YYABORT;
- }
- sp_hcond_list sp_proc_stmt
- {
- if (unlikely(Lex->sp_handler_declaration_finalize(thd, $1)))
- MYSQL_YYABORT;
- $$.vars= $$.conds= $$.curs= 0;
- $$.hndlrs= 1;
- }
+ | sp_decl_handler
| sp_decl_ident CURSOR_SYM
{
Lex->sp_block_init(thd);
@@ -3648,6 +3639,21 @@ sp_decl_body:
}
;
+sp_decl_handler:
+ sp_handler_type HANDLER_SYM FOR_SYM
+ {
+ if (unlikely(Lex->sp_handler_declaration_init(thd, $1)))
+ MYSQL_YYABORT;
+ }
+ sp_hcond_list sp_proc_stmt
+ {
+ if (unlikely(Lex->sp_handler_declaration_finalize(thd, $1)))
+ MYSQL_YYABORT;
+ $$.vars= $$.conds= $$.curs= 0;
+ $$.hndlrs= 1;
+ }
+ ;
+
opt_parenthesized_cursor_formal_parameters:
/* Empty */
| '(' sp_fdparams ')'
diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy
index 87482a51c43..b738b0b4b29 100644
--- a/sql/sql_yacc_ora.yy
+++ b/sql/sql_yacc_ora.yy
@@ -361,7 +361,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token DAY_SECOND_SYM
%token DECIMAL_NUM
%token DECIMAL_SYM /* SQL-2003-R */
-%token DECLARE_SYM /* SQL-2003-R */
+%token DECLARE_MARIADB_SYM /* SQL-2003-R */
+%token DECLARE_ORACLE_SYM /* Oracle-R */
%token DEFAULT /* SQL-2003-R */
%token DELETE_DOMAIN_ID_SYM
%token DELETE_SYM /* SQL-2003-R */
@@ -4462,7 +4463,7 @@ sp_labeled_block:
MYSQL_YYABORT;
}
| sp_block_label
- DECLARE_SYM
+ DECLARE_ORACLE_SYM
{
Lex->sp_block_init(thd, &$1);
}
@@ -4502,7 +4503,7 @@ sp_unlabeled_block:
if (unlikely(Lex->sp_block_finalize(thd, Lex_spblock($4))))
MYSQL_YYABORT;
}
- | DECLARE_SYM
+ | DECLARE_ORACLE_SYM
{
if (unlikely(Lex->maybe_start_compound_statement(thd)))
MYSQL_YYABORT;