Commit 167a5348 authored by unknown's avatar unknown

Fix for bug #7220: information_schema: errors in "character_sets"

parent 0bdd2e8a
......@@ -156,14 +156,14 @@ drop tables testtets.t4, testtets.t1, t2, t3;
drop database testtets;
select * from information_schema.CHARACTER_SETS
where CHARACTER_SET_NAME like 'latin1%';
CHARACTER_SET_NAME DESCRIPTION DEFAULT_COLLATE_NAME MAXLEN
latin1 ISO 8859-1 West European latin1_swedish_ci 1
CHARACTER_SET_NAME DEFAULT_COLLATE_NAME DESCRIPTION MAXLEN
latin1 latin1_swedish_ci ISO 8859-1 West European 1
SHOW CHARACTER SET LIKE 'latin1%';
Charset Description Default collation Maxlen
latin1 ISO 8859-1 West European latin1_swedish_ci 1
SHOW CHARACTER SET * LIKE 'latin1%';
CHARACTER_SET_NAME DESCRIPTION DEFAULT_COLLATE_NAME MAXLEN
latin1 ISO 8859-1 West European latin1_swedish_ci 1
CHARACTER_SET_NAME DEFAULT_COLLATE_NAME DESCRIPTION MAXLEN
latin1 latin1_swedish_ci ISO 8859-1 West European 1
SHOW CHARACTER SET WHERE CHARACTER_SET_NAME like 'latin1%';
Charset Description Default collation Maxlen
latin1 ISO 8859-1 West European latin1_swedish_ci 1
......@@ -171,8 +171,8 @@ SHOW CHARACTER SET CHARACTER_SET_NAME WHERE CHARACTER_SET_NAME like 'latin1%';
CHARACTER_SET_NAME
latin1
SHOW CHARACTER SET * WHERE CHARACTER_SET_NAME like 'latin1%';
CHARACTER_SET_NAME DESCRIPTION DEFAULT_COLLATE_NAME MAXLEN
latin1 ISO 8859-1 West European latin1_swedish_ci 1
CHARACTER_SET_NAME DEFAULT_COLLATE_NAME DESCRIPTION MAXLEN
latin1 latin1_swedish_ci ISO 8859-1 West European 1
select * from information_schema.COLLATIONS
where COLLATION_NAME like 'latin1%';
COLLATION_NAME CHARSET ID DEFAULT COMPILED SORTLEN
......@@ -471,8 +471,8 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.character_sets;
Table Create Table
character_sets CREATE TEMPORARY TABLE `character_sets` (
`CHARACTER_SET_NAME` varchar(30) NOT NULL default '',
`DESCRIPTION` varchar(60) NOT NULL default '',
`DEFAULT_COLLATE_NAME` varchar(60) NOT NULL default '',
`DESCRIPTION` varchar(60) NOT NULL default '',
`MAXLEN` bigint(3) NOT NULL default '0'
) ENGINE=HEAP DEFAULT CHARSET=utf8 MAX_ROWS=2252
set names latin2;
......@@ -480,23 +480,23 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.character_sets;
Table Create Table
character_sets CREATE TEMPORARY TABLE `character_sets` (
`CHARACTER_SET_NAME` varchar(30) NOT NULL default '',
`DESCRIPTION` varchar(60) NOT NULL default '',
`DEFAULT_COLLATE_NAME` varchar(60) NOT NULL default '',
`DESCRIPTION` varchar(60) NOT NULL default '',
`MAXLEN` bigint(3) NOT NULL default '0'
) ENGINE=HEAP DEFAULT CHARSET=utf8 MAX_ROWS=2252
set names latin1;
create table t1 select * from information_schema.CHARACTER_SETS
where CHARACTER_SET_NAME like "latin1";
select * from t1;
CHARACTER_SET_NAME DESCRIPTION DEFAULT_COLLATE_NAME MAXLEN
latin1 ISO 8859-1 West European latin1_swedish_ci 1
CHARACTER_SET_NAME DEFAULT_COLLATE_NAME DESCRIPTION MAXLEN
latin1 latin1_swedish_ci ISO 8859-1 West European 1
alter table t1 default character set utf8;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`CHARACTER_SET_NAME` varchar(30) NOT NULL default '',
`DESCRIPTION` varchar(60) NOT NULL default '',
`DEFAULT_COLLATE_NAME` varchar(60) NOT NULL default '',
`DESCRIPTION` varchar(60) NOT NULL default '',
`MAXLEN` bigint(3) NOT NULL default '0'
) ENGINE=MyISAM DEFAULT CHARSET=utf8
drop table t1;
......
......@@ -2551,10 +2551,10 @@ int fill_schema_charsets(THD *thd, TABLE_LIST *tables, COND *cond)
{
restore_record(table, default_values);
table->field[0]->store(tmp_cs->csname, strlen(tmp_cs->csname), scs);
table->field[1]->store(tmp_cs->comment ? tmp_cs->comment : "",
table->field[1]->store(tmp_cs->name, strlen(tmp_cs->name), scs);
table->field[2]->store(tmp_cs->comment ? tmp_cs->comment : "",
strlen(tmp_cs->comment ? tmp_cs->comment : ""),
scs);
table->field[2]->store(tmp_cs->name, strlen(tmp_cs->name), scs);
table->field[3]->store((longlong) tmp_cs->mbmaxlen);
table->file->write_row(table->record[0]);
}
......@@ -3216,6 +3216,28 @@ int make_columns_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
}
int make_character_sets_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
{
int fields_arr[]= {0, 2, 1, 3, -1};
int *field_num= fields_arr;
ST_FIELD_INFO *field_info;
for (; *field_num >= 0; field_num++)
{
field_info= &schema_table->fields_info[*field_num];
Item_field *field= new Item_field(NullS, NullS, field_info->field_name);
if (field)
{
field->set_name(field_info->old_name,
strlen(field_info->old_name),
system_charset_info);
if (add_item_to_list(thd, field))
return 1;
}
}
return 0;
}
int make_proc_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
{
int fields_arr[]= {2, 3, 4, 19, 16, 15, 14, 18, -1};
......@@ -3439,8 +3461,8 @@ ST_FIELD_INFO columns_fields_info[]=
ST_FIELD_INFO charsets_fields_info[]=
{
{"CHARACTER_SET_NAME", 30, MYSQL_TYPE_STRING, 0, 0, "Charset"},
{"DESCRIPTION", 60, MYSQL_TYPE_STRING, 0, 0, "Description"},
{"DEFAULT_COLLATE_NAME", 60, MYSQL_TYPE_STRING, 0, 0, "Default collation"},
{"DESCRIPTION", 60, MYSQL_TYPE_STRING, 0, 0, "Description"},
{"MAXLEN", 3 ,MYSQL_TYPE_LONG, 0, 0, "Maxlen"},
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
};
......@@ -3621,7 +3643,7 @@ ST_SCHEMA_TABLE schema_tables[]=
{"COLUMNS", columns_fields_info, create_schema_table,
get_all_tables, make_columns_old_format, get_schema_column_record, 1, 2},
{"CHARACTER_SETS", charsets_fields_info, create_schema_table,
fill_schema_charsets, make_old_format, 0, -1, -1},
fill_schema_charsets, make_character_sets_old_format, 0, -1, -1},
{"COLLATIONS", collation_fields_info, create_schema_table,
fill_schema_collation, make_old_format, 0, -1, -1},
{"COLLATION_CHARACTER_SET_APPLICABILITY", coll_charset_app_fields_info,
......
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