summaryrefslogtreecommitdiff
path: root/sql/sql_show.cc
diff options
context:
space:
mode:
authorunknown <bar@bar.mysql.r18.ru>2003-05-23 13:10:25 +0500
committerunknown <bar@bar.mysql.r18.ru>2003-05-23 13:10:25 +0500
commitab8418a59f9cdae88747ade62e2eab3005aa29b4 (patch)
tree96a767e32ce6ec8ff92c231ff5d9fb1a819f69c5 /sql/sql_show.cc
parent493ba6ec9d3d9657eb5bb1ac7b22c9035aa47954 (diff)
downloadmariadb-git-ab8418a59f9cdae88747ade62e2eab3005aa29b4.tar.gz
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
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r--sql/sql_show.cc41
1 files changed, 27 insertions, 14 deletions
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);