Loading mysql-test/r/type_enum.result +9 −0 Original line number Diff line number Diff line Loading @@ -1745,3 +1745,12 @@ create table t1 (a set('x','y') default 'x'); alter table t1 alter a set default 'z'; ERROR 42000: Invalid default value for 'a' drop table t1; create table t1 (f1 int); alter table t1 add f2 enum(0xFFFF); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) default NULL, `f2` enum('') default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; mysql-test/t/type_enum.test +9 −0 Original line number Diff line number Diff line Loading @@ -127,4 +127,13 @@ create table t1 (a set('x','y') default 'x'); alter table t1 alter a set default 'z'; drop table t1; # # Bug#20922 mysql removes a name of first column in a table # create table t1 (f1 int); alter table t1 add f2 enum(0xFFFF); show create table t1; drop table t1; # End of 4.1 tests sql/table.cc +15 −1 Original line number Diff line number Diff line Loading @@ -387,7 +387,21 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, count))) goto err_not_open; for (count= 0; count < interval->count; count++) interval->type_lengths[count]= strlen(interval->type_names[count]); { char *val= (char*) interval->type_names[count]; interval->type_lengths[count]= strlen(val); /* Replace all ',' symbols with NAMES_SEP_CHAR. See the comment in unireg.cc, pack_fields() function for details. */ for (uint cnt= 0 ; cnt < interval->type_lengths[count] ; cnt++) { char c= val[cnt]; if (c == ',') val[cnt]= NAMES_SEP_CHAR; } } interval->type_lengths[count]= 0; } } Loading sql/unireg.cc +15 −0 Original line number Diff line number Diff line Loading @@ -637,6 +637,21 @@ static bool pack_fields(File file, List<create_field> &create_fields, tmp.append(NAMES_SEP_CHAR); for (const char **pos=field->interval->type_names ; *pos ; pos++) { char *val= (char*) *pos; uint str_len= strlen(val); /* Note, hack: in old frm NAMES_SEP_CHAR is used to separate names in the interval (ENUM/SET). To allow names to contain NAMES_SEP_CHAR, we replace it with a comma before writing frm. Backward conversion is done during frm file opening, See table.cc, openfrm() function */ for (uint cnt= 0 ; cnt < str_len ; cnt++) { char c= val[cnt]; if (c == NAMES_SEP_CHAR) val[cnt]= ','; } tmp.append(*pos); tmp.append(NAMES_SEP_CHAR); } Loading Loading
mysql-test/r/type_enum.result +9 −0 Original line number Diff line number Diff line Loading @@ -1745,3 +1745,12 @@ create table t1 (a set('x','y') default 'x'); alter table t1 alter a set default 'z'; ERROR 42000: Invalid default value for 'a' drop table t1; create table t1 (f1 int); alter table t1 add f2 enum(0xFFFF); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) default NULL, `f2` enum('') default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1;
mysql-test/t/type_enum.test +9 −0 Original line number Diff line number Diff line Loading @@ -127,4 +127,13 @@ create table t1 (a set('x','y') default 'x'); alter table t1 alter a set default 'z'; drop table t1; # # Bug#20922 mysql removes a name of first column in a table # create table t1 (f1 int); alter table t1 add f2 enum(0xFFFF); show create table t1; drop table t1; # End of 4.1 tests
sql/table.cc +15 −1 Original line number Diff line number Diff line Loading @@ -387,7 +387,21 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, count))) goto err_not_open; for (count= 0; count < interval->count; count++) interval->type_lengths[count]= strlen(interval->type_names[count]); { char *val= (char*) interval->type_names[count]; interval->type_lengths[count]= strlen(val); /* Replace all ',' symbols with NAMES_SEP_CHAR. See the comment in unireg.cc, pack_fields() function for details. */ for (uint cnt= 0 ; cnt < interval->type_lengths[count] ; cnt++) { char c= val[cnt]; if (c == ',') val[cnt]= NAMES_SEP_CHAR; } } interval->type_lengths[count]= 0; } } Loading
sql/unireg.cc +15 −0 Original line number Diff line number Diff line Loading @@ -637,6 +637,21 @@ static bool pack_fields(File file, List<create_field> &create_fields, tmp.append(NAMES_SEP_CHAR); for (const char **pos=field->interval->type_names ; *pos ; pos++) { char *val= (char*) *pos; uint str_len= strlen(val); /* Note, hack: in old frm NAMES_SEP_CHAR is used to separate names in the interval (ENUM/SET). To allow names to contain NAMES_SEP_CHAR, we replace it with a comma before writing frm. Backward conversion is done during frm file opening, See table.cc, openfrm() function */ for (uint cnt= 0 ; cnt < str_len ; cnt++) { char c= val[cnt]; if (c == NAMES_SEP_CHAR) val[cnt]= ','; } tmp.append(*pos); tmp.append(NAMES_SEP_CHAR); } Loading