Commit cefef6a7 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-17669 Add sql_mode specific tokens for the keyword DECLARE

parent 7f4aee22
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
from bison. from bison.
See also YYMAXUTOK. See also YYMAXUTOK.
*/ */
#define MY_MAX_TOKEN 1000 #define MY_MAX_TOKEN 1100
/** Generated token. */ /** Generated token. */
struct gen_lex_token_string struct gen_lex_token_string
{ {
......
...@@ -176,7 +176,7 @@ static SYMBOL symbols[] = { ...@@ -176,7 +176,7 @@ static SYMBOL symbols[] = {
{ "DEALLOCATE", SYM(DEALLOCATE_SYM)}, { "DEALLOCATE", SYM(DEALLOCATE_SYM)},
{ "DEC", SYM(DECIMAL_SYM)}, { "DEC", SYM(DECIMAL_SYM)},
{ "DECIMAL", SYM(DECIMAL_SYM)}, { "DECIMAL", SYM(DECIMAL_SYM)},
{ "DECLARE", SYM(DECLARE_SYM)}, { "DECLARE", SYM(DECLARE_MARIADB_SYM)},
{ "DEFAULT", SYM(DEFAULT)}, { "DEFAULT", SYM(DEFAULT)},
{ "DEFINER", SYM(DEFINER_SYM)}, { "DEFINER", SYM(DEFINER_SYM)},
{ "DELAYED", SYM(DELAYED_SYM)}, { "DELAYED", SYM(DELAYED_SYM)},
......
...@@ -844,6 +844,7 @@ int Lex_input_stream::find_keyword(Lex_ident_cli_st *kwd, ...@@ -844,6 +844,7 @@ int Lex_input_stream::find_keyword(Lex_ident_cli_st *kwd,
case BEGIN_MARIADB_SYM: return BEGIN_ORACLE_SYM; case BEGIN_MARIADB_SYM: return BEGIN_ORACLE_SYM;
case BODY_MARIADB_SYM: return BODY_ORACLE_SYM; case BODY_MARIADB_SYM: return BODY_ORACLE_SYM;
case CONTINUE_MARIADB_SYM: return CONTINUE_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 DECODE_MARIADB_SYM: return DECODE_ORACLE_SYM;
case ELSEIF_MARIADB_SYM: return ELSEIF_ORACLE_SYM; case ELSEIF_MARIADB_SYM: return ELSEIF_ORACLE_SYM;
case ELSIF_MARIADB_SYM: return ELSIF_ORACLE_SYM; case ELSIF_MARIADB_SYM: return ELSIF_ORACLE_SYM;
......
...@@ -967,7 +967,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); ...@@ -967,7 +967,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token DAY_SECOND_SYM %token DAY_SECOND_SYM
%token DECIMAL_NUM %token DECIMAL_NUM
%token DECIMAL_SYM /* SQL-2003-R */ %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 DEFAULT /* SQL-2003-R */
%token DELETE_DOMAIN_ID_SYM %token DELETE_DOMAIN_ID_SYM
%token DELETE_SYM /* SQL-2003-R */ %token DELETE_SYM /* SQL-2003-R */
...@@ -2149,6 +2150,7 @@ END_OF_INPUT ...@@ -2149,6 +2150,7 @@ END_OF_INPUT
%type <num> sp_decl_idents sp_decl_idents_init_vars %type <num> sp_decl_idents sp_decl_idents_init_vars
%type <num> sp_handler_type sp_hcond_list %type <num> sp_handler_type sp_hcond_list
%type <spcondvalue> sp_cond sp_hcond sqlstate signal_value opt_signal_value %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 <spblock> sp_decls sp_decl sp_decl_body sp_decl_variable_list
%type <spname> sp_name %type <spname> sp_name
%type <spvar> sp_param_name sp_param_name_and_type %type <spvar> sp_param_name sp_param_name_and_type
...@@ -3503,7 +3505,7 @@ sp_decls: ...@@ -3503,7 +3505,7 @@ sp_decls:
; ;
sp_decl: sp_decl:
DECLARE_SYM sp_decl_body { $$= $2; } DECLARE_MARIADB_SYM sp_decl_body { $$= $2; }
; ;
...@@ -3619,18 +3621,7 @@ sp_decl_body: ...@@ -3619,18 +3621,7 @@ sp_decl_body:
$$.vars= $$.hndlrs= $$.curs= 0; $$.vars= $$.hndlrs= $$.curs= 0;
$$.conds= 1; $$.conds= 1;
} }
| sp_handler_type HANDLER_SYM FOR_SYM | sp_decl_handler
{
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_ident CURSOR_SYM | sp_decl_ident CURSOR_SYM
{ {
Lex->sp_block_init(thd); Lex->sp_block_init(thd);
...@@ -3648,6 +3639,21 @@ sp_decl_body: ...@@ -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: opt_parenthesized_cursor_formal_parameters:
/* Empty */ /* Empty */
| '(' sp_fdparams ')' | '(' sp_fdparams ')'
......
...@@ -361,7 +361,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); ...@@ -361,7 +361,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token DAY_SECOND_SYM %token DAY_SECOND_SYM
%token DECIMAL_NUM %token DECIMAL_NUM
%token DECIMAL_SYM /* SQL-2003-R */ %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 DEFAULT /* SQL-2003-R */
%token DELETE_DOMAIN_ID_SYM %token DELETE_DOMAIN_ID_SYM
%token DELETE_SYM /* SQL-2003-R */ %token DELETE_SYM /* SQL-2003-R */
...@@ -4462,7 +4463,7 @@ sp_labeled_block: ...@@ -4462,7 +4463,7 @@ sp_labeled_block:
MYSQL_YYABORT; MYSQL_YYABORT;
} }
| sp_block_label | sp_block_label
DECLARE_SYM DECLARE_ORACLE_SYM
{ {
Lex->sp_block_init(thd, &$1); Lex->sp_block_init(thd, &$1);
} }
...@@ -4502,7 +4503,7 @@ sp_unlabeled_block: ...@@ -4502,7 +4503,7 @@ sp_unlabeled_block:
if (unlikely(Lex->sp_block_finalize(thd, Lex_spblock($4)))) if (unlikely(Lex->sp_block_finalize(thd, Lex_spblock($4))))
MYSQL_YYABORT; MYSQL_YYABORT;
} }
| DECLARE_SYM | DECLARE_ORACLE_SYM
{ {
if (unlikely(Lex->maybe_start_compound_statement(thd))) if (unlikely(Lex->maybe_start_compound_statement(thd)))
MYSQL_YYABORT; MYSQL_YYABORT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment