Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
Description
Under terms of MDEV-31531 we're removing all my_casedn_str() calls, because MDEV-27490 will switch the Unicode version to 14.0.0, and this version does not support inplace lower-casing: some characters can grow in octet length when converting to lower case.
This task is to remove my_casedn_str() calls which use a local char[] buffer, like this example in find_field_in_group_list():
LEX_CSTRING db_name= ((Item_ident*) find_item)->db_name;
|
char name_buff[SAFE_NAME_LEN+1]; |
...
|
if (db_name.str && lower_case_table_names) |
{
|
/* Convert database to lower case for comparison */ |
strmake_buf(name_buff, db_name.str);
|
my_casedn_str(files_charset_info, name_buff);
|
db_name= Lex_cstring_strlen(name_buff);
|
}
|
Let's change code pieces like the above to this style:
LEX_CSTRING db_name= ((Item_ident*) find_item)->db_name;
|
IdentBuffer<SAFE_NAME_LEN> name_buff;
|
..
|
if (db_name.str && lower_case_table_names) |
{
|
/* Convert database to lower case for comparison */ |
db_name= name_buff.copy_casedn(db_name).to_lex_cstring();
|
}
|
where IdentBuffer is a CharBuffer descendant with the utf8 character set:
template<size_t buff_sz> |
class IdentBuffer: public CharBuffer<buff_sz> |
{
|
constexpr static CHARSET_INFO *charset() |
{
|
return &my_charset_utf8mb3_general_ci; |
}
|
public: |
IdentBuffer()
|
{ }
|
IdentBuffer<buff_sz> & copy_casedn(const LEX_CSTRING &str) |
{
|
CharBuffer<buff_sz>::copy_casedn(charset(), str);
|
return *this; |
}
|
...
|
}
|
Note, this task won't touch other (without local char[] buffers) cases of my_casedn_str(), e.g. those using a MEM_ROOT allocated memory for the lower case data. Such calls will be removed separately, in the main patch MDEV-31531.
Attachments
Issue Links
- blocks
-
MDEV-27490 Allow full utf8mb4 for identifiers
- Stalled
-
MDEV-31531 Remove my_casedn_str() and my_caseup_str()
- Closed
-
MDEV-31606 Refactor check_db_name() to get a const argument
- Closed