diff options
author | Alexander Barkov <bar@mariadb.org> | 2016-09-06 12:50:02 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2016-09-06 12:50:02 +0400 |
commit | ee19806b8e6bb00fa1cd547fe3e75193859d300d (patch) | |
tree | 27568e9cc17e2717785af028c65deb912731bfb9 /mysys | |
parent | e4f6fd5e1252f8c68f449fe820bae88c18bca8f5 (diff) | |
download | mariadb-git-ee19806b8e6bb00fa1cd547fe3e75193859d300d.tar.gz |
MDEV-9711 NO PAD collations
Based on the patch from Daniil Medvedev (a Google Summer of Code task)
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/charset-def.c | 32 | ||||
-rw-r--r-- | mysys/charset.c | 18 |
2 files changed, 45 insertions, 5 deletions
diff --git a/mysys/charset-def.c b/mysys/charset-def.c index defb5c0062d..58fe16f353f 100644 --- a/mysys/charset-def.c +++ b/mysys/charset-def.c @@ -184,12 +184,16 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused))) add_compiled_collation(&my_charset_filename); add_compiled_collation(&my_charset_latin1); + add_compiled_collation(&my_charset_latin1_nopad); add_compiled_collation(&my_charset_latin1_bin); + add_compiled_collation(&my_charset_latin1_nopad_bin); add_compiled_collation(&my_charset_latin1_german2_ci); #ifdef HAVE_CHARSET_big5 add_compiled_collation(&my_charset_big5_chinese_ci); add_compiled_collation(&my_charset_big5_bin); + add_compiled_collation(&my_charset_big5_chinese_nopad_ci); + add_compiled_collation(&my_charset_big5_nopad_bin); #endif #ifdef HAVE_CHARSET_cp1250 @@ -199,6 +203,8 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused))) #ifdef HAVE_CHARSET_cp932 add_compiled_collation(&my_charset_cp932_japanese_ci); add_compiled_collation(&my_charset_cp932_bin); + add_compiled_collation(&my_charset_cp932_japanese_nopad_ci); + add_compiled_collation(&my_charset_cp932_nopad_bin); #endif #ifdef HAVE_CHARSET_latin2 @@ -208,36 +214,50 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused))) #ifdef HAVE_CHARSET_eucjpms add_compiled_collation(&my_charset_eucjpms_japanese_ci); add_compiled_collation(&my_charset_eucjpms_bin); + add_compiled_collation(&my_charset_eucjpms_japanese_nopad_ci); + add_compiled_collation(&my_charset_eucjpms_nopad_bin); #endif #ifdef HAVE_CHARSET_euckr add_compiled_collation(&my_charset_euckr_korean_ci); add_compiled_collation(&my_charset_euckr_bin); + add_compiled_collation(&my_charset_euckr_korean_nopad_ci); + add_compiled_collation(&my_charset_euckr_nopad_bin); #endif #ifdef HAVE_CHARSET_gb2312 add_compiled_collation(&my_charset_gb2312_chinese_ci); add_compiled_collation(&my_charset_gb2312_bin); + add_compiled_collation(&my_charset_gb2312_chinese_nopad_ci); + add_compiled_collation(&my_charset_gb2312_nopad_bin); #endif #ifdef HAVE_CHARSET_gbk add_compiled_collation(&my_charset_gbk_chinese_ci); add_compiled_collation(&my_charset_gbk_bin); + add_compiled_collation(&my_charset_gbk_chinese_nopad_ci); + add_compiled_collation(&my_charset_gbk_nopad_bin); #endif #ifdef HAVE_CHARSET_sjis add_compiled_collation(&my_charset_sjis_japanese_ci); add_compiled_collation(&my_charset_sjis_bin); + add_compiled_collation(&my_charset_sjis_japanese_nopad_ci); + add_compiled_collation(&my_charset_sjis_nopad_bin); #endif #ifdef HAVE_CHARSET_tis620 add_compiled_collation(&my_charset_tis620_thai_ci); add_compiled_collation(&my_charset_tis620_bin); + add_compiled_collation(&my_charset_tis620_thai_nopad_ci); + add_compiled_collation(&my_charset_tis620_nopad_bin); #endif #ifdef HAVE_CHARSET_ucs2 add_compiled_collation(&my_charset_ucs2_general_ci); add_compiled_collation(&my_charset_ucs2_bin); + add_compiled_collation(&my_charset_ucs2_general_nopad_ci); + add_compiled_collation(&my_charset_ucs2_nopad_bin); add_compiled_collation(&my_charset_ucs2_general_mysql500_ci); #ifdef HAVE_UCA_COLLATIONS add_compiled_collation(&my_charset_ucs2_unicode_ci); @@ -273,11 +293,15 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused))) #ifdef HAVE_CHARSET_ujis add_compiled_collation(&my_charset_ujis_japanese_ci); add_compiled_collation(&my_charset_ujis_bin); + add_compiled_collation(&my_charset_ujis_japanese_nopad_ci); + add_compiled_collation(&my_charset_ujis_nopad_bin); #endif #ifdef HAVE_CHARSET_utf8 add_compiled_collation(&my_charset_utf8_general_ci); + add_compiled_collation(&my_charset_utf8_general_nopad_ci); add_compiled_collation(&my_charset_utf8_bin); + add_compiled_collation(&my_charset_utf8_nopad_bin); add_compiled_collation(&my_charset_utf8_general_mysql500_ci); #ifdef HAVE_UTF8_GENERAL_CS add_compiled_collation(&my_charset_utf8_general_cs); @@ -317,6 +341,8 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused))) #ifdef HAVE_CHARSET_utf8mb4 add_compiled_collation(&my_charset_utf8mb4_general_ci); add_compiled_collation(&my_charset_utf8mb4_bin); + add_compiled_collation(&my_charset_utf8mb4_general_nopad_ci); + add_compiled_collation(&my_charset_utf8mb4_nopad_bin); #ifdef HAVE_UCA_COLLATIONS add_compiled_collation(&my_charset_utf8mb4_unicode_ci); add_compiled_collation(&my_charset_utf8mb4_german2_uca_ci); @@ -354,6 +380,10 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused))) add_compiled_collation(&my_charset_utf16_bin); add_compiled_collation(&my_charset_utf16le_general_ci); add_compiled_collation(&my_charset_utf16le_bin); + add_compiled_collation(&my_charset_utf16_general_nopad_ci); + add_compiled_collation(&my_charset_utf16_nopad_bin); + add_compiled_collation(&my_charset_utf16le_general_nopad_ci); + add_compiled_collation(&my_charset_utf16le_nopad_bin); #ifdef HAVE_UCA_COLLATIONS add_compiled_collation(&my_charset_utf16_unicode_ci); add_compiled_collation(&my_charset_utf16_german2_uca_ci); @@ -389,6 +419,8 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused))) #ifdef HAVE_CHARSET_utf32 add_compiled_collation(&my_charset_utf32_general_ci); add_compiled_collation(&my_charset_utf32_bin); + add_compiled_collation(&my_charset_utf32_general_nopad_ci); + add_compiled_collation(&my_charset_utf32_nopad_bin); #ifdef HAVE_UCA_COLLATIONS add_compiled_collation(&my_charset_utf32_unicode_ci); add_compiled_collation(&my_charset_utf32_german2_uca_ci); diff --git a/mysys/charset.c b/mysys/charset.c index 2efe415af54..2d9df9f47e4 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -123,13 +123,21 @@ static my_bool init_state_maps(struct charset_info_st *cs) } +static MY_COLLATION_HANDLER *get_simple_collation_handler_by_flags(uint flags) +{ + return flags & MY_CS_BINSORT ? + (flags & MY_CS_NOPAD ? + &my_collation_8bit_nopad_bin_handler : + &my_collation_8bit_bin_handler) : + (flags & MY_CS_NOPAD ? + &my_collation_8bit_simple_nopad_ci_handler : + &my_collation_8bit_simple_ci_handler); +} + + static void simple_cs_init_functions(struct charset_info_st *cs) { - if (cs->state & MY_CS_BINSORT) - cs->coll= &my_collation_8bit_bin_handler; - else - cs->coll= &my_collation_8bit_simple_ci_handler; - + cs->coll= get_simple_collation_handler_by_flags(cs->state); cs->cset= &my_charset_8bit_handler; } |