diff options
author | bell@sanja.is.com.ua <> | 2004-09-09 16:52:22 +0300 |
---|---|---|
committer | bell@sanja.is.com.ua <> | 2004-09-09 16:52:22 +0300 |
commit | 336cb5f8be3c0260a35c919ec875b8adca195d39 (patch) | |
tree | 7615ce281add0dfaa6366a6776a26995613845cb /sql/sql_show.cc | |
parent | 425857f5b221bbe37eb6295ca16ce8e4d59143fa (diff) | |
parent | e67fcee270ba58fcde915647b1a647cdd293edd5 (diff) | |
download | mariadb-git-336cb5f8be3c0260a35c919ec875b8adca195d39.tar.gz |
merge
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r-- | sql/sql_show.cc | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 25bb7c63945..6e8365b2233 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -566,7 +566,7 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild) thd->clear_error(); } else - DBUG_RETURN(1) + DBUG_RETURN(1); } else if (table_list.view) { @@ -699,6 +699,7 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild, TABLE *table; handler *file; char tmp[MAX_FIELD_WIDTH]; + char tmp1[MAX_FIELD_WIDTH]; Item *item; Protocol *protocol= thd->protocol; int res; @@ -787,9 +788,24 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild, else if (field->unireg_check != Field::NEXT_NUMBER && !field->is_null()) { // Not null by default + /* + Note: we have to convert the default value into + system_charset_info before sending. + This is necessary for "SET NAMES binary": + If the client character set is binary, we want to + send metadata in UTF8 rather than in the column's + character set. + This conversion also makes "SHOW COLUMNS" and + "SHOW CREATE TABLE" output consistent. Without + this conversion the default values were displayed + differently. + */ + String def(tmp1,sizeof(tmp1), system_charset_info); type.set(tmp, sizeof(tmp), field->charset()); field->val_str(&type); - protocol->store(type.ptr(),type.length(),type.charset()); + def.copy(type.ptr(), type.length(), type.charset(), + system_charset_info); + protocol->store(def.ptr(), def.length(), def.charset()); } else if (field->unireg_check == Field::NEXT_NUMBER || field->maybe_null()) |