Commit 6c2dcd86 authored by unknown's avatar unknown

Charset of any string field now can be specified during CREATE TABLE


mysql-test/r/alter_table.result:
  Fix test result according to new SHOW CREATE TABLE and SHOW FIELDS
mysql-test/r/create.result:
  Fix test result according to new SHOW CREATE TABLE and SHOW FIELDS
mysql-test/r/fulltext.result:
  Fix test result according to new SHOW CREATE TABLE and SHOW FIELDS
mysql-test/r/innodb.result:
  Fix test result according to new SHOW CREATE TABLE and SHOW FIELDS
mysql-test/r/merge.result:
  Fix test result according to new SHOW CREATE TABLE and SHOW FIELDS
mysql-test/r/select.result:
  Fix test result according to new SHOW CREATE TABLE and SHOW FIELDS
mysql-test/r/show_check.result:
  Fix test result according to new SHOW CREATE TABLE and SHOW FIELDS
mysql-test/r/symlink.result:
  Fix test result according to new SHOW CREATE TABLE and SHOW FIELDS
mysql-test/r/type_blob.result:
  Fix test result according to new SHOW CREATE TABLE and SHOW FIELDS
mysql-test/r/type_ranges.result:
  Fix test result according to new SHOW CREATE TABLE and SHOW FIELDS
sql/field.cc:
  New format for string fields in SHOW CREATE TABLE and SHOW FIELDS
sql/mysql_priv.h:
  pass charset
sql/sql_parse.cc:
  QQ is now fixed :)
sql/sql_yacc.yy:
  New format for string fields in SHOW CREATE TABLE and SHOW FIELDS
