Commit e1dc05a6 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-17687 Add sql_mode specific tokens for keywords BLOB, CLOB, NUMBER, RAW, VARCHAR2

parent cefef6a7
......@@ -88,7 +88,7 @@ static SYMBOL symbols[] = {
{ "BINARY", SYM(BINARY)},
{ "BINLOG", SYM(BINLOG_SYM)},
{ "BIT", SYM(BIT_SYM)},
{ "BLOB", SYM(BLOB_SYM)},
{ "BLOB", SYM(BLOB_MARIADB_SYM)},
{ "BLOCK", SYM(BLOCK_SYM)},
{ "BODY", SYM(BODY_MARIADB_SYM)},
{ "BOOL", SYM(BOOL_SYM)},
......@@ -115,7 +115,7 @@ static SYMBOL symbols[] = {
{ "CIPHER", SYM(CIPHER_SYM)},
{ "CLASS_ORIGIN", SYM(CLASS_ORIGIN_SYM)},
{ "CLIENT", SYM(CLIENT_SYM)},
{ "CLOB", SYM(CLOB)},
{ "CLOB", SYM(CLOB_MARIADB_SYM)},
{ "CLOSE", SYM(CLOSE_SYM)},
{ "COALESCE", SYM(COALESCE)},
{ "CODE", SYM(CODE_SYM)},
......@@ -434,7 +434,7 @@ static SYMBOL symbols[] = {
{ "NOTFOUND", SYM(NOTFOUND_SYM)},
{ "NO_WRITE_TO_BINLOG", SYM(NO_WRITE_TO_BINLOG)},
{ "NULL", SYM(NULL_SYM)},
{ "NUMBER", SYM(NUMBER_SYM)},
{ "NUMBER", SYM(NUMBER_MARIADB_SYM)},
{ "NUMERIC", SYM(NUMERIC_SYM)},
{ "NVARCHAR", SYM(NVARCHAR_SYM)},
{ "OF", SYM(OF_SYM)},
......@@ -497,7 +497,7 @@ static SYMBOL symbols[] = {
{ "QUICK", SYM(QUICK)},
{ "RAISE", SYM(RAISE_MARIADB_SYM)},
{ "RANGE", SYM(RANGE_SYM)},
{ "RAW", SYM(RAW)},
{ "RAW", SYM(RAW_MARIADB_SYM)},
{ "READ", SYM(READ_SYM)},
{ "READ_ONLY", SYM(READ_ONLY_SYM)},
{ "READ_WRITE", SYM(READ_WRITE_SYM)},
......@@ -694,7 +694,7 @@ static SYMBOL symbols[] = {
{ "VARBINARY", SYM(VARBINARY)},
{ "VARCHAR", SYM(VARCHAR)},
{ "VARCHARACTER", SYM(VARCHAR)},
{ "VARCHAR2", SYM(VARCHAR2)},
{ "VARCHAR2", SYM(VARCHAR2_MARIADB_SYM)},
{ "VARIABLES", SYM(VARIABLES)},
{ "VARYING", SYM(VARYING)},
{ "VIA", SYM(VIA_SYM)},
......
......@@ -842,7 +842,9 @@ int Lex_input_stream::find_keyword(Lex_ident_cli_st *kwd,
{
switch (symbol->tok) {
case BEGIN_MARIADB_SYM: return BEGIN_ORACLE_SYM;
case BLOB_MARIADB_SYM: return BLOB_ORACLE_SYM;
case BODY_MARIADB_SYM: return BODY_ORACLE_SYM;
case CLOB_MARIADB_SYM: return CLOB_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;
......@@ -851,11 +853,14 @@ int Lex_input_stream::find_keyword(Lex_ident_cli_st *kwd,
case EXCEPTION_MARIADB_SYM: return EXCEPTION_ORACLE_SYM;
case EXIT_MARIADB_SYM: return EXIT_ORACLE_SYM;
case GOTO_MARIADB_SYM: return GOTO_ORACLE_SYM;
case NUMBER_MARIADB_SYM: return NUMBER_ORACLE_SYM;
case OTHERS_MARIADB_SYM: return OTHERS_ORACLE_SYM;
case PACKAGE_MARIADB_SYM: return PACKAGE_ORACLE_SYM;
case RAISE_MARIADB_SYM: return RAISE_ORACLE_SYM;
case RAW_MARIADB_SYM: return RAW_ORACLE_SYM;
case RETURN_MARIADB_SYM: return RETURN_ORACLE_SYM;
case ROWTYPE_MARIADB_SYM: return ROWTYPE_ORACLE_SYM;
case VARCHAR2_MARIADB_SYM: return VARCHAR2_ORACLE_SYM;
}
}
......
......@@ -931,7 +931,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token BIT_AND /* MYSQL-FUNC */
%token BIT_OR /* MYSQL-FUNC */
%token BIT_XOR /* MYSQL-FUNC */
%token BLOB_SYM /* SQL-2003-R */
%token BLOB_MARIADB_SYM /* SQL-2003-R */
%token BLOB_ORACLE_SYM /* Oracle-R */
%token BODY_ORACLE_SYM /* Oracle-R */
%token BOTH /* SQL-2003-R */
%token BY /* SQL-2003-R */
......@@ -1272,7 +1273,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> CIPHER_SYM
%token <kwd> CLASS_ORIGIN_SYM /* SQL-2003-N */
%token <kwd> CLIENT_SYM
%token <kwd> CLOB /* SQL-2003-R */
%token <kwd> CLOB_MARIADB_SYM /* SQL-2003-R */
%token <kwd> CLOB_ORACLE_SYM /* Oracle-R */
%token <kwd> CLOSE_SYM /* SQL-2003-R */
%token <kwd> COALESCE /* SQL-2003-N */
%token <kwd> CODE_SYM
......@@ -1477,7 +1479,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> NOMINVALUE_SYM
%token <kwd> NO_WAIT_SYM
%token <kwd> NOWAIT_SYM
%token <kwd> NUMBER_SYM /* SQL-2003-N, Oracle-R, PLSQL-R */
%token <kwd> NUMBER_MARIADB_SYM /* SQL-2003-N */
%token <kwd> NUMBER_ORACLE_SYM /* Oracle-R, PLSQL-R */
%token <kwd> NVARCHAR_SYM
%token <kwd> OF_SYM /* SQL-1992-R, Oracle-R */
%token <kwd> OFFSET_SYM
......@@ -1519,7 +1522,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> QUARTER_SYM
%token <kwd> QUERY_SYM
%token <kwd> QUICK
%token <kwd> RAW /* Oracle-R */
%token <kwd> RAW_MARIADB_SYM
%token <kwd> RAW_ORACLE_SYM /* Oracle-R */
%token <kwd> READ_ONLY_SYM
%token <kwd> REBUILD_SYM
%token <kwd> RECOVER_SYM
......@@ -1638,7 +1642,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> USER_SYM /* SQL-2003-R */
%token <kwd> USE_FRM
%token <kwd> VALUE_SYM /* SQL-2003-R */
%token <kwd> VARCHAR2 /* Oracle-R, PLSQL-R */
%token <kwd> VARCHAR2_MARIADB_SYM
%token <kwd> VARCHAR2_ORACLE_SYM /* Oracle-R, PLSQL-R */
%token <kwd> VARIABLES
%token <kwd> VERSIONING_SYM /* SQL-2011-R */
%token <kwd> VIA_SYM
......@@ -4008,7 +4013,9 @@ simple_target_specification:
;
statement_information_item_name:
NUMBER_SYM
NUMBER_MARIADB_SYM
{ $$= Statement_information_item::NUMBER; }
| NUMBER_ORACLE_SYM
{ $$= Statement_information_item::NUMBER; }
| ROW_COUNT_SYM
{ $$= Statement_information_item::ROW_COUNT; }
......@@ -6961,6 +6968,13 @@ field_type_numeric:
}
| DECIMAL_SYM float_options field_options
{ $$.set(&type_handler_newdecimal, $2);}
| NUMBER_ORACLE_SYM float_options field_options
{
if ($2.length() != 0)
$$.set(&type_handler_newdecimal, $2);
else
$$.set(&type_handler_double);
}
| NUMERIC_SYM float_options field_options
{ $$.set(&type_handler_newdecimal, $2);}
| FIXED_SYM float_options field_options
......@@ -6987,6 +7001,10 @@ field_type_string:
{
$$.set(&type_handler_varchar, $2);
}
| VARCHAR2_ORACLE_SYM field_length opt_binary
{
$$.set(&type_handler_varchar, $2);
}
| nvarchar field_length opt_bin_mod
{
$$.set(&type_handler_varchar, $2);
......@@ -6997,6 +7015,11 @@ field_type_string:
Lex->charset=&my_charset_bin;
$$.set(&type_handler_varchar, $2);
}
| RAW_ORACLE_SYM field_length
{
Lex->charset= &my_charset_bin;
$$.set(&type_handler_varchar, $2);
}
;
field_type_temporal:
......@@ -7063,11 +7086,16 @@ field_type_lob:
Lex->charset=&my_charset_bin;
$$.set(&type_handler_tiny_blob);
}
| BLOB_SYM opt_field_length
| BLOB_MARIADB_SYM opt_field_length
{
Lex->charset=&my_charset_bin;
$$.set(&type_handler_blob, $2);
}
| BLOB_ORACLE_SYM opt_field_length
{
Lex->charset=&my_charset_bin;
$$.set(&type_handler_long_blob);
}
| spatial_type float_options srid_option
{
#ifdef HAVE_SPATIAL
......@@ -7104,6 +7132,8 @@ field_type_lob:
{ $$.set(&type_handler_medium_blob); }
| LONGTEXT opt_binary
{ $$.set(&type_handler_long_blob); }
| CLOB_ORACLE_SYM opt_binary
{ $$.set(&type_handler_long_blob); }
| LONG_SYM opt_binary
{ $$.set(&type_handler_medium_blob); }
| JSON_SYM
......@@ -11649,6 +11679,14 @@ cast_type:
{ Lex->charset= thd->variables.collation_connection; }
opt_binary
{ $$.set(&type_handler_long_blob, $2); }
| VARCHAR field_length
{ Lex->charset= thd->variables.collation_connection; }
opt_binary
{ $$.set(&type_handler_long_blob, $2); }
| VARCHAR2_ORACLE_SYM field_length
{ Lex->charset= thd->variables.collation_connection; }
opt_binary
{ $$.set(&type_handler_long_blob, $2); }
| NCHAR_SYM opt_field_length
{
Lex->charset= national_charset_info;
......@@ -15785,7 +15823,8 @@ keyword_data_type:
BIT_SYM
| BOOLEAN_SYM
| BOOL_SYM
| CLOB
| CLOB_MARIADB_SYM
| CLOB_ORACLE_SYM
| DATE_SYM %prec PREC_BELOW_CONTRACTION_TOKEN2
| DATETIME
| ENUM
......@@ -15800,17 +15839,20 @@ keyword_data_type:
| MULTIPOLYGON
| NATIONAL_SYM
| NCHAR_SYM
| NUMBER_SYM
| NUMBER_MARIADB_SYM
| NUMBER_ORACLE_SYM
| NVARCHAR_SYM
| POINT_SYM
| POLYGON
| RAW
| RAW_MARIADB_SYM
| RAW_ORACLE_SYM
| ROW_SYM
| SERIAL_SYM
| TEXT_SYM
| TIMESTAMP %prec PREC_BELOW_CONTRACTION_TOKEN2
| TIME_SYM %prec PREC_BELOW_CONTRACTION_TOKEN2
| VARCHAR2
| VARCHAR2_MARIADB_SYM
| VARCHAR2_ORACLE_SYM
| YEAR_SYM
;
......
......@@ -325,7 +325,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token BIT_AND /* MYSQL-FUNC */
%token BIT_OR /* MYSQL-FUNC */
%token BIT_XOR /* MYSQL-FUNC */
%token BLOB_SYM /* SQL-2003-R */
%token BLOB_MARIADB_SYM /* SQL-2003-R */
%token BLOB_ORACLE_SYM /* Oracle-R */
%token BODY_ORACLE_SYM /* Oracle-R */
%token BOTH /* SQL-2003-R */
%token BY /* SQL-2003-R */
......@@ -666,7 +667,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> CIPHER_SYM
%token <kwd> CLASS_ORIGIN_SYM /* SQL-2003-N */
%token <kwd> CLIENT_SYM
%token <kwd> CLOB /* SQL-2003-R */
%token <kwd> CLOB_MARIADB_SYM /* SQL-2003-R */
%token <kwd> CLOB_ORACLE_SYM /* Oracle-R */
%token <kwd> CLOSE_SYM /* SQL-2003-R */
%token <kwd> COALESCE /* SQL-2003-N */
%token <kwd> CODE_SYM
......@@ -871,7 +873,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> NOMINVALUE_SYM
%token <kwd> NO_WAIT_SYM
%token <kwd> NOWAIT_SYM
%token <kwd> NUMBER_SYM /* SQL-2003-N, Oracle-R, PLSQL-R */
%token <kwd> NUMBER_MARIADB_SYM /* SQL-2003-N */
%token <kwd> NUMBER_ORACLE_SYM /* Oracle-R, PLSQL-R */
%token <kwd> NVARCHAR_SYM
%token <kwd> OF_SYM /* SQL-1992-R, Oracle-R */
%token <kwd> OFFSET_SYM
......@@ -913,7 +916,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> QUARTER_SYM
%token <kwd> QUERY_SYM
%token <kwd> QUICK
%token <kwd> RAW /* Oracle-R */
%token <kwd> RAW_MARIADB_SYM
%token <kwd> RAW_ORACLE_SYM /* Oracle-R */
%token <kwd> READ_ONLY_SYM
%token <kwd> REBUILD_SYM
%token <kwd> RECOVER_SYM
......@@ -1032,7 +1036,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> USER_SYM /* SQL-2003-R */
%token <kwd> USE_FRM
%token <kwd> VALUE_SYM /* SQL-2003-R */
%token <kwd> VARCHAR2 /* Oracle-R, PLSQL-R */
%token <kwd> VARCHAR2_MARIADB_SYM
%token <kwd> VARCHAR2_ORACLE_SYM /* Oracle-R, PLSQL-R */
%token <kwd> VARIABLES
%token <kwd> VERSIONING_SYM /* SQL-2011-R */
%token <kwd> VIA_SYM
......@@ -3756,7 +3761,9 @@ simple_target_specification:
;
statement_information_item_name:
NUMBER_SYM
NUMBER_MARIADB_SYM
{ $$= Statement_information_item::NUMBER; }
| NUMBER_ORACLE_SYM
{ $$= Statement_information_item::NUMBER; }
| ROW_COUNT_SYM
{ $$= Statement_information_item::ROW_COUNT; }
......@@ -6817,7 +6824,7 @@ field_type_numeric:
}
| DECIMAL_SYM float_options field_options
{ $$.set(&type_handler_newdecimal, $2);}
| NUMBER_SYM float_options field_options
| NUMBER_ORACLE_SYM float_options field_options
{
if ($2.length() != 0)
$$.set(&type_handler_newdecimal, $2);
......@@ -6850,7 +6857,7 @@ field_type_string:
{
$$.set(&type_handler_varchar, $2);
}
| VARCHAR2 field_length opt_binary
| VARCHAR2_ORACLE_SYM field_length opt_binary
{
$$.set(&type_handler_varchar, $2);
}
......@@ -6864,7 +6871,7 @@ field_type_string:
Lex->charset=&my_charset_bin;
$$.set(&type_handler_varchar, $2);
}
| RAW field_length
| RAW_ORACLE_SYM field_length
{
Lex->charset= &my_charset_bin;
$$.set(&type_handler_varchar, $2);
......@@ -6891,7 +6898,7 @@ sp_param_field_type_string:
{
$$.set(&type_handler_varchar, $2);
}
| VARCHAR2 opt_field_length_default_sp_param_varchar opt_binary
| VARCHAR2_ORACLE_SYM opt_field_length_default_sp_param_varchar opt_binary
{
$$.set(&type_handler_varchar, $2);
}
......@@ -6905,7 +6912,7 @@ sp_param_field_type_string:
Lex->charset= &my_charset_bin;
$$.set(&type_handler_varchar, $2);
}
| RAW opt_field_length_default_sp_param_varchar
| RAW_ORACLE_SYM opt_field_length_default_sp_param_varchar
{
Lex->charset= &my_charset_bin;
$$.set(&type_handler_varchar, $2);
......@@ -6977,7 +6984,12 @@ field_type_lob:
Lex->charset=&my_charset_bin;
$$.set(&type_handler_tiny_blob);
}
| BLOB_SYM opt_field_length
| BLOB_MARIADB_SYM opt_field_length
{
Lex->charset=&my_charset_bin;
$$.set(&type_handler_blob, $2);
}
| BLOB_ORACLE_SYM opt_field_length
{
Lex->charset=&my_charset_bin;
$$.set(&type_handler_long_blob);
......@@ -7018,7 +7030,7 @@ field_type_lob:
{ $$.set(&type_handler_medium_blob); }
| LONGTEXT opt_binary
{ $$.set(&type_handler_long_blob); }
| CLOB opt_binary
| CLOB_ORACLE_SYM opt_binary
{ $$.set(&type_handler_long_blob); }
| LONG_SYM opt_binary
{ $$.set(&type_handler_medium_blob); }
......@@ -11617,7 +11629,7 @@ cast_type:
{ Lex->charset= thd->variables.collation_connection; }
opt_binary
{ $$.set(&type_handler_long_blob, $2); }
| VARCHAR2 field_length
| VARCHAR2_ORACLE_SYM field_length
{ Lex->charset= thd->variables.collation_connection; }
opt_binary
{ $$.set(&type_handler_long_blob, $2); }
......@@ -15814,7 +15826,8 @@ keyword_data_type:
BIT_SYM
| BOOLEAN_SYM
| BOOL_SYM
| CLOB
| CLOB_MARIADB_SYM
| CLOB_ORACLE_SYM
| DATE_SYM %prec PREC_BELOW_CONTRACTION_TOKEN2
| DATETIME
| ENUM
......@@ -15829,17 +15842,20 @@ keyword_data_type:
| MULTIPOLYGON
| NATIONAL_SYM
| NCHAR_SYM
| NUMBER_SYM
| NUMBER_MARIADB_SYM
| NUMBER_ORACLE_SYM
| NVARCHAR_SYM
| POINT_SYM
| POLYGON
| RAW
| RAW_MARIADB_SYM
| RAW_ORACLE_SYM
| ROW_SYM
| SERIAL_SYM
| TEXT_SYM
| TIMESTAMP %prec PREC_BELOW_CONTRACTION_TOKEN2
| TIME_SYM %prec PREC_BELOW_CONTRACTION_TOKEN2
| VARCHAR2
| VARCHAR2_MARIADB_SYM
| VARCHAR2_ORACLE_SYM
| YEAR_SYM
;
......
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