summaryrefslogtreecommitdiff
path: root/sql/sql_show.cc
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-09-09 07:26:28 +0300
committerunknown <monty@mysql.com>2004-09-09 07:26:28 +0300
commite18b7ea95942cb8ab0b31d453929dde50dcf3756 (patch)
treee2b882265e31ada44f3adec357920530f0c0ac31 /sql/sql_show.cc
parentc92b5349701ba68fa7ab97abf14933de8d6352fe (diff)
parent33efc9677d6f6a68d3dba69f4c036856ac4af5fe (diff)
downloadmariadb-git-e18b7ea95942cb8ab0b31d453929dde50dcf3756.tar.gz
Merge on pull
BitKeeper/etc/logging_ok: auto-union include/my_sys.h: Auto merged mysql-test/r/func_in.result: Auto merged
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r--sql/sql_show.cc18
1 files changed, 17 insertions, 1 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 629b7a3cf3a..c31eb4f147f 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -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())