diff options
-rw-r--r-- | include/m_ctype.h | 36 | ||||
-rw-r--r-- | mysys/charset.c | 63 | ||||
-rw-r--r-- | sql/sql_show.cc | 4 | ||||
-rw-r--r-- | sql/sql_string.cc | 6 | ||||
-rw-r--r-- | strings/ctype-big5.c | 2 | ||||
-rw-r--r-- | strings/ctype-czech.c | 2 | ||||
-rw-r--r-- | strings/ctype-euc_kr.c | 2 | ||||
-rw-r--r-- | strings/ctype-gb2312.c | 2 | ||||
-rw-r--r-- | strings/ctype-gbk.c | 2 | ||||
-rw-r--r-- | strings/ctype-latin1.c | 2 | ||||
-rw-r--r-- | strings/ctype-sjis.c | 2 | ||||
-rw-r--r-- | strings/ctype-tis620.c | 2 | ||||
-rw-r--r-- | strings/ctype-ucs2.c | 4 | ||||
-rw-r--r-- | strings/ctype-ujis.c | 2 | ||||
-rw-r--r-- | strings/ctype-utf8.c | 4 | ||||
-rw-r--r-- | strings/ctype-win1250ch.c | 2 | ||||
-rw-r--r-- | strings/ctype.c | 2 |
17 files changed, 59 insertions, 80 deletions
diff --git a/include/m_ctype.h b/include/m_ctype.h index e28d5687983..6cf0ecfbb8a 100644 --- a/include/m_ctype.h +++ b/include/m_ctype.h @@ -61,6 +61,7 @@ typedef struct unicase_info_st #define MY_CS_BINSORT 16 /* if binary sort order */ #define MY_CS_PRIMARY 32 /* if primary collation */ #define MY_CS_STRNXFRM 64 /* if strnxfrm is used for sort */ +#define MY_CS_UNICODE 128 /* is a charset is full unicode */ #define MY_CHARSET_UNDEFINED 0 #define MY_CHARSET_CURRENT (default_charset_info->number) @@ -185,20 +186,29 @@ typedef struct charset_info_st extern CHARSET_INFO my_charset_bin; +extern CHARSET_INFO my_charset_big5_chinese_ci; +extern CHARSET_INFO my_charset_big5_bin; +extern CHARSET_INFO my_charset_euckr_korean_ci; +extern CHARSET_INFO my_charset_euckr_bin; +extern CHARSET_INFO my_charset_gb2312_chinese_ci; +extern CHARSET_INFO my_charset_gb2312_bin; +extern CHARSET_INFO my_charset_gbk_chinese_ci; +extern CHARSET_INFO my_charset_gbk_bin; extern CHARSET_INFO my_charset_latin1; -extern CHARSET_INFO my_charset_big5; -extern CHARSET_INFO my_charset_czech; -extern CHARSET_INFO my_charset_euc_kr; -extern CHARSET_INFO my_charset_gb2312; -extern CHARSET_INFO my_charset_gbk; -extern CHARSET_INFO my_charset_latin1_de; -extern CHARSET_INFO my_charset_sjis; -extern CHARSET_INFO my_charset_tis620; -extern CHARSET_INFO my_charset_ucs2; -extern CHARSET_INFO my_charset_ucse; -extern CHARSET_INFO my_charset_ujis; -extern CHARSET_INFO my_charset_utf8; -extern CHARSET_INFO my_charset_win1250ch; +extern CHARSET_INFO my_charset_latin1_german2_ci; +extern CHARSET_INFO my_charset_latin1_bin; +extern CHARSET_INFO my_charset_latin2_czech_ci; +extern CHARSET_INFO my_charset_sjis_japanese_ci; +extern CHARSET_INFO my_charset_sjis_bin; +extern CHARSET_INFO my_charset_tis620_thai_ci; +extern CHARSET_INFO my_charset_tis620_bin; +extern CHARSET_INFO my_charset_ucs2_general_ci; +extern CHARSET_INFO my_charset_ucs2_bin; +extern CHARSET_INFO my_charset_ujis_japanese_ci; +extern CHARSET_INFO my_charset_ujis_bin; +extern CHARSET_INFO my_charset_utf8_general_ci; +extern CHARSET_INFO my_charset_utf8_bin; +extern CHARSET_INFO my_charset_cp1250_czech_ci; extern my_bool my_parse_charset_xml(const char *bug, uint len, diff --git a/mysys/charset.c b/mysys/charset.c index d685104abac..9b8903bc6b7 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -313,6 +313,8 @@ static int add_collation(CHARSET_INFO *cs) { if (!all_charsets[cs->number]) { + if (cs->state & MY_CS_COMPILED) + return MY_XML_OK; if (!(all_charsets[cs->number]= (CHARSET_INFO*) my_once_alloc(sizeof(CHARSET_INFO),MYF(0)))) return MY_XML_ERROR; @@ -422,57 +424,53 @@ CHARSET_INFO *default_charset_info = &my_charset_latin1; static my_bool init_compiled_charsets(myf flags __attribute__((unused))) { CHARSET_INFO *cs; - - MY_ADD_CHARSET(&my_charset_latin1); + MY_ADD_CHARSET(&my_charset_latin1); MY_ADD_CHARSET(&my_charset_bin); + MY_ADD_CHARSET(&my_charset_latin1_german2_ci); #ifdef HAVE_CHARSET_big5 - MY_ADD_CHARSET(&my_charset_big5); + MY_ADD_CHARSET(&my_charset_big5_chinese_ci); #endif #ifdef HAVE_CHARSET_czech - MY_ADD_CHARSET(&my_charset_czech); + MY_ADD_CHARSET(&my_charset_latin2_czech_ci); #endif #ifdef HAVE_CHARSET_euc_kr - MY_ADD_CHARSET(&my_charset_euc_kr); + MY_ADD_CHARSET(&my_charset_euckr_korean_ci); #endif #ifdef HAVE_CHARSET_gb2312 - MY_ADD_CHARSET(&my_charset_gb2312); + MY_ADD_CHARSET(&my_charset_gb2312_chinese_ci); #endif #ifdef HAVE_CHARSET_gbk - MY_ADD_CHARSET(&my_charset_gbk); -#endif - -#ifdef HAVE_CHARSET_latin1_de - MY_ADD_CHARSET(&my_charset_latin1_de); + MY_ADD_CHARSET(&my_charset_gbk_chinese_ci); #endif #ifdef HAVE_CHARSET_sjis - MY_ADD_CHARSET(&my_charset_sjis); + MY_ADD_CHARSET(&my_charset_sjis_japanese_ci); #endif #ifdef HAVE_CHARSET_tis620 - MY_ADD_CHARSET(&my_charset_tis620); + MY_ADD_CHARSET(&my_charset_tis620_thai_ci); #endif #ifdef HAVE_CHARSET_ucs2 - MY_ADD_CHARSET(&my_charset_ucs2); + MY_ADD_CHARSET(&my_charset_ucs2_general_ci); #endif #ifdef HAVE_CHARSET_ujis - MY_ADD_CHARSET(&my_charset_ujis); + MY_ADD_CHARSET(&my_charset_ujis_japanese_ci); #endif #ifdef HAVE_CHARSET_utf8 - MY_ADD_CHARSET(&my_charset_utf8); + MY_ADD_CHARSET(&my_charset_utf8_general_ci); #endif #ifdef HAVE_CHARSET_win1250ch - MY_ADD_CHARSET(&my_charset_win1250ch); + MY_ADD_CHARSET(&my_charset_cp1250_czech_ci); #endif /* Copy compiled charsets */ @@ -533,12 +531,6 @@ void free_charsets(void) } -static void get_charset_conf_name(const char *cs_name, char *buf) -{ - strxmov(get_charsets_dir(buf), cs_name, ".conf", NullS); -} - - uint get_charset_number(const char *charset_name) { CHARSET_INFO **cs; @@ -661,28 +653,3 @@ CHARSET_INFO *get_charset_by_csname(const char *cs_name, return cs; } - - -/* Only append name if it doesn't exist from before */ - -static my_bool charset_in_string(const char *name, DYNAMIC_STRING *s) -{ - uint length= (uint) strlen(name); - const char *pos; - for (pos=s->str ; (pos=strstr(pos,name)) ; pos++) - { - if (! pos[length] || pos[length] == ' ') - return TRUE; /* Already existed */ - } - return FALSE; -} - - -static void charset_append(DYNAMIC_STRING *s, const char *name) -{ - if (!charset_in_string(name, s)) - { - dynstr_append(s, name); - dynstr_append(s, " "); - } -} diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 25bbd4851ba..660b8e7e572 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1420,8 +1420,8 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose) static bool write_collation(Protocol *protocol, CHARSET_INFO *cs) { protocol->prepare_for_resend(); - protocol->store(cs->csname, system_charset_info); protocol->store(cs->name, system_charset_info); + protocol->store(cs->csname, system_charset_info); protocol->store_short((longlong) cs->number); protocol->store((cs->state & MY_CS_PRIMARY) ? "Y" : "",system_charset_info); protocol->store((cs->state & MY_CS_COMPILED)? "Y" : "",system_charset_info); @@ -1440,8 +1440,8 @@ int mysqld_show_collations(THD *thd, const char *wild) DBUG_ENTER("mysqld_show_charsets"); - field_list.push_back(new Item_empty_string("Charset",30)); field_list.push_back(new Item_empty_string("Collation",30)); + field_list.push_back(new Item_empty_string("Charset",30)); field_list.push_back(new Item_return_int("Id",11, FIELD_TYPE_SHORT)); field_list.push_back(new Item_empty_string("D",30)); field_list.push_back(new Item_empty_string("C",30)); diff --git a/sql/sql_string.cc b/sql/sql_string.cc index bd101944160..126fb84d6d9 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -28,9 +28,9 @@ #include <floatingpoint.h> #endif -CHARSET_INFO *system_charset_info= &my_charset_utf8; -CHARSET_INFO *files_charset_info= &my_charset_utf8; -CHARSET_INFO *national_charset_info= &my_charset_utf8; +CHARSET_INFO *system_charset_info= &my_charset_utf8_general_ci; +CHARSET_INFO *files_charset_info= &my_charset_utf8_general_ci; +CHARSET_INFO *national_charset_info= &my_charset_utf8_general_ci; extern gptr sql_alloc(unsigned size); extern void sql_element_free(void *ptr); diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c index 57ee2d7c6ae..ec723e8690a 100644 --- a/strings/ctype-big5.c +++ b/strings/ctype-big5.c @@ -6226,7 +6226,7 @@ my_mb_wc_big5(CHARSET_INFO *cs __attribute__((unused)), return 2; } -CHARSET_INFO my_charset_big5 = +CHARSET_INFO my_charset_big5_chinese_ci = { 1,0,0, /* number */ MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM, /* state */ diff --git a/strings/ctype-czech.c b/strings/ctype-czech.c index 9da2103fda3..788cd96ad13 100644 --- a/strings/ctype-czech.c +++ b/strings/ctype-czech.c @@ -605,7 +605,7 @@ int my_strnncollsp_czech(CHARSET_INFO * cs, } -CHARSET_INFO my_charset_czech = +CHARSET_INFO my_charset_latin2_czech_ci = { 2,0,0, /* number */ MY_CS_COMPILED|MY_CS_STRNXFRM, /* state */ diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c index 21f01b6509c..3bf689910e6 100644 --- a/strings/ctype-euc_kr.c +++ b/strings/ctype-euc_kr.c @@ -8634,7 +8634,7 @@ my_mb_wc_euc_kr(CHARSET_INFO *cs __attribute__((unused)), return 2; } -CHARSET_INFO my_charset_euc_kr = +CHARSET_INFO my_charset_euckr_korean_ci = { 19,0,0, /* number */ MY_CS_COMPILED|MY_CS_PRIMARY, /* state */ diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c index f1ec5a9f363..20e1ce888e8 100644 --- a/strings/ctype-gb2312.c +++ b/strings/ctype-gb2312.c @@ -5684,7 +5684,7 @@ my_mb_wc_gb2312(CHARSET_INFO *cs __attribute__((unused)), return 2; } -CHARSET_INFO my_charset_gb2312 = +CHARSET_INFO my_charset_gb2312_chinese_ci = { 24,0,0, /* number */ MY_CS_COMPILED|MY_CS_PRIMARY, /* state */ diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c index b1ea209d6ad..ec0cc01881b 100644 --- a/strings/ctype-gbk.c +++ b/strings/ctype-gbk.c @@ -9881,7 +9881,7 @@ my_mb_wc_gbk(CHARSET_INFO *cs __attribute__((unused)), } -CHARSET_INFO my_charset_gbk = +CHARSET_INFO my_charset_gbk_chinese_ci = { 28,0,0, /* number */ MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM, /* state */ diff --git a/strings/ctype-latin1.c b/strings/ctype-latin1.c index 5781013a5e9..4340d0973aa 100644 --- a/strings/ctype-latin1.c +++ b/strings/ctype-latin1.c @@ -428,7 +428,7 @@ static int my_strnxfrm_latin1_de(CHARSET_INFO *cs __attribute__((unused)), return dest - dest_orig; } -CHARSET_INFO my_charset_latin1_de = +CHARSET_INFO my_charset_latin1_german2_ci = { 31,0,0, /* number */ MY_CS_COMPILED|MY_CS_STRNXFRM, /* state */ diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c index fd911f1867e..058558fa419 100644 --- a/strings/ctype-sjis.c +++ b/strings/ctype-sjis.c @@ -4468,7 +4468,7 @@ my_mb_wc_sjis(CHARSET_INFO *cs __attribute__((unused)), return 2; } -CHARSET_INFO my_charset_sjis = +CHARSET_INFO my_charset_sjis_japanese_ci = { 13,0,0, /* number */ MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM, /* state */ diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c index e108ffac6af..9fcecdfdffd 100644 --- a/strings/ctype-tis620.c +++ b/strings/ctype-tis620.c @@ -688,7 +688,7 @@ void ThNormalize(uchar* ptr, uint field_length, const uchar* from, uint length) } -CHARSET_INFO my_charset_tis620 = +CHARSET_INFO my_charset_tis620_thai_ci = { 18,0,0, /* number */ MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM, /* state */ diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index d2e75d1de9e..dae0632f754 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -997,10 +997,10 @@ uint my_charpos_ucs2(CHARSET_INFO *cs __attribute__((unused)), return pos*2; } -CHARSET_INFO my_charset_ucs2 = +CHARSET_INFO my_charset_ucs2_general_ci = { 35,0,0, /* number */ - MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM, /* state */ + MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM|MY_CS_UNICODE, /* state */ "ucs2", /* cs name */ "ucs2_general_ci", /* name */ "", /* comment */ diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c index 8a9863f7940..76c69637906 100644 --- a/strings/ctype-ujis.c +++ b/strings/ctype-ujis.c @@ -8425,7 +8425,7 @@ my_wc_mb_euc_jp(CHARSET_INFO *c,my_wc_t wc, unsigned char *s, unsigned char *e) return MY_CS_ILUNI; } -CHARSET_INFO my_charset_ujis = +CHARSET_INFO my_charset_ujis_japanese_ci = { 12,0,0, /* number */ MY_CS_COMPILED|MY_CS_PRIMARY, /* state */ diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index e9fc2f6d17d..9f08ca2e169 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -1950,10 +1950,10 @@ static int my_mbcharlen_utf8(CHARSET_INFO *cs __attribute__((unused)) , uint c) return 0; /* Illegal mb head */; } -CHARSET_INFO my_charset_utf8 = +CHARSET_INFO my_charset_utf8_general_ci = { 33,0,0, /* number */ - MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM, /* state */ + MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM|MY_CS_UNICODE, /* state */ "utf8", /* cs name */ "utf8_general_ci", /* name */ "", /* comment */ diff --git a/strings/ctype-win1250ch.c b/strings/ctype-win1250ch.c index 2769925b54f..87ba58d0553 100644 --- a/strings/ctype-win1250ch.c +++ b/strings/ctype-win1250ch.c @@ -640,7 +640,7 @@ static my_bool my_like_range_win1250ch(CHARSET_INFO *cs __attribute__((unused)), } -CHARSET_INFO my_charset_win1250ch = +CHARSET_INFO my_charset_cp1250_czech_ci = { 34,0,0, /* number */ MY_CS_COMPILED|MY_CS_STRNXFRM, /* state */ diff --git a/strings/ctype.c b/strings/ctype.c index 68d9a30048f..ce7bb9ca4a4 100644 --- a/strings/ctype.c +++ b/strings/ctype.c @@ -220,6 +220,8 @@ static int cs_value(MY_XML_PARSER *st,const char *attr, uint len) i->cs.state|= MY_CS_PRIMARY; else if (!strncmp("binary",attr,len)) i->cs.state|= MY_CS_BINSORT; + else if (!strncmp("compiled",attr,len)) + i->cs.state|= MY_CS_COMPILED; break; case _CS_UPPERMAP: fill_uchar(i->to_upper,MY_CS_TO_UPPER_TABLE_SIZE,attr,len); |