Commit 77ace5db authored by Alexander Barkov's avatar Alexander Barkov

(partial) MDEV-12518 Unify sql_yacc.yy and sql_yacc_ora.yy

This is a partial patch for MDEV-12518 unifying:

- Data types: row_type_body vs field_type_row

Fixing sql_yacc_ora.yy: removing field_type_row adding row_type_body instead
parent f3ad96a3
...@@ -3256,7 +3256,7 @@ row_field_definition_list: ...@@ -3256,7 +3256,7 @@ row_field_definition_list:
; ;
row_type_body: row_type_body:
'(' row_field_definition_list ')' { $$= $2; } '(' row_field_definition_list ')' { $$= $2; }
; ;
sp_decl_idents_init_vars: sp_decl_idents_init_vars:
......
...@@ -1095,7 +1095,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); ...@@ -1095,7 +1095,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
case_stmt_body opt_bin_mod case_stmt_body opt_bin_mod
opt_if_exists_table_element opt_if_not_exists_table_element opt_if_exists_table_element opt_if_not_exists_table_element
opt_recursive opt_recursive
type_or_rowtype
%type <object_ddl_options> %type <object_ddl_options>
create_or_replace create_or_replace
...@@ -1353,7 +1352,8 @@ END_OF_INPUT ...@@ -1353,7 +1352,8 @@ END_OF_INPUT
%type <num> view_algorithm view_check_option %type <num> view_algorithm view_check_option
%type <view_suid> view_suid opt_view_suid %type <view_suid> view_suid opt_view_suid
%type <num> sp_decl_idents sp_handler_type sp_hcond_list %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 <spcondvalue> sp_cond sp_hcond sqlstate signal_value opt_signal_value
%type <spblock> sp_decl_body_list opt_sp_decl_body_list %type <spblock> sp_decl_body_list opt_sp_decl_body_list
%type <spblock> sp_decl_non_handler sp_decl_non_handler_list %type <spblock> sp_decl_non_handler sp_decl_non_handler_list
...@@ -1388,7 +1388,7 @@ END_OF_INPUT ...@@ -1388,7 +1388,7 @@ END_OF_INPUT
%type <cond_info_list> condition_information; %type <cond_info_list> condition_information;
%type <spvar_definition> row_field_name row_field_definition %type <spvar_definition> row_field_name row_field_definition
%type <spvar_definition_list> row_field_definition_list field_type_row %type <spvar_definition_list> row_field_definition_list row_type_body
%type <NONE> opt_window_clause window_def_list window_def window_spec %type <NONE> opt_window_clause window_def_list window_def window_spec
%type <lex_str_ptr> window_name %type <lex_str_ptr> window_name
...@@ -2548,13 +2548,13 @@ sp_param_name_and_type: ...@@ -2548,13 +2548,13 @@ sp_param_name_and_type:
{ {
Lex->sphead->fill_spvar_using_type_reference($$= $1, $2); Lex->sphead->fill_spvar_using_type_reference($$= $1, $2);
} }
| sp_param_name field_type_row | sp_param_name ROW_SYM row_type_body
{ {
$$= $1; $$= $1;
$$->field_def.field_name= $$->name; $$->field_def.field_name= $$->name;
Lex->sphead->fill_spvar_definition(thd, &$$->field_def); Lex->sphead->fill_spvar_definition(thd, &$$->field_def);
Lex->sphead->row_fill_field_definitions(thd, $2); Lex->sphead->row_fill_field_definitions(thd, $3);
$$->field_def.set_row_field_definitions($2); $$->field_def.set_row_field_definitions($3);
} }
; ;
...@@ -2580,13 +2580,13 @@ sp_pdparam: ...@@ -2580,13 +2580,13 @@ sp_pdparam:
{ {
Lex->sphead->fill_spvar_using_type_reference($1, $3); Lex->sphead->fill_spvar_using_type_reference($1, $3);
} }
| sp_param_name sp_opt_inout field_type_row | sp_param_name sp_opt_inout ROW_SYM row_type_body
{ {
$1->mode= $2; $1->mode= $2;
$1->field_def.field_name= $1->name; $1->field_def.field_name= $1->name;
Lex->sphead->fill_spvar_definition(thd, &$1->field_def); Lex->sphead->fill_spvar_definition(thd, &$1->field_def);
Lex->sphead->row_fill_field_definitions(thd, $3); Lex->sphead->row_fill_field_definitions(thd, $4);
$1->field_def.set_row_field_definitions($3); $1->field_def.set_row_field_definitions($4);
} }
; ;
...@@ -2769,46 +2769,45 @@ row_field_definition_list: ...@@ -2769,46 +2769,45 @@ row_field_definition_list:
} }
; ;
field_type_row: row_type_body:
ROW_SYM '(' row_field_definition_list ')' { $$= $3; } '(' row_field_definition_list ')' { $$= $2; }
;
type_or_rowtype:
TYPE_SYM { $$= 0; }
| ROWTYPE_SYM { $$= 1; }
; ;
sp_decl_non_handler: sp_decl_idents_init_vars:
sp_decl_idents sp_decl_idents
{ {
Lex->sp_variable_declarations_init(thd, $1); Lex->sp_variable_declarations_init(thd, $1);
} }
;
sp_decl_non_handler:
sp_decl_idents_init_vars
type_with_opt_collate type_with_opt_collate
sp_opt_default sp_opt_default
{ {
if (Lex->sp_variable_declarations_finalize(thd, $1, if (Lex->sp_variable_declarations_finalize(thd, $1,
&Lex->last_field[0], $4)) &Lex->last_field[0], $3))
MYSQL_YYABORT; MYSQL_YYABORT;
$$.init_using_vars($1); $$.init_using_vars($1);
} }
| sp_decl_idents | sp_decl_idents_init_vars
{ optionally_qualified_column_ident '%' TYPE_SYM
Lex->sp_variable_declarations_init(thd, $1);
}
optionally_qualified_column_ident '%' type_or_rowtype
sp_opt_default sp_opt_default
{ {
if ($5 ? if (Lex->sp_variable_declarations_with_ref_finalize(thd, $1, $2, $5))
Lex->sp_variable_declarations_rowtype_finalize(thd, $1, $3, $6) :
Lex->sp_variable_declarations_with_ref_finalize(thd, $1, $3, $6))
MYSQL_YYABORT; MYSQL_YYABORT;
$$.init_using_vars($1); $$.init_using_vars($1);
} }
| sp_decl_idents | sp_decl_idents_init_vars
optionally_qualified_column_ident '%' ROWTYPE_SYM
sp_opt_default
{ {
Lex->sp_variable_declarations_init(thd, $1); if (Lex->sp_variable_declarations_rowtype_finalize(thd, $1, $2, $5))
MYSQL_YYABORT;
$$.init_using_vars($1);
} }
field_type_row | sp_decl_idents_init_vars
ROW_SYM row_type_body
sp_opt_default sp_opt_default
{ {
if (Lex->sp_variable_declarations_row_finalize(thd, $1, $3, $4)) if (Lex->sp_variable_declarations_row_finalize(thd, $1, $3, $4))
...@@ -4651,9 +4650,11 @@ size_number: ...@@ -4651,9 +4650,11 @@ size_number:
case 'g': case 'g':
case 'G': case 'G':
text_shift_number+=10; text_shift_number+=10;
/* fall through */
case 'm': case 'm':
case 'M': case 'M':
text_shift_number+=10; text_shift_number+=10;
/* fall through */
case 'k': case 'k':
case 'K': case 'K':
text_shift_number+=10; text_shift_number+=10;
......
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