Commit 6383a27b authored by unknown's avatar unknown

Separating CHARSET and COLLATION terms


mysql-test/r/alter_table.result:
  SHOW FIELDS and SHOW CREATE TABLE now displays collation
mysql-test/r/create.result:
  SHOW FIELDS and SHOW CREATE TABLE now displays collation
mysql-test/r/innodb.result:
  SHOW FIELDS and SHOW CREATE TABLE now displays collation
mysql-test/r/isam.result:
  SHOW FIELDS and SHOW CREATE TABLE now displays collation
mysql-test/r/select.result:
  SHOW FIELDS and SHOW CREATE TABLE now displays collation
mysql-test/r/show_check.result:
  SHOW FIELDS and SHOW CREATE TABLE now displays collation
mysql-test/r/type_blob.result:
  SHOW FIELDS and SHOW CREATE TABLE now displays collation
mysql-test/r/type_float.result:
  SHOW FIELDS and SHOW CREATE TABLE now displays collation
mysql-test/r/type_ranges.result:
  SHOW FIELDS and SHOW CREATE TABLE now displays collation
sql/field.cc:
  In field type charset rather than collation name is displayed
sql/sql_db.cc:
  COLLATE clause has been added into SHOW CREATE DATABASE
sql/sql_lex.cc:
  Detect charset names rather than collation names
sql/sql_show.cc:
  COLLATION field has been added into SHOW FIELDS
sql/sql_yacc.yy:
  COLLATE syntax has been added in CREATE TABLE/DATABASE
