summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2023-02-17 16:20:01 +0400
committerAlexander Barkov <bar@mariadb.com>2023-02-17 17:33:27 +0400
commit7f6b648d7db895c09a6ace3b5ee62a5fb482a8e0 (patch)
tree66e727d8e65166497e68447ba659650d0cd53768 /mysys
parent345356b868d840554a8572876efc027d3ccd9842 (diff)
downloadmariadb-git-7f6b648d7db895c09a6ace3b5ee62a5fb482a8e0.tar.gz
MDEV-30661 UPPER() returns an empty string for U+0251 in uca1400 collations for utf8
String length growth during upper/lower conversion in Unicode collations depends only on the underlying MY_UNICASE_INFO used in the collation. Maintaining a separate member CHARSET_INFO::caseup_multiply and CHARSET_INFO::casedn_multiply duplicated this information and caused bugs like this (when MY_UNICASE_INFO and case??_multiply when out of sync because of incomplete CHARSET_INFO initialization). Fix: Changing CHARSET_INFO::caseup_multiply and CHARSET_INFO::casedn_multiply from members to virtual functions. The virtual functions in Unicode collations calculate case conversion growth factors from the MY_UNICASE_INFO. This guarantees that the growth factors are always in sync with the MY_UNICASE_INFO.
Diffstat (limited to 'mysys')
-rw-r--r--mysys/charset.c3
1 files changed, 0 insertions, 3 deletions
diff --git a/mysys/charset.c b/mysys/charset.c
index 9a049689dce..67abfe628a2 100644
--- a/mysys/charset.c
+++ b/mysys/charset.c
@@ -308,8 +308,6 @@ copy_uca_collation(struct charset_info_st *to, CHARSET_INFO *from,
to->max_sort_char= from->max_sort_char;
to->mbminlen= from->mbminlen;
to->mbmaxlen= from->mbmaxlen;
- to->caseup_multiply= from->caseup_multiply;
- to->casedn_multiply= from->casedn_multiply;
to->state|= MY_CS_AVAILABLE | MY_CS_LOADED |
MY_CS_STRNXFRM | MY_CS_UNICODE;
}
@@ -359,7 +357,6 @@ static int add_collation(struct charset_info_st *cs)
if (cs_copy_data(newcs,cs))
return MY_XML_ERROR;
- newcs->caseup_multiply= newcs->casedn_multiply= 1;
newcs->levels_for_order= 1;
if (!strcmp(cs->cs_name.str,"ucs2") )