From afc839691988a185e35f59dedef2f6630d9bbe4e Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 23 May 2003 18:39:55 +0500 Subject: [PATCH] BINARY collations for every character set --- mysys/charset.c | 13 +++++++++++- sql/share/charsets/Index.xml | 39 ++++++++++++++++++++++++++++++++++-- strings/ctype-big5.c | 27 +++++++++++++++++++++++-- strings/ctype-euc_kr.c | 28 ++++++++++++++++++++++++-- strings/ctype-gb2312.c | 27 +++++++++++++++++++++++-- strings/ctype-gbk.c | 27 +++++++++++++++++++++++-- strings/ctype-latin1.c | 29 ++++++++++++++++++++++++--- strings/ctype-sjis.c | 26 ++++++++++++++++++++++-- strings/ctype-tis620.c | 27 +++++++++++++++++++++++-- strings/ctype-ucs2.c | 28 ++++++++++++++++++++++++-- strings/ctype-ujis.c | 24 +++++++++++++++++++++- strings/ctype-utf8.c | 28 ++++++++++++++++++++++++-- 12 files changed, 300 insertions(+), 23 deletions(-) diff --git a/mysys/charset.c b/mysys/charset.c index f5d07403948..82bace7fb2c 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -395,13 +395,16 @@ 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_bin); MY_ADD_CHARSET(&my_charset_latin1); - MY_ADD_CHARSET(&my_charset_bin); + MY_ADD_CHARSET(&my_charset_latin1_bin); MY_ADD_CHARSET(&my_charset_latin1_german2_ci); #ifdef HAVE_CHARSET_big5 MY_ADD_CHARSET(&my_charset_big5_chinese_ci); + MY_ADD_CHARSET(&my_charset_big5_bin); #endif #ifdef HAVE_CHARSET_czech @@ -410,34 +413,42 @@ static my_bool init_compiled_charsets(myf flags __attribute__((unused))) #ifdef HAVE_CHARSET_euc_kr MY_ADD_CHARSET(&my_charset_euckr_korean_ci); + MY_ADD_CHARSET(&my_charset_euckr_bin); #endif #ifdef HAVE_CHARSET_gb2312 MY_ADD_CHARSET(&my_charset_gb2312_chinese_ci); + MY_ADD_CHARSET(&my_charset_gb2312_bin); #endif #ifdef HAVE_CHARSET_gbk MY_ADD_CHARSET(&my_charset_gbk_chinese_ci); + MY_ADD_CHARSET(&my_charset_gbk_bin); #endif #ifdef HAVE_CHARSET_sjis MY_ADD_CHARSET(&my_charset_sjis_japanese_ci); + MY_ADD_CHARSET(&my_charset_sjis_bin); #endif #ifdef HAVE_CHARSET_tis620 MY_ADD_CHARSET(&my_charset_tis620_thai_ci); + MY_ADD_CHARSET(&my_charset_tis620_bin); #endif #ifdef HAVE_CHARSET_ucs2 MY_ADD_CHARSET(&my_charset_ucs2_general_ci); + MY_ADD_CHARSET(&my_charset_ucs2_bin); #endif #ifdef HAVE_CHARSET_ujis MY_ADD_CHARSET(&my_charset_ujis_japanese_ci); + MY_ADD_CHARSET(&my_charset_ujis_bin); #endif #ifdef HAVE_CHARSET_utf8 MY_ADD_CHARSET(&my_charset_utf8_general_ci); + MY_ADD_CHARSET(&my_charset_utf8_bin); #endif #ifdef HAVE_CHARSET_win1250ch diff --git a/sql/share/charsets/Index.xml b/sql/share/charsets/Index.xml index 1278cb6c54a..8c2b7a05d03 100644 --- a/sql/share/charsets/Index.xml +++ b/sql/share/charsets/Index.xml @@ -1,6 +1,6 @@ - + This file lists all of the available character sets. @@ -21,6 +21,10 @@ To make maintaining easier please: primary compiled + + binary + compiled + @@ -96,7 +100,10 @@ To make maintaining easier please: - + + binary + compiled + Dutch English @@ -173,6 +180,10 @@ To make maintaining easier please: primary compiled + + binary + compiled + @@ -185,6 +196,10 @@ To make maintaining easier please: primary compiled + + binary + compiled + @@ -242,6 +257,10 @@ To make maintaining easier please: primary compiled + + binary + compiled + @@ -253,6 +272,10 @@ To make maintaining easier please: primary compiled + + binary + compiled + @@ -293,6 +316,10 @@ To make maintaining easier please: primary compiled + + binary + compiled + @@ -333,6 +360,10 @@ To make maintaining easier please: primary compiled + + binary + compiled + @@ -386,6 +417,10 @@ To make maintaining easier please: primary compiled + + binary + compiled + diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c index 3f7218b20fc..10b6898ce24 100644 --- a/strings/ctype-big5.c +++ b/strings/ctype-big5.c @@ -6262,7 +6262,7 @@ static MY_CHARSET_HANDLER my_charset_big5_handler= my_scan_8bit }; -CHARSET_INFO my_charset_big5_chinese_ci = +CHARSET_INFO my_charset_big5_chinese_ci= { 1,0,0, /* number */ MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM, /* state */ @@ -6275,7 +6275,8 @@ CHARSET_INFO my_charset_big5_chinese_ci = sort_order_big5, NULL, /* tab_to_uni */ NULL, /* tab_from_uni */ - "","", + "", + "", 1, /* strxfrm_multiply */ 2, /* mbmaxlen */ 0, @@ -6284,5 +6285,27 @@ CHARSET_INFO my_charset_big5_chinese_ci = }; +CHARSET_INFO my_charset_big5_bin= +{ + 84,0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT, /* state */ + "big5", /* cs name */ + "big5_bin", /* name */ + "", /* comment */ + ctype_big5, + to_lower_big5, + to_upper_big5, + sort_order_big5, + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + "", + "", + 0, /* strxfrm_multiply */ + 2, /* mbmaxlen */ + 0, + &my_charset_big5_handler, + &my_collation_bin_handler +}; + #endif diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c index 8c5b394cc1f..4a5757bf5c4 100644 --- a/strings/ctype-euc_kr.c +++ b/strings/ctype-euc_kr.c @@ -8671,7 +8671,7 @@ static MY_CHARSET_HANDLER my_charset_handler= }; -CHARSET_INFO my_charset_euckr_korean_ci = +CHARSET_INFO my_charset_euckr_korean_ci= { 19,0,0, /* number */ MY_CS_COMPILED|MY_CS_PRIMARY, /* state */ @@ -8684,7 +8684,8 @@ CHARSET_INFO my_charset_euckr_korean_ci = sort_order_euc_kr, NULL, /* tab_to_uni */ NULL, /* tab_from_uni */ - "","", + "", + "", 0, /* strxfrm_multiply */ 2, /* mbmaxlen */ 0, @@ -8692,4 +8693,27 @@ CHARSET_INFO my_charset_euckr_korean_ci = &my_collation_ci_handler }; + +CHARSET_INFO my_charset_euckr_bin= +{ + 85,0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT, /* state */ + "euckr", /* cs name */ + "euckr_bin", /* name */ + "", /* comment */ + ctype_euc_kr, + to_lower_euc_kr, + to_upper_euc_kr, + sort_order_euc_kr, + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + "", + "", + 0, /* strxfrm_multiply */ + 2, /* mbmaxlen */ + 0, + &my_charset_handler, + &my_collation_bin_handler +}; + #endif diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c index b3aa58bb38a..378931eecc7 100644 --- a/strings/ctype-gb2312.c +++ b/strings/ctype-gb2312.c @@ -5721,7 +5721,7 @@ static MY_CHARSET_HANDLER my_charset_handler= }; -CHARSET_INFO my_charset_gb2312_chinese_ci = +CHARSET_INFO my_charset_gb2312_chinese_ci= { 24,0,0, /* number */ MY_CS_COMPILED|MY_CS_PRIMARY, /* state */ @@ -5734,7 +5734,8 @@ CHARSET_INFO my_charset_gb2312_chinese_ci = sort_order_gb2312, NULL, /* tab_to_uni */ NULL, /* tab_from_uni */ - "","", + "", + "", 0, /* strxfrm_multiply */ 2, /* mbmaxlen */ 0, @@ -5742,4 +5743,26 @@ CHARSET_INFO my_charset_gb2312_chinese_ci = &my_collation_ci_handler }; +CHARSET_INFO my_charset_gb2312_bin= +{ + 86,0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT, /* state */ + "gb2312", /* cs name */ + "gb2312_bin", /* name */ + "", /* comment */ + ctype_gb2312, + to_lower_gb2312, + to_upper_gb2312, + sort_order_gb2312, + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + "", + "", + 0, /* strxfrm_multiply */ + 2, /* mbmaxlen */ + 0, + &my_charset_handler, + &my_collation_bin_handler +}; + #endif diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c index 9d249143db8..58d281ae485 100644 --- a/strings/ctype-gbk.c +++ b/strings/ctype-gbk.c @@ -9918,7 +9918,7 @@ static MY_CHARSET_HANDLER my_charset_handler= }; -CHARSET_INFO my_charset_gbk_chinese_ci = +CHARSET_INFO my_charset_gbk_chinese_ci= { 28,0,0, /* number */ MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM, /* state */ @@ -9931,7 +9931,8 @@ CHARSET_INFO my_charset_gbk_chinese_ci = sort_order_gbk, NULL, /* tab_to_uni */ NULL, /* tab_from_uni */ - "","", + "", + "", 1, /* strxfrm_multiply */ 2, /* mbmaxlen */ 0, @@ -9939,5 +9940,27 @@ CHARSET_INFO my_charset_gbk_chinese_ci = &my_collation_ci_handler }; +CHARSET_INFO my_charset_gbk_bin= +{ + 87,0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT, /* state */ + "gbk", /* cs name */ + "gbk_bin", /* name */ + "", /* comment */ + ctype_gbk, + to_lower_gbk, + to_upper_gbk, + sort_order_gbk, + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + "", + "", + 0, /* strxfrm_multiply */ + 2, /* mbmaxlen */ + 0, + &my_charset_handler, + &my_collation_bin_handler +}; + #endif diff --git a/strings/ctype-latin1.c b/strings/ctype-latin1.c index 5ac60326e62..b0c60e2e3eb 100644 --- a/strings/ctype-latin1.c +++ b/strings/ctype-latin1.c @@ -199,7 +199,7 @@ static MY_CHARSET_HANDLER my_charset_handler= }; -CHARSET_INFO my_charset_latin1 = +CHARSET_INFO my_charset_latin1= { 8,0,0, /* number */ MY_CS_COMPILED | MY_CS_PRIMARY, /* state */ @@ -428,7 +428,7 @@ static int my_strnxfrm_latin1_de(CHARSET_INFO *cs __attribute__((unused)), } -static MY_COLLATION_HANDLER my_collation_german2_ci_handler = +static MY_COLLATION_HANDLER my_collation_german2_ci_handler= { my_strnncoll_latin1_de, my_strnncollsp_latin1_de, @@ -440,7 +440,7 @@ static MY_COLLATION_HANDLER my_collation_german2_ci_handler = }; -CHARSET_INFO my_charset_latin1_german2_ci = +CHARSET_INFO my_charset_latin1_german2_ci= { 31,0,0, /* number */ MY_CS_COMPILED|MY_CS_STRNXFRM, /* state */ @@ -461,3 +461,26 @@ CHARSET_INFO my_charset_latin1_german2_ci = &my_collation_german2_ci_handler }; + +CHARSET_INFO my_charset_latin1_bin= +{ + 47,0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT, /* state */ + "latin1", /* cs name */ + "latin1_bin", /* name */ + "", /* comment */ + ctype_latin1, + to_lower_latin1, + to_upper_latin1, + sort_order_latin1_de, + latin1_uni, /* tab_to_uni */ + NULL, /* tab_from_uni */ + "", + "", + 0, /* strxfrm_multiply */ + 1, /* mbmaxlen */ + 0, + &my_charset_handler, + &my_collation_bin_handler +}; + diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c index 3e33fb3810a..00d51dd23b5 100644 --- a/strings/ctype-sjis.c +++ b/strings/ctype-sjis.c @@ -4505,7 +4505,7 @@ static MY_CHARSET_HANDLER my_charset_handler= }; -CHARSET_INFO my_charset_sjis_japanese_ci = +CHARSET_INFO my_charset_sjis_japanese_ci= { 13,0,0, /* number */ MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM, /* state */ @@ -4518,13 +4518,35 @@ CHARSET_INFO my_charset_sjis_japanese_ci = sort_order_sjis, NULL, /* tab_to_uni */ NULL, /* tab_from_uni */ - "","", + "", + "", 1, /* strxfrm_multiply */ 2, /* mbmaxlen */ 0, &my_charset_handler, &my_collation_ci_handler +}; +CHARSET_INFO my_charset_sjis_bin= +{ + 88,0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT, /* state */ + "sjis", /* cs name */ + "sjis_bin", /* name */ + "", /* comment */ + ctype_sjis, + to_lower_sjis, + to_upper_sjis, + sort_order_sjis, + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + "", + "", + 0, /* strxfrm_multiply */ + 2, /* mbmaxlen */ + 0, + &my_charset_handler, + &my_collation_bin_handler }; #endif diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c index 8574b3d7d84..ab51ddd013f 100644 --- a/strings/ctype-tis620.c +++ b/strings/ctype-tis620.c @@ -725,7 +725,7 @@ static MY_CHARSET_HANDLER my_charset_handler= -CHARSET_INFO my_charset_tis620_thai_ci = +CHARSET_INFO my_charset_tis620_thai_ci= { 18,0,0, /* number */ MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM, /* state */ @@ -738,7 +738,8 @@ CHARSET_INFO my_charset_tis620_thai_ci = sort_order_tis620, NULL, /* tab_to_uni */ NULL, /* tab_from_uni */ - "","", + "", + "", 4, /* strxfrm_multiply */ 1, /* mbmaxlen */ 0, @@ -746,5 +747,27 @@ CHARSET_INFO my_charset_tis620_thai_ci = &my_collation_ci_handler }; +CHARSET_INFO my_charset_tis620_bin= +{ + 89,0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT, /* state */ + "tis620", /* cs name */ + "tis620_bin", /* name */ + "", /* comment */ + ctype_tis620, + to_lower_tis620, + to_upper_tis620, + sort_order_tis620, + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + "", + "", + 0, /* strxfrm_multiply */ + 1, /* mbmaxlen */ + 0, + &my_charset_handler, + &my_collation_bin_handler +}; + #endif diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index 3e3981f1be9..17bc920a381 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -1035,7 +1035,7 @@ static MY_CHARSET_HANDLER my_charset_handler= -CHARSET_INFO my_charset_ucs2_general_ci = +CHARSET_INFO my_charset_ucs2_general_ci= { 35,0,0, /* number */ MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM|MY_CS_UNICODE, /* state */ @@ -1048,7 +1048,8 @@ CHARSET_INFO my_charset_ucs2_general_ci = to_upper_ucs2, /* sort_order */ NULL, /* tab_to_uni */ NULL, /* tab_from_uni */ - "","", + "", + "", 1, /* strxfrm_multiply */ 2, /* mbmaxlen */ 0, @@ -1057,4 +1058,27 @@ CHARSET_INFO my_charset_ucs2_general_ci = }; +CHARSET_INFO my_charset_ucs2_bin= +{ + 90,0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_UNICODE, /* state */ + "ucs2", /* cs name */ + "ucs2_bin", /* name */ + "", /* comment */ + ctype_ucs2, /* ctype */ + to_lower_ucs2, /* to_lower */ + to_upper_ucs2, /* to_upper */ + to_upper_ucs2, /* sort_order */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + "", + "", + 0, /* strxfrm_multiply */ + 2, /* mbmaxlen */ + 0, + &my_charset_handler, + &my_collation_bin_handler +}; + + #endif diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c index bf81269059c..eb31c49013a 100644 --- a/strings/ctype-ujis.c +++ b/strings/ctype-ujis.c @@ -8463,7 +8463,7 @@ static MY_CHARSET_HANDLER my_charset_handler= -CHARSET_INFO my_charset_ujis_japanese_ci = +CHARSET_INFO my_charset_ujis_japanese_ci= { 12,0,0, /* number */ MY_CS_COMPILED|MY_CS_PRIMARY, /* state */ @@ -8485,4 +8485,26 @@ CHARSET_INFO my_charset_ujis_japanese_ci = }; +CHARSET_INFO my_charset_ujis_bin= +{ + 91,0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT, /* state */ + "ujis", /* cs name */ + "ujis_bin", /* name */ + "", /* comment */ + ctype_ujis, + to_lower_ujis, + to_upper_ujis, + sort_order_ujis, + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + "","", + 0, /* strxfrm_multiply */ + 3, /* mbmaxlen */ + 0, + &my_charset_handler, + &my_collation_bin_handler +}; + + #endif diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index 16e42385300..4d9c735de21 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -1988,7 +1988,7 @@ static MY_CHARSET_HANDLER my_charset_handler= -CHARSET_INFO my_charset_utf8_general_ci = +CHARSET_INFO my_charset_utf8_general_ci= { 33,0,0, /* number */ MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM|MY_CS_UNICODE, /* state */ @@ -2001,7 +2001,8 @@ CHARSET_INFO my_charset_utf8_general_ci = to_upper_utf8, /* sort_order */ NULL, /* tab_to_uni */ NULL, /* tab_from_uni */ - "","", + "", + "", 1, /* strxfrm_multiply */ 3, /* mbmaxlen */ 0, @@ -2010,6 +2011,29 @@ CHARSET_INFO my_charset_utf8_general_ci = }; +CHARSET_INFO my_charset_utf8_bin= +{ + 83,0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_UNICODE, /* state */ + "utf8", /* cs name */ + "utf8_bin", /* name */ + "", /* comment */ + ctype_utf8, /* ctype */ + to_lower_utf8, /* to_lower */ + to_upper_utf8, /* to_upper */ + to_upper_utf8, /* sort_order */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + "", + "", + 0, /* strxfrm_multiply */ + 3, /* mbmaxlen */ + 0, + &my_charset_handler, + &my_collation_ci_handler +}; + + #ifdef MY_TEST_UTF8 #include