summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2016-09-17 08:09:10 +0400
committerAlexander Barkov <bar@mariadb.org>2017-04-05 15:02:38 +0400
commit4de26a8e0e1eb7c726c05407c1461c17fc4c3f3a (patch)
treea2e9bd571916e52e88e8c3dcfd968957c5eee974 /sql
parentdecc550fa97faefbf49af1a453b9a0cb532c7e69 (diff)
downloadmariadb-git-4de26a8e0e1eb7c726c05407c1461c17fc4c3f3a.tar.gz
MDEV-10343 Providing compatibility for basic SQL data types
Based on the patch by Dmitry Tolpeko.
Diffstat (limited to 'sql')
-rw-r--r--sql/lex.h3
-rw-r--r--sql/sql_yacc.yy6
-rw-r--r--sql/sql_yacc_ora.yy29
3 files changed, 35 insertions, 3 deletions
diff --git a/sql/lex.h b/sql/lex.h
index 35c9e33d7d9..a83ef373642 100644
--- a/sql/lex.h
+++ b/sql/lex.h
@@ -114,6 +114,7 @@ static SYMBOL symbols[] = {
{ "CIPHER", SYM(CIPHER_SYM)},
{ "CLASS_ORIGIN", SYM(CLASS_ORIGIN_SYM)},
{ "CLIENT", SYM(CLIENT_SYM)},
+ { "CLOB", SYM(CLOB)},
{ "CLOSE", SYM(CLOSE_SYM)},
{ "COALESCE", SYM(COALESCE)},
{ "CODE", SYM(CODE_SYM)},
@@ -472,6 +473,7 @@ static SYMBOL symbols[] = {
{ "QUERY", SYM(QUERY_SYM)},
{ "QUICK", SYM(QUICK)},
{ "RANGE", SYM(RANGE_SYM)},
+ { "RAW", SYM(RAW)},
{ "READ", SYM(READ_SYM)},
{ "READ_ONLY", SYM(READ_ONLY_SYM)},
{ "READ_WRITE", SYM(READ_WRITE_SYM)},
@@ -660,6 +662,7 @@ static SYMBOL symbols[] = {
{ "VARBINARY", SYM(VARBINARY)},
{ "VARCHAR", SYM(VARCHAR)},
{ "VARCHARACTER", SYM(VARCHAR)},
+ { "VARCHAR2", SYM(VARCHAR2)},
{ "VARIABLES", SYM(VARIABLES)},
{ "VARYING", SYM(VARYING)},
{ "VIA", SYM(VIA_SYM)},
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index de5b6b36d8e..b5dc995521e 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1050,6 +1050,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token CLASS_ORIGIN_SYM /* SQL-2003-N */
%token CLIENT_SYM
%token CLOSE_SYM /* SQL-2003-R */
+%token CLOB /* SQL-2003-R */
%token COALESCE /* SQL-2003-N */
%token CODE_SYM
%token COLLATE_SYM /* SQL-2003-R */
@@ -1429,6 +1430,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token QUICK
%token RANGE_SYM /* SQL-2003-R */
%token RANK_SYM
+%token RAW /* Oracle */
%token READS_SYM /* SQL-2003-R */
%token READ_ONLY_SYM
%token READ_SYM /* SQL-2003-N */
@@ -1621,6 +1623,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token VALUE_SYM /* SQL-2003-R */
%token VARBINARY
%token VARCHAR /* SQL-2003-R */
+%token VARCHAR2 /* Oracle */
%token VARIABLES
%token VARIANCE_SYM
%token VARYING /* SQL-2003-R */
@@ -14591,6 +14594,7 @@ keyword_sp:
| CIPHER_SYM {}
| CLIENT_SYM {}
| CLASS_ORIGIN_SYM {}
+ | CLOB {}
| COALESCE {}
| CODE_SYM {}
| COLLATION_SYM {}
@@ -14777,6 +14781,7 @@ keyword_sp:
| QUARTER_SYM {}
| QUERY_SYM {}
| QUICK {}
+ | RAW {}
| READ_ONLY_SYM {}
| REBUILD_SYM {}
| RECOVER_SYM {}
@@ -14863,6 +14868,7 @@ keyword_sp:
| UNTIL_SYM {}
| USER_SYM {}
| USE_FRM {}
+ | VARCHAR2 {}
| VARIABLES {}
| VIEW_SYM {}
| VIRTUAL_SYM {}
diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy
index 5a213c1817d..19cfe41470d 100644
--- a/sql/sql_yacc_ora.yy
+++ b/sql/sql_yacc_ora.yy
@@ -426,6 +426,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token CLASS_ORIGIN_SYM /* SQL-2003-N */
%token CLIENT_SYM
%token CLOSE_SYM /* SQL-2003-R */
+%token CLOB /* SQL-2003-R */
%token COALESCE /* SQL-2003-N */
%token CODE_SYM
%token COLLATE_SYM /* SQL-2003-R */
@@ -805,6 +806,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token QUICK
%token RANGE_SYM /* SQL-2003-R */
%token RANK_SYM
+%token RAW /* Oracle */
%token READS_SYM /* SQL-2003-R */
%token READ_ONLY_SYM
%token READ_SYM /* SQL-2003-N */
@@ -997,6 +999,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token VALUE_SYM /* SQL-2003-R */
%token VARBINARY
%token VARCHAR /* SQL-2003-R */
+%token VARCHAR2 /* Oracle */
%token VARIABLES
%token VARIANCE_SYM
%token VARYING /* SQL-2003-R */
@@ -5680,6 +5683,10 @@ field_type:
{
$$.set(MYSQL_TYPE_VARCHAR, $2);
}
+ | VARCHAR2 field_length opt_binary
+ {
+ $$.set(MYSQL_TYPE_VARCHAR, $2);
+ }
| nvarchar field_length opt_bin_mod
{
$$.set(MYSQL_TYPE_VARCHAR, $2);
@@ -5690,6 +5697,11 @@ field_type:
Lex->charset=&my_charset_bin;
$$.set(MYSQL_TYPE_VARCHAR, $2);
}
+ | RAW field_length
+ {
+ Lex->charset= &my_charset_bin;
+ $$.set(MYSQL_TYPE_VARCHAR, $2);
+ }
| YEAR_SYM opt_field_length field_options
{
if ($2)
@@ -5709,7 +5721,8 @@ field_type:
$$.set(MYSQL_TYPE_YEAR, $2);
}
| DATE_SYM
- { $$.set(MYSQL_TYPE_DATE); }
+ { $$.set(opt_mysql56_temporal_format ?
+ MYSQL_TYPE_DATETIME2 : MYSQL_TYPE_DATETIME, 0); }
| TIME_SYM opt_field_length
{ $$.set(opt_mysql56_temporal_format ?
MYSQL_TYPE_TIME2 : MYSQL_TYPE_TIME, $2); }
@@ -5741,7 +5754,7 @@ field_type:
| BLOB_SYM opt_field_length
{
Lex->charset=&my_charset_bin;
- $$.set(MYSQL_TYPE_BLOB, $2);
+ $$.set(MYSQL_TYPE_LONG_BLOB);
}
| spatial_type float_options srid_option
{
@@ -5779,10 +5792,17 @@ field_type:
{ $$.set(MYSQL_TYPE_MEDIUM_BLOB); }
| LONGTEXT opt_binary
{ $$.set(MYSQL_TYPE_LONG_BLOB); }
+ | CLOB opt_binary
+ { $$.set(MYSQL_TYPE_LONG_BLOB); }
| DECIMAL_SYM float_options field_options
{ $$.set(MYSQL_TYPE_NEWDECIMAL, $2);}
| NUMBER_SYM float_options field_options
- { $$.set(MYSQL_TYPE_NEWDECIMAL, $2);}
+ {
+ if ($2.length() != 0)
+ $$.set(MYSQL_TYPE_NEWDECIMAL, $2);
+ else
+ $$.set(MYSQL_TYPE_DOUBLE);
+ }
| NUMERIC_SYM float_options field_options
{ $$.set(MYSQL_TYPE_NEWDECIMAL, $2);}
| FIXED_SYM float_options field_options
@@ -13969,6 +13989,7 @@ keyword_sp:
| CIPHER_SYM {}
| CLIENT_SYM {}
| CLASS_ORIGIN_SYM {}
+ | CLOB {}
| COALESCE {}
| CODE_SYM {}
| COLLATION_SYM {}
@@ -14155,6 +14176,7 @@ keyword_sp:
| QUARTER_SYM {}
| QUERY_SYM {}
| QUICK {}
+ | RAW {}
| READ_ONLY_SYM {}
| REBUILD_SYM {}
| RECOVER_SYM {}
@@ -14241,6 +14263,7 @@ keyword_sp:
| UNTIL_SYM {}
| USER_SYM {}
| USE_FRM {}
+ | VARCHAR2 {}
| VARIABLES {}
| VIEW_SYM {}
| VIRTUAL_SYM {}