From ab8418a59f9cdae88747ade62e2eab3005aa29b4 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 23 May 2003 13:10:25 +0500 Subject: SHOW FIELDS changes, more SQL99 INFORMATION_SCHEMA.COLUMNS compatibility: Character set is not displayed in "Type" column anymore In "Collation" column NULL instead of BINARY is now displayd for for non-character data types mysql-test/r/alter_table.result: Character set is not displayed in "Type" column of SHOW FIELDS anymore mysql-test/r/create.result: Character set is not displayed in "Type" column of SHOW FIELDS anymore mysql-test/r/ctype_collate.result: Character set is not displayed in "Type" column of SHOW FIELDS anymore mysql-test/r/ctype_recoding.result: Character set is not displayed in "Type" column of SHOW FIELDS anymore mysql-test/r/gis.result: Character set is not displayed in "Type" column of SHOW FIELDS anymore mysql-test/r/innodb.result: Character set is not displayed in "Type" column of SHOW FIELDS anymore mysql-test/r/select.result: Character set is not displayed in "Type" column of SHOW FIELDS anymore mysql-test/r/show_check.result: Character set is not displayed in "Type" column of SHOW FIELDS anymore mysql-test/r/type_blob.result: Character set is not displayed in "Type" column of SHOW FIELDS anymore mysql-test/r/type_float.result: Character set is not displayed in "Type" column of SHOW FIELDS anymore mysql-test/r/type_ranges.result: Character set is not displayed in "Type" column of SHOW FIELDS anymore sql/field.cc: Character set is not displayed in "Type" column of SHOW FIELDS anymore sql/field.h: Character set is not displayed in "Type" column of SHOW FIELDS anymore sql/sql_show.cc: Character set is not displayed in "Type" column of SHOW FIELDS anymore --- sql/sql_show.cc | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) (limited to 'sql/sql_show.cc') diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 660b8e7e572..16934e33798 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -719,8 +719,8 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild, protocol->store(field->field_name, system_charset_info); field->sql_type(type); protocol->store(type.ptr(), type.length(), system_charset_info); - protocol->store(field->charset()->name, system_charset_info); - + protocol->store(field->has_charset() ? field->charset()->name : "NULL", + system_charset_info); pos=(byte*) ((flags & NOT_NULL_FLAG) && field->type() != FIELD_TYPE_TIMESTAMP ? "" : "YES"); @@ -1073,23 +1073,36 @@ store_create_info(THD *thd, TABLE *table, String *packet) field->sql_type(type); packet->append(type.ptr(),type.length()); - 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->charset()->state & MY_CS_PRIMARY) && - !limited_mysql_mode && !foreign_db_mode) + if (field->has_charset()) { - packet->append(" collate ", 9); - packet->append(field->charset()->name); + if (field->charset() == &my_charset_bin) + packet->append(" binary"); + else if (!limited_mysql_mode && !foreign_db_mode) + { + if (field->charset() != table->table_charset) + { + packet->append(" character set "); + packet->append(field->charset()->csname); + } + /* + For string types dump collation name only if + collation is not primary for the given charset + */ + if (!(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); + bool has_default = (field->type() != FIELD_TYPE_BLOB && + field->type() != FIELD_TYPE_TIMESTAMP && + field->unireg_check != Field::NEXT_NUMBER); + if (has_default) { packet->append(" default ", 9); -- cgit v1.2.1