parent 6fb06a7a
......@@ -50,10 +50,10 @@ PRIMARY KEY (GROUP_ID,LANG_ID),
KEY NAME (NAME));
ALTER TABLE t1 CHANGE NAME NAME CHAR(80) not null;
SHOW FULL COLUMNS FROM t1;
Field Type Null Key Default Extra Privileges Comment
GROUP_ID int(10) unsigned PRI 0 select,insert,update,references
LANG_ID smallint(5) unsigned PRI 0 select,insert,update,references
NAME char(80) character set latin1 MUL select,insert,update,references
Field Type Collation Null Key Default Extra Privileges Comment
GROUP_ID int(10) unsigned binary PRI 0 select,insert,update,references
LANG_ID smallint(5) unsigned binary PRI 0 select,insert,update,references
NAME char(80) character set latin1 latin1 MUL select,insert,update,references
DROP TABLE t1;
create table t1 (n int);
insert into t1 values(9),(3),(12),(10);
......@@ -118,7 +118,7 @@ create table t1 (i int unsigned not null auto_increment primary key);
alter table t1 rename t2;
alter table t2 rename t1, add c char(10) comment "no comment";
show columns from t1;
Field Type Null Key Default Extra
i int(10) unsigned PRI NULL auto_increment
c char(10) character set latin1 YES NULL
Field Type Collation Null Key Default Extra
i int(10) unsigned binary PRI NULL auto_increment
c char(10) character set latin1 latin1 YES NULL
drop table t1;
......@@ -75,37 +75,37 @@ drop table t1,t2;
create table t1(x varchar(50) );
create table t2 select x from t1 where 1=2;
describe t1;
Field Type Null Key Default Extra
x varchar(50) character set latin1 YES NULL
Field Type Collation Null Key Default Extra
x varchar(50) character set latin1 latin1 YES NULL
describe t2;
Field Type Null Key Default Extra
x char(50) character set latin1 YES NULL
Field Type Collation Null Key Default Extra
x char(50) character set latin1 latin1 YES NULL
drop table t2;
create table t2 select now() as a , curtime() as b, curdate() as c , 1+1 as d , 1.0 + 1 as e , 33333333333333333 + 3 as f;
describe t2;
Field Type Null Key Default Extra
a datetime 0000-00-00 00:00:00
b time 00:00:00
c date 0000-00-00
d bigint(17) 0
e double(18,1) 0.0
f bigint(17) 0
Field Type Collation Null Key Default Extra
a datetime latin1 0000-00-00 00:00:00
b time latin1 00:00:00
c date latin1 0000-00-00
d bigint(17) binary 0
e double(18,1) binary 0.0
f bigint(17) binary 0
drop table t2;
create table t2 select CAST("2001-12-29" AS DATE) as d, CAST("20:45:11" AS TIME) as t, CAST("2001-12-29 20:45:11" AS DATETIME) as dt;
describe t2;
Field Type Null Key Default Extra
d date 0000-00-00
t time 00:00:00
dt datetime 0000-00-00 00:00:00
Field Type Collation Null Key Default Extra
d date latin1 0000-00-00
t time latin1 00:00:00
dt datetime latin1 0000-00-00 00:00:00
drop table t1,t2;
create table t1 (a tinyint);
create table t2 (a int) select * from t1;
describe t1;
Field Type Null Key Default Extra
a tinyint(4) YES NULL
Field Type Collation Null Key Default Extra
a tinyint(4) binary YES NULL
describe t2;
Field Type Null Key Default Extra
a int(11) YES NULL
Field Type Collation Null Key Default Extra
a int(11) binary YES NULL
drop table if exists t2;
create table t2 (a int, a float) select * from t1;
Duplicate column name 'a'
......
......@@ -918,8 +918,8 @@ id select_type table type possible_keys key key_len ref rows Extra
drop table t1;
create table t1 (t int not null default 1, key (t)) type=innodb;
desc t1;
Field Type Null Key Default Extra
t int(11) MUL 1
Field Type Collation Null Key Default Extra
t int(11) binary MUL 1
drop table t1;
CREATE TABLE t1 (
number bigint(20) NOT NULL default '0',
......
......@@ -64,15 +64,15 @@ Table Op Msg_type Msg_text
test.t2 check error Table 't2' was not locked with LOCK TABLES
test.t1 check status OK
show columns from t1;
Field Type Null Key Default Extra
a int(11) PRI 0
b int(11) MUL 0
c int(11) 0
Field Type Collation Null Key Default Extra
a int(11) binary PRI 0
b int(11) binary MUL 0
c int(11) binary 0
show full columns from t1;
Field Type Null Key Default Extra Privileges Comment
a int(11) PRI 0 select,insert,update,references
b int(11) MUL 0 select,insert,update,references
c int(11) 0 select,insert,update,references
Field Type Collation Null Key Default Extra Privileges Comment
a int(11) binary PRI 0 select,insert,update,references
b int(11) binary MUL 0 select,insert,update,references
c int(11) binary 0 select,insert,update,references
show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 0 PRIMARY 1 a A 4 NULL NULL BTREE
......
......@@ -3217,23 +3217,23 @@ Tables_in_test (s%)
show tables from test like "t?";
Tables_in_test (t?)
show full columns from t2;
Field Type Null Key Default Extra Privileges Comment
auto int(11) PRI NULL auto_increment select,insert,update,references
fld1 int(6) unsigned zerofill UNI 000000 select,insert,update,references
companynr tinyint(2) unsigned zerofill 00 select,insert,update,references
fld3 char(30) character set latin1 MUL select,insert,update,references
fld4 char(35) character set latin1 select,insert,update,references
fld5 char(35) character set latin1 select,insert,update,references
fld6 char(4) character set latin1 select,insert,update,references
Field Type Collation Null Key Default Extra Privileges Comment
auto int(11) binary PRI NULL auto_increment select,insert,update,references
fld1 int(6) unsigned zerofill binary UNI 000000 select,insert,update,references
companynr tinyint(2) unsigned zerofill binary 00 select,insert,update,references
fld3 char(30) character set latin1 latin1 MUL select,insert,update,references
fld4 char(35) character set latin1 latin1 select,insert,update,references
fld5 char(35) character set latin1 latin1 select,insert,update,references
fld6 char(4) character set latin1 latin1 select,insert,update,references
show full columns from t2 from test like 'f%';
Field Type Null Key Default Extra Privileges Comment
fld1 int(6) unsigned zerofill UNI 000000 select,insert,update,references
fld3 char(30) character set latin1 MUL select,insert,update,references
fld4 char(35) character set latin1 select,insert,update,references
fld5 char(35) character set latin1 select,insert,update,references
fld6 char(4) character set latin1 select,insert,update,references
Field Type Collation Null Key Default Extra Privileges Comment
fld1 int(6) unsigned zerofill binary UNI 000000 select,insert,update,references
fld3 char(30) character set latin1 latin1 MUL select,insert,update,references
fld4 char(35) character set latin1 latin1 select,insert,update,references
fld5 char(35) character set latin1 latin1 select,insert,update,references
fld6 char(4) character set latin1 latin1 select,insert,update,references
show full columns from t2 from test like 's%';
Field Type Null Key Default Extra Privileges Comment
Field Type Collation Null Key Default Extra Privileges Comment
show keys from t2;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t2 0 PRIMARY 1 auto A 1199 NULL NULL BTREE
......
......@@ -98,10 +98,10 @@ t1 CREATE TABLE `t1` (
`c` int(11) NOT NULL default '0' COMMENT 'int column'
) TYPE=MyISAM CHARSET=latin1 COMMENT='it''s a table'
show full columns from t1;
Field Type Null Key Default Extra Privileges Comment
test_set set('val1','val2','val3') character set latin1 select,insert,update,references
name char(20) character set latin1 YES O'Brien select,insert,update,references O'Brien as default
c int(11) 0 select,insert,update,references int column
Field Type Collation Null Key Default Extra Privileges Comment
test_set set('val1','val2','val3') character set latin1 latin1 select,insert,update,references
name char(20) character set latin1 latin1 YES O'Brien select,insert,update,references O'Brien as default
c int(11) binary 0 select,insert,update,references int column
drop table t1;
create table t1 (a int not null, unique aa (a));
show create table t1;
......@@ -155,34 +155,34 @@ t1 CREATE TABLE `t1` (
drop table t1;
create table t1 (a decimal(9,2), b decimal (9,0), e double(9,2), f double(5,0), h float(3,2), i float(3,0));
show columns from t1;
Field Type Null Key Default Extra
a decimal(9,2) YES NULL
b decimal(9,0) YES NULL
e double(9,2) YES NULL
f double(5,0) YES NULL
h float(3,2) YES NULL
i float(3,0) YES NULL
Field Type Collation Null Key Default Extra
a decimal(9,2) binary YES NULL
b decimal(9,0) binary YES NULL
e double(9,2) binary YES NULL
f double(5,0) binary YES NULL
h float(3,2) binary YES NULL
i float(3,0) binary YES NULL
show full columns from t1;
Field Type Null Key Default Extra Privileges Comment
a decimal(9,2) YES NULL select,insert,update,references
b decimal(9,0) YES NULL select,insert,update,references
e double(9,2) YES NULL select,insert,update,references
f double(5,0) YES NULL select,insert,update,references
h float(3,2) YES NULL select,insert,update,references
i float(3,0) YES NULL select,insert,update,references
Field Type Collation Null Key Default Extra Privileges Comment
a decimal(9,2) binary YES NULL select,insert,update,references
b decimal(9,0) binary YES NULL select,insert,update,references
e double(9,2) binary YES NULL select,insert,update,references
f double(5,0) binary YES NULL select,insert,update,references
h float(3,2) binary YES NULL select,insert,update,references
i float(3,0) binary YES NULL select,insert,update,references
drop table t1;
create table t1 (c decimal, d double, f float, r real);
show columns from t1;
Field Type Null Key Default Extra
c decimal(10,0) YES NULL
d double YES NULL
f float YES NULL
r double YES NULL
Field Type Collation Null Key Default Extra
c decimal(10,0) binary YES NULL
d double binary YES NULL
f float binary YES NULL
r double binary YES NULL
drop table t1;
create table t1 (c decimal(3,3), d double(3,3), f float(3,3));
show columns from t1;
Field Type Null Key Default Extra
c decimal(4,3) YES NULL
d double(4,3) YES NULL
f float(4,3) YES NULL
Field Type Collation Null Key Default Extra
c decimal(4,3) binary YES NULL
d double(4,3) binary YES NULL
f float(4,3) binary YES NULL
drop table t1;
drop table if exists t1,t2,t3,t4,t5,t6,t7;
CREATE TABLE t1 (a blob, b text, c blob(250), d text(70000), e text(70000000));
show columns from t1;
Field Type Null Key Default Extra
a blob YES NULL
b text character set latin1 YES NULL
c blob YES NULL
d mediumtext character set latin1 YES NULL
e longtext character set latin1 YES NULL
Field Type Collation Null Key Default Extra
a blob binary YES NULL
b text character set latin1 latin1 YES NULL
c blob binary YES NULL
d mediumtext character set latin1 latin1 YES NULL
e longtext character set latin1 latin1 YES NULL
CREATE TABLE t2 (a char(257), b varchar(70000) binary, c varchar(70000000));
Warnings:
Warning 1244 Converting column 'a' from CHAR to TEXT
Warning 1244 Converting column 'b' from CHAR to BLOB
Warning 1244 Converting column 'c' from CHAR to TEXT
show columns from t2;
Field Type Null Key Default Extra
a text character set latin1 YES NULL
b mediumblob YES NULL
c longtext character set latin1 YES NULL
Field Type Collation Null Key Default Extra
a text character set latin1 latin1 YES NULL
b mediumblob binary YES NULL
c longtext character set latin1 latin1 YES NULL
create table t3 (a long, b long byte);
show create TABLE t3;
Table Create Table
......@@ -69,18 +69,18 @@ insert into t1 values (NULL,NULL,NULL,NULL);
update t1 set c="",b=null where c="1";
lock tables t1 READ;
show full fields from t1;
Field Type Null Key Default Extra Privileges Comment
t text character set latin1 YES NULL select,insert,update,references
c varchar(10) character set latin1 YES NULL select,insert,update,references
b blob YES NULL select,insert,update,references
d varchar(10) binary YES NULL select,insert,update,references
Field Type Collation Null Key Default Extra Privileges Comment
t text character set latin1 latin1 YES NULL select,insert,update,references
c varchar(10) character set latin1 latin1 YES NULL select,insert,update,references
b blob binary YES NULL select,insert,update,references
d varchar(10) binary binary YES NULL select,insert,update,references
lock tables t1 WRITE;
show full fields from t1;
Field Type Null Key Default Extra Privileges Comment
t text character set latin1 YES NULL select,insert,update,references
c varchar(10) character set latin1 YES NULL select,insert,update,references
b blob YES NULL select,insert,update,references
d varchar(10) binary YES NULL select,insert,update,references
Field Type Collation Null Key Default Extra Privileges Comment
t text character set latin1 latin1 YES NULL select,insert,update,references
c varchar(10) character set latin1 latin1 YES NULL select,insert,update,references
b blob binary YES NULL select,insert,update,references
d varchar(10) binary binary YES NULL select,insert,update,references
unlock tables;
select t from t1 where t like "hello";
t
......
......@@ -10,9 +10,9 @@ SELECT 1e1,1.e1,1.0e1,1e+1,1.e+1,1.0e+1,1e-1,1.e-1,1.0e-1;
10 10 10 10 10 10 0.1 0.1 0.1
create table t1 (f1 float(24),f2 float(52));
show full columns from t1;
Field Type Null Key Default Extra Privileges Comment
f1 float YES NULL select,insert,update,references
f2 double YES NULL select,insert,update,references
Field Type Collation Null Key Default Extra Privileges Comment
f1 float binary YES NULL select,insert,update,references
f2 double binary YES NULL select,insert,update,references
insert into t1 values(10,10),(1e+5,1e+5),(1234567890,1234567890),(1e+10,1e+10),(1e+15,1e+15),(1e+20,1e+20),(1e+50,1e+50),(1e+150,1e+150);
insert into t1 values(-10,-10),(1e-5,1e-5),(1e-10,1e-10),(1e-15,1e-15),(1e-20,1e-20),(1e-50,1e-50),(1e-150,1e-150);
select * from t1;
......@@ -69,19 +69,19 @@ min(a)
drop table t1;
create table t1 (f float, f2 float(24), f3 float(6,2), d double, d2 float(53), d3 double(10,3), de decimal, de2 decimal(6), de3 decimal(5,2), n numeric, n2 numeric(8), n3 numeric(5,6));
show full columns from t1;
Field Type Null Key Default Extra Privileges Comment
f float YES NULL select,insert,update,references
f2 float YES NULL select,insert,update,references
f3 float(6,2) YES NULL select,insert,update,references
d double YES NULL select,insert,update,references
d2 double YES NULL select,insert,update,references
d3 double(10,3) YES NULL select,insert,update,references
de decimal(10,0) YES NULL select,insert,update,references
de2 decimal(6,0) YES NULL select,insert,update,references
de3 decimal(5,2) YES NULL select,insert,update,references
n decimal(10,0) YES NULL select,insert,update,references
n2 decimal(8,0) YES NULL select,insert,update,references
n3 decimal(7,6) YES NULL select,insert,update,references
Field Type Collation Null Key Default Extra Privileges Comment
f float binary YES NULL select,insert,update,references
f2 float binary YES NULL select,insert,update,references
f3 float(6,2) binary YES NULL select,insert,update,references
d double binary YES NULL select,insert,update,references
d2 double binary YES NULL select,insert,update,references
d3 double(10,3) binary YES NULL select,insert,update,references
de decimal(10,0) binary YES NULL select,insert,update,references
de2 decimal(6,0) binary YES NULL select,insert,update,references
de3 decimal(5,2) binary YES NULL select,insert,update,references
n decimal(10,0) binary YES NULL select,insert,update,references
n2 decimal(8,0) binary YES NULL select,insert,update,references
n3 decimal(7,6) binary YES NULL select,insert,update,references
drop table t1;
create table t1 (a decimal(7,3) not null, key (a));
insert into t1 values ("0"),("-0.00"),("-0.01"),("-0.002"),("1");
......
This diff is collapsed.
......@@ -258,7 +258,7 @@ void Field_str::add_binary_or_charset(String &res) const
if (binary())
len=cs->snprintf(cs,end,len," binary");
else
len=cs->snprintf(cs,end,len," character set %s",field_charset->name);
len=cs->snprintf(cs,end,len," character set %s",field_charset->csname);
res.length(oldlen+len);
}
}
......
......@@ -676,9 +676,13 @@ int mysqld_show_create_db(THD *thd, const char *dbname,
to=strxmov(to,"`",dbname,"`", NullS);
if (create.table_charset)
to= strxmov(to," /*!40100 DEFAULT CHARACTER SET ",
create.table_charset->name,"*/",NullS);
{
int cl= (create.table_charset->state & MY_CS_PRIMARY) ? 0 : 1;
to= strxmov(to," /*!40100"
" DEFAULT CHARACTER SET ",create.table_charset->csname,
cl ? " COLLATE " : "", cl ? create.table_charset->name : "",
" */",NullS);
}
protocol->store(path, (uint) (to-path));
if (protocol->write())
......
......@@ -558,7 +558,7 @@ int yylex(void *arg, void *yythd)
*/
if ((yylval->lex_str.str[0]=='_') &&
(lex->charset=get_charset_by_name(yylval->lex_str.str+1,MYF(0))))
(lex->charset=get_charset_by_csname(yylval->lex_str.str+1,MYF(0))))
return(UNDERSCORE_CHARSET);
else
return(IDENT);
......
......@@ -676,6 +676,7 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
List<Item> field_list;
field_list.push_back(new Item_empty_string("Field",NAME_LEN));
field_list.push_back(new Item_empty_string("Type",40));
field_list.push_back(new Item_empty_string("Collation",40));
field_list.push_back(new Item_empty_string("Null",1));
field_list.push_back(new Item_empty_string("Key",3));
field_list.push_back(item=new Item_empty_string("Default",NAME_LEN));
......@@ -721,6 +722,7 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
protocol->store(field->field_name);
field->sql_type(type);
protocol->store(type.ptr(), type.length());
protocol->store(field->charset()->name);
pos=(byte*) ((flags & NOT_NULL_FLAG) &&
field->type() != FIELD_TYPE_TIMESTAMP ?
......@@ -1050,6 +1052,16 @@ store_create_info(THD *thd, TABLE *table, String *packet)
bool has_default = (field->type() != FIELD_TYPE_BLOB &&
field->type() != FIELD_TYPE_TIMESTAMP &&
field->unireg_check != Field::NEXT_NUMBER);
/*
For string types dump collation name only if
collation is not primary for the given charset
*/
if (!field->binary() && !(field->charset()->state & MY_CS_PRIMARY))
{
packet->append(" collate ",9);
packet->append(field->charset()->name);
}
if (flags & NOT_NULL_FLAG)
packet->append(" NOT NULL", 9);
......@@ -1162,7 +1174,12 @@ store_create_info(THD *thd, TABLE *table, String *packet)
if (table->table_charset)
{
packet->append(" CHARSET=");
packet->append(table->table_charset->name);
packet->append(table->table_charset->csname);
if (!(table->table_charset->state & MY_CS_PRIMARY))
{
packet->append(" COLLATE=");
packet->append(table->table_charset->name);
}
}
if (table->min_rows)
......
......@@ -633,7 +633,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%type <charset>
charset_name
charset_name_or_default
opt_default_charset
collation_name
collation_name_or_default
%type <variable> internal_variable_name
......@@ -857,13 +858,14 @@ create:
lex->key_list.push_back(new Key($2,$4.str, $5, lex->col_list));
lex->col_list.empty();
}
| CREATE DATABASE opt_if_not_exists ident opt_default_charset
| CREATE DATABASE opt_if_not_exists ident
{ Lex->create_info.table_charset=NULL; }
opt_create_database_options
{
LEX *lex=Lex;
lex->sql_command=SQLCOM_CREATE_DB;
lex->name=$4.str;
lex->create_info.options=$3;
lex->create_info.table_charset=$5;
}
| CREATE udf_func_type UDF_SYM ident
{
......@@ -907,6 +909,22 @@ opt_as:
/* empty */ {}
| AS {};
opt_create_database_options:
/* empty */ {}
| create_database_options {};
create_database_options:
create_database_option {}
| create_database_options create_database_option {};
create_database_option:
COLLATE_SYM collation_name_or_default
{ Lex->create_info.table_charset=$2; }
| opt_default CHAR_SYM SET charset_name_or_default
{ Lex->create_info.table_charset=$4; }
| opt_default CHARSET charset_name_or_default
{ Lex->create_info.table_charset=$3; };
opt_table_options:
/* empty */ { $$= 0; }
| table_options { $$= $1;};
......@@ -974,6 +992,11 @@ create_table_option:
Lex->create_info.table_charset= $5;
Lex->create_info.used_fields|= HA_CREATE_USED_CHARSET;
}
| COLLATE_SYM opt_equal collation_name_or_default
{
Lex->create_info.table_charset= $3;
Lex->create_info.used_fields|= HA_CREATE_USED_CHARSET;
}
| INSERT_METHOD opt_equal merge_insert_types { Lex->create_info.merge_insert_method= $3; Lex->create_info.used_fields|= HA_CREATE_USED_INSERT_METHOD;}
| DATA_SYM DIRECTORY_SYM opt_equal TEXT_STRING { Lex->create_info.data_file_name= $4.str; }
| INDEX DIRECTORY_SYM opt_equal TEXT_STRING { Lex->create_info.index_file_name= $4.str; };
......@@ -1232,13 +1255,13 @@ attribute:
| UNIQUE_SYM { Lex->type|= UNIQUE_FLAG; }
| UNIQUE_SYM KEY_SYM { Lex->type|= UNIQUE_KEY_FLAG; }
| COMMENT_SYM text_literal { Lex->comment= $2; }
| COLLATE_SYM charset_name { Lex->charset=$2; };
| COLLATE_SYM collation_name { Lex->charset=$2; };
charset_name:
ident
{
if (!($$=get_charset_by_name($1.str,MYF(0))))
if (!($$=get_charset_by_csname($1.str,MYF(0))))
{
net_printf(YYTHD,ER_UNKNOWN_CHARACTER_SET,$1.str);
YYABORT;
......@@ -1249,15 +1272,24 @@ charset_name_or_default:
charset_name { $$=$1; }
| DEFAULT { $$=NULL; } ;
collation_name:
ident
{
if (!($$=get_charset_by_name($1.str,MYF(0))))
{
net_printf(YYTHD,ER_UNKNOWN_CHARACTER_SET,$1.str);
YYABORT;
}
};
collation_name_or_default:
collation_name { $$=$1; }
| DEFAULT { $$=NULL; } ;
opt_default:
/* empty */ {}
| DEFAULT {};
opt_default_charset:
/* empty */ { $$=default_charset_info; }
| opt_default CHAR_SYM SET charset_name_or_default { $$=$4; }
| opt_default CHARSET charset_name_or_default { $$=$3; };
opt_binary:
/* empty */ { Lex->charset=NULL; }
| ASCII_SYM { Lex->charset=my_charset_latin1; }
......@@ -1400,12 +1432,11 @@ alter:
}
alter_list
{}
| ALTER DATABASE ident opt_default_charset
| ALTER DATABASE ident opt_create_database_options
{
LEX *lex=Lex;
lex->sql_command=SQLCOM_ALTER_DB;
lex->name=$3.str;
lex->create_info.table_charset=$4;
};
......@@ -1892,7 +1923,7 @@ expr_expr:
{ $$= new Item_date_add_interval($1,$4,$5,0); }
| expr '-' INTERVAL_SYM expr interval
{ $$= new Item_date_add_interval($1,$4,$5,1); }
| expr COLLATE_SYM charset_name
| expr COLLATE_SYM collation_name
{ $$= new Item_func_set_collation($1,$3); };
/* expressions that begin with 'expr' that do NOT follow IN_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