Commit bf6480ba authored by unknown's avatar unknown

New syntax:

CREATE TABLE t1(a NVARCHAR(10))
This is for compatibility with MSSQL, DB2, Informix and some other DBMSs.

Note, standard SQL doesn't have "NVARCHAR" syntax.
There are only these syntaxes in SQL2003:
 NATIONAL VARCHAR
 NCHAR VARCHAR
 NATIONAL CHARACTER VARYING 
 NCHAR VARYING

- Tests were added for all the above syntaxes.


sql/lex.h:
  New syntax:
  
  CREATE TABLE t1(a NVARCHAR(10))
  This is for compatibility with MSSQL, DB2, Informix and some other DBMSs.
  
  Note, standard SQL doesn't have "NVARCHAR" syntax.
  There are only these syntaxes in SQL2003:
   NATIONAL VARCHAR
   NCHAR VARCHAR
   NATIONAL CHARACTER VARYING 
   NCHAR VARYING
sql/sql_yacc.yy:
  New syntax:
  
  CREATE TABLE t1(a NVARCHAR(10))
  This is for compatibility with MSSQL, DB2, Informix and some other DBMSs.
  
  Note, standard SQL doesn't have "NVARCHAR" syntax.
  There are only these syntaxes in SQL2003:
   NATIONAL VARCHAR
   NCHAR VARCHAR
   NATIONAL CHARACTER VARYING 
   NCHAR VARYING
parent 5d1b299f
#
# Test nchar/nvarchar
#
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1 (c nchar(10));
show create table t1;
drop table t1;
create table t1 (c national char(10));
show create table t1;
drop table t1;
create table t1 (c national varchar(10));
show create table t1;
drop table t1;
create table t1 (c nvarchar(10));
show create table t1;
drop table t1;
create table t1 (c nchar varchar(10));
show create table t1;
drop table t1;
create table t1 (c national character varying(10));
show create table t1;
drop table t1;
create table t1 (c nchar varying(10));
show create table t1;
drop table t1;
...@@ -293,6 +293,7 @@ static SYMBOL symbols[] = { ...@@ -293,6 +293,7 @@ static SYMBOL symbols[] = {
{ "NOT", SYM(NOT),0,0}, { "NOT", SYM(NOT),0,0},
{ "NULL", SYM(NULL_SYM),0,0}, { "NULL", SYM(NULL_SYM),0,0},
{ "NUMERIC", SYM(NUMERIC_SYM),0,0}, { "NUMERIC", SYM(NUMERIC_SYM),0,0},
{ "NVARCHAR", SYM(NVARCHAR_SYM),0,0},
{ "OFFSET", SYM(OFFSET_SYM),0,0}, { "OFFSET", SYM(OFFSET_SYM),0,0},
{ "OLD_PASSWORD", SYM(OLD_PASSWORD),0,0}, { "OLD_PASSWORD", SYM(OLD_PASSWORD),0,0},
{ "ON", SYM(ON),0,0}, { "ON", SYM(ON),0,0},
......
...@@ -302,6 +302,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -302,6 +302,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token NEW_SYM %token NEW_SYM
%token NCHAR_SYM %token NCHAR_SYM
%token NCHAR_STRING %token NCHAR_STRING
%token NVARCHAR_SYM
%token NOT %token NOT
%token NO_SYM %token NO_SYM
%token NULL_SYM %token NULL_SYM
...@@ -1339,6 +1340,7 @@ varchar: ...@@ -1339,6 +1340,7 @@ varchar:
nvarchar: nvarchar:
NATIONAL_SYM VARCHAR {} NATIONAL_SYM VARCHAR {}
| NVARCHAR_SYM {}
| NCHAR_SYM VARCHAR {} | NCHAR_SYM VARCHAR {}
| NATIONAL_SYM CHAR_SYM VARYING {} | NATIONAL_SYM CHAR_SYM VARYING {}
| NCHAR_SYM VARYING {} | NCHAR_SYM VARYING {}
...@@ -4568,6 +4570,7 @@ keyword: ...@@ -4568,6 +4570,7 @@ keyword:
| NEW_SYM {} | NEW_SYM {}
| NO_SYM {} | NO_SYM {}
| NONE_SYM {} | NONE_SYM {}
| NVARCHAR_SYM {}
| OFFSET_SYM {} | OFFSET_SYM {}
| OLD_PASSWORD {} | OLD_PASSWORD {}
| OPEN_SYM {} | OPEN_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