SHOW CREATE TABLE didn't display field names in the proper charset
mysys/charset.c: Clear all fields at the end of previous charset
This commit is contained in:
parent
2dae38c713
commit
18d3292bb7
43
mysql-test/r/ctype_recoding.result
Normal file
43
mysql-test/r/ctype_recoding.result
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
SET NAMES koi8r;
|
||||||
|
DROP TABLE IF EXISTS ÔÁÂÌÉÃÁ;
|
||||||
|
CREATE TABLE ÔÁÂÌÉÃÁ
|
||||||
|
(
|
||||||
|
ÐÏÌÅ CHAR(32) CHARACTER SET koi8r NOT NULL
|
||||||
|
);
|
||||||
|
SHOW TABLES;
|
||||||
|
Tables_in_test
|
||||||
|
ÔÁÂÌÉÃÁ
|
||||||
|
SHOW CREATE TABLE ÔÁÂÌÉÃÁ;
|
||||||
|
Table Create Table
|
||||||
|
ÔÁÂÌÉÃÁ CREATE TABLE `ÔÁÂÌÉÃÁ` (
|
||||||
|
`ÐÏÌÅ` char(32) character set koi8r NOT NULL default ''
|
||||||
|
) TYPE=MyISAM CHARSET=latin1
|
||||||
|
SHOW FIELDS FROM ÔÁÂÌÉÃÁ;
|
||||||
|
Field Type Collation Null Key Default Extra
|
||||||
|
ÐÏÌÅ char(32) character set koi8r koi8r
|
||||||
|
SET NAMES cp1251;
|
||||||
|
SHOW TABLES;
|
||||||
|
Tables_in_test
|
||||||
|
òàáëèöà
|
||||||
|
SHOW CREATE TABLE òàáëèöà;
|
||||||
|
Table Create Table
|
||||||
|
òàáëèöà CREATE TABLE `òàáëèöà` (
|
||||||
|
`ïîëå` char(32) character set koi8r NOT NULL default ''
|
||||||
|
) TYPE=MyISAM CHARSET=latin1
|
||||||
|
SHOW FIELDS FROM òàáëèöà;
|
||||||
|
Field Type Collation Null Key Default Extra
|
||||||
|
ïîëå char(32) character set koi8r koi8r
|
||||||
|
SET NAMES utf8;
|
||||||
|
SHOW TABLES;
|
||||||
|
Tables_in_test
|
||||||
|
таблица
|
||||||
|
SHOW CREATE TABLE таблица;
|
||||||
|
Table Create Table
|
||||||
|
таблица CREATE TABLE `таблица` (
|
||||||
|
`поле` char(32) character set koi8r NOT NULL default ''
|
||||||
|
) TYPE=MyISAM CHARSET=latin1
|
||||||
|
SHOW FIELDS FROM таблица;
|
||||||
|
Field Type Collation Null Key Default Extra
|
||||||
|
поле char(32) character set koi8r koi8r
|
||||||
|
SET NAMES koi8r;
|
||||||
|
DROP TABLE ÔÁÂÌÉÃÁ;
|
28
mysql-test/t/ctype_recoding.test
Normal file
28
mysql-test/t/ctype_recoding.test
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
SET NAMES koi8r;
|
||||||
|
|
||||||
|
--disable_warnings
|
||||||
|
DROP TABLE IF EXISTS ÔÁÂÌÉÃÁ;
|
||||||
|
--enable_warnings
|
||||||
|
|
||||||
|
CREATE TABLE ÔÁÂÌÉÃÁ
|
||||||
|
(
|
||||||
|
ÐÏÌÅ CHAR(32) CHARACTER SET koi8r NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
SHOW TABLES;
|
||||||
|
SHOW CREATE TABLE ÔÁÂÌÉÃÁ;
|
||||||
|
SHOW FIELDS FROM ÔÁÂÌÉÃÁ;
|
||||||
|
|
||||||
|
SET NAMES cp1251;
|
||||||
|
SHOW TABLES;
|
||||||
|
SHOW CREATE TABLE òàáëèöà;
|
||||||
|
SHOW FIELDS FROM òàáëèöà;
|
||||||
|
|
||||||
|
|
||||||
|
SET NAMES utf8;
|
||||||
|
SHOW TABLES;
|
||||||
|
SHOW CREATE TABLE таблица;
|
||||||
|
SHOW FIELDS FROM таблица;
|
||||||
|
|
||||||
|
SET NAMES koi8r;
|
||||||
|
DROP TABLE ÔÁÂÌÉÃÁ;
|
@ -341,6 +341,8 @@ static int add_collation(CHARSET_INFO *cs)
|
|||||||
all_charsets[cs->number]->state |= cs->state;
|
all_charsets[cs->number]->state |= cs->state;
|
||||||
}
|
}
|
||||||
cs->number= 0;
|
cs->number= 0;
|
||||||
|
cs->primary_number= 0;
|
||||||
|
cs->binary_number= 0;
|
||||||
cs->name= NULL;
|
cs->name= NULL;
|
||||||
cs->state= 0;
|
cs->state= 0;
|
||||||
cs->sort_order= NULL;
|
cs->sort_order= NULL;
|
||||||
|
@ -1014,12 +1014,12 @@ append_identifier(THD *thd, String *packet, const char *name)
|
|||||||
if (thd->options & OPTION_QUOTE_SHOW_CREATE)
|
if (thd->options & OPTION_QUOTE_SHOW_CREATE)
|
||||||
{
|
{
|
||||||
packet->append(&qtype, 1);
|
packet->append(&qtype, 1);
|
||||||
packet->append(name);
|
packet->append(name, 0, system_charset_info);
|
||||||
packet->append(&qtype, 1);
|
packet->append(&qtype, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
packet->append(name);
|
packet->append(name, 0, system_charset_info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -338,6 +338,34 @@ bool String::append(const char *s,uint32 arg_length)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Append a string in the given charset to the string
|
||||||
|
with character set recoding
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
bool String::append(const char *s,uint32 arg_length, CHARSET_INFO *cs)
|
||||||
|
{
|
||||||
|
if (!arg_length) // Default argument
|
||||||
|
if (!(arg_length= (uint32) strlen(s)))
|
||||||
|
return FALSE;
|
||||||
|
if (str_charset->mbmaxlen > 1)
|
||||||
|
{
|
||||||
|
uint32 add_length=arg_length * str_charset->mbmaxlen;
|
||||||
|
if (realloc(str_length+ add_length))
|
||||||
|
return TRUE;
|
||||||
|
str_length+= copy_and_convert(Ptr+str_length, add_length, str_charset,
|
||||||
|
s, arg_length, cs);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
if (realloc(str_length+arg_length))
|
||||||
|
return TRUE;
|
||||||
|
memcpy(Ptr+str_length,s,arg_length);
|
||||||
|
str_length+=arg_length;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef TO_BE_REMOVED
|
#ifdef TO_BE_REMOVED
|
||||||
bool String::append(FILE* file, uint32 arg_length, myf my_flags)
|
bool String::append(FILE* file, uint32 arg_length, myf my_flags)
|
||||||
{
|
{
|
||||||
|
@ -181,6 +181,7 @@ public:
|
|||||||
CHARSET_INFO *csto);
|
CHARSET_INFO *csto);
|
||||||
bool append(const String &s);
|
bool append(const String &s);
|
||||||
bool append(const char *s,uint32 arg_length=0);
|
bool append(const char *s,uint32 arg_length=0);
|
||||||
|
bool append(const char *s,uint32 arg_length, CHARSET_INFO *cs);
|
||||||
bool append(IO_CACHE* file, uint32 arg_length);
|
bool append(IO_CACHE* file, uint32 arg_length);
|
||||||
int strstr(const String &search,uint32 offset=0); // Returns offset to substring or -1
|
int strstr(const String &search,uint32 offset=0); // Returns offset to substring or -1
|
||||||
int strstr_case(const String &s,uint32 offset=0);
|
int strstr_case(const String &s,uint32 offset=0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user