parent cb27688b
...@@ -53,7 +53,7 @@ SHOW FULL COLUMNS FROM t1; ...@@ -53,7 +53,7 @@ SHOW FULL COLUMNS FROM t1;
Field Type Null Key Default Extra Privileges Comment Field Type Null Key Default Extra Privileges Comment
GROUP_ID int(10) unsigned PRI 0 select,insert,update,references GROUP_ID int(10) unsigned PRI 0 select,insert,update,references
LANG_ID smallint(5) unsigned PRI 0 select,insert,update,references LANG_ID smallint(5) unsigned PRI 0 select,insert,update,references
NAME char(80) MUL select,insert,update,references NAME char(80) character set latin1 MUL select,insert,update,references
DROP TABLE t1; DROP TABLE t1;
create table t1 (n int); create table t1 (n int);
insert into t1 values(9),(3),(12),(10); insert into t1 values(9),(3),(12),(10);
...@@ -120,5 +120,5 @@ alter table t2 rename t1, add c char(10) comment "no comment"; ...@@ -120,5 +120,5 @@ alter table t2 rename t1, add c char(10) comment "no comment";
show columns from t1; show columns from t1;
Field Type Null Key Default Extra Field Type Null Key Default Extra
i int(10) unsigned PRI NULL auto_increment i int(10) unsigned PRI NULL auto_increment
c char(10) YES NULL c char(10) character set latin1 YES NULL
drop table t1; drop table t1;
...@@ -72,10 +72,10 @@ create table t1(x varchar(50) ); ...@@ -72,10 +72,10 @@ create table t1(x varchar(50) );
create table t2 select x from t1 where 1=2; create table t2 select x from t1 where 1=2;
describe t1; describe t1;
Field Type Null Key Default Extra Field Type Null Key Default Extra
x varchar(50) YES NULL x varchar(50) character set latin1 YES NULL
describe t2; describe t2;
Field Type Null Key Default Extra Field Type Null Key Default Extra
x char(50) YES NULL x char(50) character set latin1 YES NULL
drop table t2; 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; 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; describe t2;
......
...@@ -136,7 +136,7 @@ show create table t2; ...@@ -136,7 +136,7 @@ show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`ticket` int(11) default NULL, `ticket` int(11) default NULL,
`inhalt` text, `inhalt` text character set latin1,
KEY `tig` (`ticket`), KEY `tig` (`ticket`),
FULLTEXT KEY `tix` (`inhalt`) FULLTEXT KEY `tix` (`inhalt`)
) TYPE=MyISAM ) TYPE=MyISAM
......
...@@ -805,7 +805,7 @@ create table t1 (a char(20), index (a(5))) type=innodb; ...@@ -805,7 +805,7 @@ create table t1 (a char(20), index (a(5))) type=innodb;
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` char(20) default NULL, `a` char(20) character set latin1 default NULL,
KEY `a` (`a`) KEY `a` (`a`)
) TYPE=InnoDB ) TYPE=InnoDB
drop table t1; drop table t1;
......
...@@ -172,7 +172,7 @@ show create table t3; ...@@ -172,7 +172,7 @@ show create table t3;
Table Create Table Table Create Table
t3 CREATE TABLE `t3` ( t3 CREATE TABLE `t3` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL default '0',
`b` char(20) default NULL, `b` char(20) character set latin1 default NULL,
KEY `a` (`a`) KEY `a` (`a`)
) TYPE=MRG_MyISAM UNION=(t1,t2) ) TYPE=MRG_MyISAM UNION=(t1,t2)
create table t4 (a int not null, b char(10), key(a)) type=MERGE UNION=(t1,t2); create table t4 (a int not null, b char(10), key(a)) type=MERGE UNION=(t1,t2);
......
...@@ -3211,17 +3211,17 @@ Field Type Null Key Default Extra Privileges Comment ...@@ -3211,17 +3211,17 @@ Field Type Null Key Default Extra Privileges Comment
auto int(11) PRI NULL auto_increment select,insert,update,references auto int(11) PRI NULL auto_increment select,insert,update,references
fld1 int(6) unsigned zerofill UNI 000000 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 companynr tinyint(2) unsigned zerofill 00 select,insert,update,references
fld3 char(30) MUL select,insert,update,references fld3 char(30) character set latin1 MUL select,insert,update,references
fld4 char(35) select,insert,update,references fld4 char(35) character set latin1 select,insert,update,references
fld5 char(35) select,insert,update,references fld5 char(35) character set latin1 select,insert,update,references
fld6 char(4) select,insert,update,references fld6 char(4) character set latin1 select,insert,update,references
show full columns from t2 from test like 'f%'; show full columns from t2 from test like 'f%';
Field Type Null Key Default Extra Privileges Comment Field Type Null Key Default Extra Privileges Comment
fld1 int(6) unsigned zerofill UNI 000000 select,insert,update,references fld1 int(6) unsigned zerofill UNI 000000 select,insert,update,references
fld3 char(30) MUL select,insert,update,references fld3 char(30) character set latin1 MUL select,insert,update,references
fld4 char(35) select,insert,update,references fld4 char(35) character set latin1 select,insert,update,references
fld5 char(35) select,insert,update,references fld5 char(35) character set latin1 select,insert,update,references
fld6 char(4) select,insert,update,references fld6 char(4) character set latin1 select,insert,update,references
show full columns from t2 from test like 's%'; show full columns from t2 from test like 's%';
Field Type Null Key Default Extra Privileges Comment Field Type Null Key Default Extra Privileges Comment
show keys from t2; show keys from t2;
......
...@@ -94,13 +94,13 @@ show create table t1 ; ...@@ -94,13 +94,13 @@ show create table t1 ;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`test_set` set('val1','val2','val3') NOT NULL default '', `test_set` set('val1','val2','val3') NOT NULL default '',
`name` char(20) default 'O''Brien' COMMENT 'O''Brien as default', `name` char(20) character set latin1 default 'O''Brien' COMMENT 'O''Brien as default',
`c` int(11) NOT NULL default '0' COMMENT 'int column' `c` int(11) NOT NULL default '0' COMMENT 'int column'
) TYPE=MyISAM COMMENT='it''s a table' ) TYPE=MyISAM COMMENT='it''s a table'
show full columns from t1; show full columns from t1;
Field Type Null Key Default Extra Privileges Comment Field Type Null Key Default Extra Privileges Comment
test_set set('val1','val2','val3') select,insert,update,references test_set set('val1','val2','val3') select,insert,update,references
name char(20) YES O'Brien select,insert,update,references O'Brien as default 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 c int(11) 0 select,insert,update,references int column
drop table t1; drop table t1;
create table t1 (a int not null, unique aa (a)); create table t1 (a int not null, unique aa (a));
...@@ -133,7 +133,7 @@ show create table t1; ...@@ -133,7 +133,7 @@ show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL default '0',
`b` char(10) default NULL, `b` char(10) character set latin1 default NULL,
KEY `b` (`b`) KEY `b` (`b`)
) TYPE=MyISAM MIN_ROWS=10 MAX_ROWS=100 AVG_ROW_LENGTH=10 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED COMMENT='test' ) TYPE=MyISAM MIN_ROWS=10 MAX_ROWS=100 AVG_ROW_LENGTH=10 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED COMMENT='test'
alter table t1 MAX_ROWS=200 ROW_FORMAT=dynamic PACK_KEYS=0; alter table t1 MAX_ROWS=200 ROW_FORMAT=dynamic PACK_KEYS=0;
...@@ -141,7 +141,7 @@ show create table t1; ...@@ -141,7 +141,7 @@ show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL default '0',
`b` varchar(10) default NULL, `b` varchar(10) character set latin1 default NULL,
KEY `b` (`b`) KEY `b` (`b`)
) TYPE=MyISAM MIN_ROWS=10 MAX_ROWS=200 AVG_ROW_LENGTH=10 PACK_KEYS=0 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC COMMENT='test' ) TYPE=MyISAM MIN_ROWS=10 MAX_ROWS=200 AVG_ROW_LENGTH=10 PACK_KEYS=0 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC COMMENT='test'
ALTER TABLE t1 AVG_ROW_LENGTH=0 CHECKSUM=0 COMMENT="" MIN_ROWS=0 MAX_ROWS=0 PACK_KEYS=DEFAULT DELAY_KEY_WRITE=0 ROW_FORMAT=default; ALTER TABLE t1 AVG_ROW_LENGTH=0 CHECKSUM=0 COMMENT="" MIN_ROWS=0 MAX_ROWS=0 PACK_KEYS=DEFAULT DELAY_KEY_WRITE=0 ROW_FORMAT=default;
...@@ -149,7 +149,7 @@ show create table t1; ...@@ -149,7 +149,7 @@ show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL default '0',
`b` varchar(10) default NULL, `b` varchar(10) character set latin1 default NULL,
KEY `b` (`b`) KEY `b` (`b`)
) TYPE=MyISAM ) TYPE=MyISAM
drop table t1; drop table t1;
......
...@@ -36,7 +36,7 @@ show create table t9; ...@@ -36,7 +36,7 @@ show create table t9;
Table Create Table Table Create Table
t9 CREATE TABLE `t9` ( t9 CREATE TABLE `t9` (
`a` int(11) NOT NULL auto_increment, `a` int(11) NOT NULL auto_increment,
`b` char(16) NOT NULL default '', `b` char(16) character set latin1 NOT NULL default '',
`c` int(11) NOT NULL default '0', `c` int(11) NOT NULL default '0',
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) TYPE=MyISAM ) TYPE=MyISAM
...@@ -57,7 +57,7 @@ show create table test_mysqltest.t9; ...@@ -57,7 +57,7 @@ show create table test_mysqltest.t9;
Table Create Table Table Create Table
t9 CREATE TABLE `t9` ( t9 CREATE TABLE `t9` (
`a` int(11) NOT NULL auto_increment, `a` int(11) NOT NULL auto_increment,
`b` char(16) NOT NULL default '', `b` char(16) character set latin1 NOT NULL default '',
`c` int(11) NOT NULL default '0', `c` int(11) NOT NULL default '0',
`d` int(11) NOT NULL default '0', `d` int(11) NOT NULL default '0',
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
......
...@@ -38,15 +38,15 @@ update t1 set c="",b=null where c="1"; ...@@ -38,15 +38,15 @@ update t1 set c="",b=null where c="1";
lock tables t1 READ; lock tables t1 READ;
show full fields from t1; show full fields from t1;
Field Type Null Key Default Extra Privileges Comment Field Type Null Key Default Extra Privileges Comment
t text YES NULL select,insert,update,references t text character set latin1 YES NULL select,insert,update,references
c varchar(10) 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 b blob YES NULL select,insert,update,references
d varchar(10) binary YES NULL select,insert,update,references d varchar(10) binary YES NULL select,insert,update,references
lock tables t1 WRITE; lock tables t1 WRITE;
show full fields from t1; show full fields from t1;
Field Type Null Key Default Extra Privileges Comment Field Type Null Key Default Extra Privileges Comment
t text YES NULL select,insert,update,references t text character set latin1 YES NULL select,insert,update,references
c varchar(10) 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 b blob YES NULL select,insert,update,references
d varchar(10) binary YES NULL select,insert,update,references d varchar(10) binary YES NULL select,insert,update,references
unlock tables; unlock tables;
......
...@@ -40,7 +40,7 @@ KEY (options,flags) ...@@ -40,7 +40,7 @@ KEY (options,flags)
show full fields from t1; show full fields from t1;
Field Type Null Key Default Extra Privileges Comment Field Type Null Key Default Extra Privileges Comment
auto int(5) unsigned PRI NULL auto_increment select,insert,update,references auto int(5) unsigned PRI NULL auto_increment select,insert,update,references
string varchar(10) YES hello select,insert,update,references string varchar(10) character set latin1 YES hello select,insert,update,references
tiny tinyint(4) MUL 0 select,insert,update,references tiny tinyint(4) MUL 0 select,insert,update,references
short smallint(6) MUL 1 select,insert,update,references short smallint(6) MUL 1 select,insert,update,references
medium mediumint(8) MUL 0 select,insert,update,references medium mediumint(8) MUL 0 select,insert,update,references
...@@ -170,7 +170,7 @@ update t2 set string="changed" where auto=16; ...@@ -170,7 +170,7 @@ update t2 set string="changed" where auto=16;
show full columns from t1; show full columns from t1;
Field Type Null Key Default Extra Privileges Comment Field Type Null Key Default Extra Privileges Comment
auto int(5) unsigned MUL NULL auto_increment select,insert,update,references auto int(5) unsigned MUL NULL auto_increment select,insert,update,references
string varchar(10) YES new defaul select,insert,update,references string varchar(10) character set latin1 YES new defaul select,insert,update,references
tiny tinyint(4) MUL 0 select,insert,update,references tiny tinyint(4) MUL 0 select,insert,update,references
short smallint(6) MUL 0 select,insert,update,references short smallint(6) MUL 0 select,insert,update,references
medium mediumint(8) MUL 0 select,insert,update,references medium mediumint(8) MUL 0 select,insert,update,references
...@@ -184,19 +184,19 @@ umedium mediumint(8) unsigned MUL 0 select,insert,update,references ...@@ -184,19 +184,19 @@ umedium mediumint(8) unsigned MUL 0 select,insert,update,references
ulong int(11) unsigned MUL 0 select,insert,update,references ulong int(11) unsigned MUL 0 select,insert,update,references
ulonglong bigint(13) unsigned MUL 0 select,insert,update,references ulonglong bigint(13) unsigned MUL 0 select,insert,update,references
time_stamp timestamp(14) YES NULL select,insert,update,references time_stamp timestamp(14) YES NULL select,insert,update,references
date_field varchar(10) YES NULL select,insert,update,references date_field varchar(10) character set latin1 YES NULL select,insert,update,references
time_field time YES NULL select,insert,update,references time_field time YES NULL select,insert,update,references
date_time datetime YES NULL select,insert,update,references date_time datetime YES NULL select,insert,update,references
new_blob_col varchar(20) YES NULL select,insert,update,references new_blob_col varchar(20) character set latin1 YES NULL select,insert,update,references
tinyblob_col tinyblob YES NULL select,insert,update,references tinyblob_col tinyblob YES NULL select,insert,update,references
mediumblob_col mediumblob select,insert,update,references mediumblob_col mediumblob select,insert,update,references
options enum('one','two','tree') MUL one select,insert,update,references options enum('one','two','tree') MUL one select,insert,update,references
flags set('one','two','tree') select,insert,update,references flags set('one','two','tree') select,insert,update,references
new_field varchar(10) new select,insert,update,references new_field varchar(10) character set latin1 new select,insert,update,references
show full columns from t2; show full columns from t2;
Field Type Null Key Default Extra Privileges Comment Field Type Null Key Default Extra Privileges Comment
auto int(5) unsigned 0 select,insert,update,references auto int(5) unsigned 0 select,insert,update,references
string varchar(10) YES new defaul select,insert,update,references string varchar(10) character set latin1 YES new defaul select,insert,update,references
tiny tinyint(4) 0 select,insert,update,references tiny tinyint(4) 0 select,insert,update,references
short smallint(6) 0 select,insert,update,references short smallint(6) 0 select,insert,update,references
medium mediumint(8) 0 select,insert,update,references medium mediumint(8) 0 select,insert,update,references
...@@ -210,15 +210,15 @@ umedium mediumint(8) unsigned 0 select,insert,update,references ...@@ -210,15 +210,15 @@ umedium mediumint(8) unsigned 0 select,insert,update,references
ulong int(11) unsigned 0 select,insert,update,references ulong int(11) unsigned 0 select,insert,update,references
ulonglong bigint(13) unsigned 0 select,insert,update,references ulonglong bigint(13) unsigned 0 select,insert,update,references
time_stamp timestamp(14) YES NULL select,insert,update,references time_stamp timestamp(14) YES NULL select,insert,update,references
date_field varchar(10) YES NULL select,insert,update,references date_field varchar(10) character set latin1 YES NULL select,insert,update,references
time_field time YES NULL select,insert,update,references time_field time YES NULL select,insert,update,references
date_time datetime YES NULL select,insert,update,references date_time datetime YES NULL select,insert,update,references
new_blob_col varchar(20) YES NULL select,insert,update,references new_blob_col varchar(20) character set latin1 YES NULL select,insert,update,references
tinyblob_col tinyblob YES NULL select,insert,update,references tinyblob_col tinyblob YES NULL select,insert,update,references
mediumblob_col mediumblob select,insert,update,references mediumblob_col mediumblob select,insert,update,references
options enum('one','two','tree') one select,insert,update,references options enum('one','two','tree') one select,insert,update,references
flags set('one','two','tree') select,insert,update,references flags set('one','two','tree') select,insert,update,references
new_field varchar(10) new select,insert,update,references new_field varchar(10) character set latin1 new select,insert,update,references
select t1.auto,t2.auto from t1,t2 where t1.auto=t2.auto and ((t1.string<>t2.string and (t1.string is not null or t2.string is not null)) or (t1.tiny<>t2.tiny and (t1.tiny is not null or t2.tiny is not null)) or (t1.short<>t2.short and (t1.short is not null or t2.short is not null)) or (t1.medium<>t2.medium and (t1.medium is not null or t2.medium is not null)) or (t1.long_int<>t2.long_int and (t1.long_int is not null or t2.long_int is not null)) or (t1.longlong<>t2.longlong and (t1.longlong is not null or t2.longlong is not null)) or (t1.real_float<>t2.real_float and (t1.real_float is not null or t2.real_float is not null)) or (t1.real_double<>t2.real_double and (t1.real_double is not null or t2.real_double is not null)) or (t1.utiny<>t2.utiny and (t1.utiny is not null or t2.utiny is not null)) or (t1.ushort<>t2.ushort and (t1.ushort is not null or t2.ushort is not null)) or (t1.umedium<>t2.umedium and (t1.umedium is not null or t2.umedium is not null)) or (t1.ulong<>t2.ulong and (t1.ulong is not null or t2.ulong is not null)) or (t1.ulonglong<>t2.ulonglong and (t1.ulonglong is not null or t2.ulonglong is not null)) or (t1.time_stamp<>t2.time_stamp and (t1.time_stamp is not null or t2.time_stamp is not null)) or (t1.date_field<>t2.date_field and (t1.date_field is not null or t2.date_field is not null)) or (t1.time_field<>t2.time_field and (t1.time_field is not null or t2.time_field is not null)) or (t1.date_time<>t2.date_time and (t1.date_time is not null or t2.date_time is not null)) or (t1.new_blob_col<>t2.new_blob_col and (t1.new_blob_col is not null or t2.new_blob_col is not null)) or (t1.tinyblob_col<>t2.tinyblob_col and (t1.tinyblob_col is not null or t2.tinyblob_col is not null)) or (t1.mediumblob_col<>t2.mediumblob_col and (t1.mediumblob_col is not null or t2.mediumblob_col is not null)) or (t1.options<>t2.options and (t1.options is not null or t2.options is not null)) or (t1.flags<>t2.flags and (t1.flags is not null or t2.flags is not null)) or (t1.new_field<>t2.new_field and (t1.new_field is not null or t2.new_field is not null))); select t1.auto,t2.auto from t1,t2 where t1.auto=t2.auto and ((t1.string<>t2.string and (t1.string is not null or t2.string is not null)) or (t1.tiny<>t2.tiny and (t1.tiny is not null or t2.tiny is not null)) or (t1.short<>t2.short and (t1.short is not null or t2.short is not null)) or (t1.medium<>t2.medium and (t1.medium is not null or t2.medium is not null)) or (t1.long_int<>t2.long_int and (t1.long_int is not null or t2.long_int is not null)) or (t1.longlong<>t2.longlong and (t1.longlong is not null or t2.longlong is not null)) or (t1.real_float<>t2.real_float and (t1.real_float is not null or t2.real_float is not null)) or (t1.real_double<>t2.real_double and (t1.real_double is not null or t2.real_double is not null)) or (t1.utiny<>t2.utiny and (t1.utiny is not null or t2.utiny is not null)) or (t1.ushort<>t2.ushort and (t1.ushort is not null or t2.ushort is not null)) or (t1.umedium<>t2.umedium and (t1.umedium is not null or t2.umedium is not null)) or (t1.ulong<>t2.ulong and (t1.ulong is not null or t2.ulong is not null)) or (t1.ulonglong<>t2.ulonglong and (t1.ulonglong is not null or t2.ulonglong is not null)) or (t1.time_stamp<>t2.time_stamp and (t1.time_stamp is not null or t2.time_stamp is not null)) or (t1.date_field<>t2.date_field and (t1.date_field is not null or t2.date_field is not null)) or (t1.time_field<>t2.time_field and (t1.time_field is not null or t2.time_field is not null)) or (t1.date_time<>t2.date_time and (t1.date_time is not null or t2.date_time is not null)) or (t1.new_blob_col<>t2.new_blob_col and (t1.new_blob_col is not null or t2.new_blob_col is not null)) or (t1.tinyblob_col<>t2.tinyblob_col and (t1.tinyblob_col is not null or t2.tinyblob_col is not null)) or (t1.mediumblob_col<>t2.mediumblob_col and (t1.mediumblob_col is not null or t2.mediumblob_col is not null)) or (t1.options<>t2.options and (t1.options is not null or t2.options is not null)) or (t1.flags<>t2.flags and (t1.flags is not null or t2.flags is not null)) or (t1.new_field<>t2.new_field and (t1.new_field is not null or t2.new_field is not null)));
auto auto auto auto
16 16 16 16
...@@ -231,8 +231,8 @@ show full columns from t2; ...@@ -231,8 +231,8 @@ show full columns from t2;
Field Type Null Key Default Extra Privileges Comment Field Type Null Key Default Extra Privileges Comment
auto bigint(17) unsigned PRI 0 select,insert,update,references auto bigint(17) unsigned PRI 0 select,insert,update,references
t1 bigint(1) 0 select,insert,update,references t1 bigint(1) 0 select,insert,update,references
t2 char(1) select,insert,update,references t2 char(1) character set latin1 select,insert,update,references
t3 mediumtext select,insert,update,references t3 mediumtext character set latin1 select,insert,update,references
t4 mediumblob select,insert,update,references t4 mediumblob select,insert,update,references
select * from t2; select * from t2;
auto t1 t2 t3 t4 auto t1 t2 t3 t4
......
...@@ -3471,6 +3471,11 @@ void Field_string::sql_type(String &res) const ...@@ -3471,6 +3471,11 @@ void Field_string::sql_type(String &res) const
res.length((uint) strlen(res.ptr())); res.length((uint) strlen(res.ptr()));
if (binary_flag) if (binary_flag)
res.append(" binary"); res.append(" binary");
else
{
res.append(" character set ");
res.append(field_charset->name);
}
} }
...@@ -3667,6 +3672,11 @@ void Field_varstring::sql_type(String &res) const ...@@ -3667,6 +3672,11 @@ void Field_varstring::sql_type(String &res) const
res.length((uint) strlen(res.ptr())); res.length((uint) strlen(res.ptr()));
if (binary_flag) if (binary_flag)
res.append(" binary"); res.append(" binary");
else
{
res.append(" character set ");
res.append(field_charset->name);
}
} }
char *Field_varstring::pack(char *to, const char *from, uint max_length) char *Field_varstring::pack(char *to, const char *from, uint max_length)
...@@ -4154,6 +4164,11 @@ void Field_blob::sql_type(String &res) const ...@@ -4154,6 +4164,11 @@ void Field_blob::sql_type(String &res) const
} }
res.set(str,(uint) strlen(str),default_charset_info); res.set(str,(uint) strlen(str),default_charset_info);
res.append(binary_flag ? "blob" : "text"); res.append(binary_flag ? "blob" : "text");
if (!binary_flag)
{
res.append(" character set ");
res.append(field_charset->name);
}
} }
......
...@@ -484,7 +484,7 @@ bool add_field_to_list(char *field_name, enum enum_field_types type, ...@@ -484,7 +484,7 @@ bool add_field_to_list(char *field_name, enum enum_field_types type,
char *length, char *decimal, char *length, char *decimal,
uint type_modifier, uint type_modifier,
Item *default_value, Item *comment, Item *default_value, Item *comment,
char *change, TYPELIB *interval); char *change, TYPELIB *interval,CHARSET_INFO *cs);
void store_position_for_column(const char *name); void store_position_for_column(const char *name);
bool add_to_list(SQL_LIST &list,Item *group,bool asc=0); bool add_to_list(SQL_LIST &list,Item *group,bool asc=0);
TABLE_LIST *add_table_to_list(Table_ident *table,LEX_STRING *alias, TABLE_LIST *add_table_to_list(Table_ident *table,LEX_STRING *alias,
......
...@@ -2824,7 +2824,7 @@ bool add_field_to_list(char *field_name, enum_field_types type, ...@@ -2824,7 +2824,7 @@ bool add_field_to_list(char *field_name, enum_field_types type,
char *length, char *decimals, char *length, char *decimals,
uint type_modifier, uint type_modifier,
Item *default_value, Item *comment, Item *default_value, Item *comment,
char *change, TYPELIB *interval) char *change, TYPELIB *interval, CHARSET_INFO *cs)
{ {
register create_field *new_field; register create_field *new_field;
THD *thd=current_thd; THD *thd=current_thd;
...@@ -2877,7 +2877,7 @@ bool add_field_to_list(char *field_name, enum_field_types type, ...@@ -2877,7 +2877,7 @@ bool add_field_to_list(char *field_name, enum_field_types type,
new_field->change=change; new_field->change=change;
new_field->interval=0; new_field->interval=0;
new_field->pack_length=0; new_field->pack_length=0;
new_field->charset=0; // QQ: To be fixed new_field->charset=cs;
if (!comment) if (!comment)
{ {
......
...@@ -958,6 +958,7 @@ field_spec: ...@@ -958,6 +958,7 @@ field_spec:
LEX *lex=Lex; LEX *lex=Lex;
lex->length=lex->dec=0; lex->type=0; lex->interval=0; lex->length=lex->dec=0; lex->type=0; lex->interval=0;
lex->default_value=lex->comment=0; lex->default_value=lex->comment=0;
lex->charset=default_charset_info;
} }
type opt_attribute type opt_attribute
{ {
...@@ -966,7 +967,7 @@ field_spec: ...@@ -966,7 +967,7 @@ field_spec:
(enum enum_field_types) $3, (enum enum_field_types) $3,
lex->length,lex->dec,lex->type, lex->length,lex->dec,lex->type,
lex->default_value, lex->comment, lex->default_value, lex->comment,
lex->change,lex->interval)) lex->change,lex->interval,lex->charset))
YYABORT; YYABORT;
}; };
...@@ -1009,11 +1010,11 @@ type: ...@@ -1009,11 +1010,11 @@ type:
$$=FIELD_TYPE_LONG_BLOB; } $$=FIELD_TYPE_LONG_BLOB; }
| LONG_SYM VARBINARY { Lex->type|=BINARY_FLAG; | LONG_SYM VARBINARY { Lex->type|=BINARY_FLAG;
$$=FIELD_TYPE_MEDIUM_BLOB; } $$=FIELD_TYPE_MEDIUM_BLOB; }
| LONG_SYM varchar { $$=FIELD_TYPE_MEDIUM_BLOB; } | LONG_SYM varchar opt_binary { $$=FIELD_TYPE_MEDIUM_BLOB; }
| TINYTEXT { $$=FIELD_TYPE_TINY_BLOB; } | TINYTEXT opt_binary { $$=FIELD_TYPE_TINY_BLOB; }
| TEXT_SYM { $$=FIELD_TYPE_BLOB; } | TEXT_SYM opt_binary { $$=FIELD_TYPE_BLOB; }
| MEDIUMTEXT { $$=FIELD_TYPE_MEDIUM_BLOB; } | MEDIUMTEXT opt_binary { $$=FIELD_TYPE_MEDIUM_BLOB; }
| LONGTEXT { $$=FIELD_TYPE_LONG_BLOB; } | LONGTEXT opt_binary { $$=FIELD_TYPE_LONG_BLOB; }
| DECIMAL_SYM float_options field_options | DECIMAL_SYM float_options field_options
{ $$=FIELD_TYPE_DECIMAL;} { $$=FIELD_TYPE_DECIMAL;}
| NUMERIC_SYM float_options field_options | NUMERIC_SYM float_options field_options
...@@ -1287,7 +1288,7 @@ alter_list_item: ...@@ -1287,7 +1288,7 @@ alter_list_item:
(enum enum_field_types) $5, (enum enum_field_types) $5,
lex->length,lex->dec,lex->type, lex->length,lex->dec,lex->type,
lex->default_value, lex->comment, lex->default_value, lex->comment,
$3.str, lex->interval)) $3.str, lex->interval, lex->charset))
YYABORT; YYABORT;
} }
opt_place opt_place
......
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