From 925c33db65a6dcfdf21bd0b047702e7e7221dd89 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 28 Jun 2007 13:24:52 +0400 Subject: Fix for BUG#10491: Server returns data as charset binary SHOW CREATE TABLE or SELECT FROM I_S. Actually, the bug discovers two problems: - the original query is not preserved properly. This is the problem of BUG#16291; - the resultset of SHOW CREATE TABLE statement is binary. This patch fixes the second problem for the 5.0. Both problems will be fixed in 5.1. mysql-test/r/show_check.result: Update result file. mysql-test/t/show_check.test: Provide test case for BUG#10491. sql/item.h: Use utf8_general_ci instead of binary collation by default, because for views and base tables utf8 is the character set in which their definition is stored. For system constants it's the default character set, and for other objects (routines, triggers), no character set is stored, and therefore no character set is known, so returning utf8 is just as good as any non-binary character set. This latter problem is fixed in 5.1 by 16291. In 5.1 we will return the "real" character set. --- sql/item.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'sql/item.h') diff --git a/sql/item.h b/sql/item.h index 3478095351a..fdb85b131c1 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1764,11 +1764,17 @@ public: enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; } }; +/** + Item_empty_string -- is a utility class to put an item into List + which is then used in protocol.send_fields() when sending SHOW output to + the client. +*/ + class Item_empty_string :public Item_string { public: Item_empty_string(const char *header,uint length, CHARSET_INFO *cs= NULL) : - Item_string("",0, cs ? cs : &my_charset_bin) + Item_string("",0, cs ? cs : &my_charset_utf8_general_ci) { name=(char*) header; max_length= cs ? length * cs->mbmaxlen : length; } void make_field(Send_field *field); }; -- cgit v1.2.1