MDEV-32019 Replace my_casedn_str(local_buffer) to CharBuffer::copy_casedn()

Replacing my_casedn_str() called on local char[] buffer variables
to CharBuffer::copy_casedn() calls.

This is a sub-task for MDEV-31531 Remove my_casedn_str()

Details:
- Adding a helper template class IdentBuffer (a CharBuffer descendant),
  which assumes utf8 data. Like CharBuffer, it's initialized to an empty
  string in the constructor, but can be populated with lower-cased data
  later.

- Adding a helper template class IdentBufferCasedn, which initializes
  to lower case right in the constructor.

- Removing char[] buffers, replacing them to IdentBuffer and IdentBufferCasedn.

- Changing the data type of "db" and "table" parameters from
  "const char*" to LEX_CSTRING in the following functions:

    find_field_in_table_ref()
    insert_fields()
    set_thd_db()
    mysql_grant()

  to reuse IdentBuffer easeir.
This commit is contained in:
Alexander Barkov 2023-08-26 14:39:18 +04:00
commit cb37c99dd8
14 changed files with 113 additions and 117 deletions

View file

@ -3638,7 +3638,7 @@ bool ha_mroonga::storage_create_foreign_key(TABLE *table,
Alter_info *alter_info = &lex->alter_info;
List_iterator<Key> key_iterator(alter_info->key_list);
Key *key;
char ref_db_buff[NAME_LEN + 1], ref_table_buff[NAME_LEN + 1];
IdentBuffer<NAME_LEN> ref_db_buff, ref_table_buff;
while ((key = key_iterator++))
{
if (key->type != MRN_KEYTYPE_FOREIGN)
@ -3673,9 +3673,7 @@ bool ha_mroonga::storage_create_foreign_key(TABLE *table,
#endif
DBUG_PRINT("info", ("mroonga: ref_db_name=%s", ref_db_name.str));
if (ref_db_name.str && lower_case_table_names) {
strmake(ref_db_buff, ref_db_name.str, sizeof(ref_db_buff) - 1);
my_casedn_str(system_charset_info, ref_db_buff);
ref_db_name.str = ref_db_buff;
ref_db_name= ref_db_buff.copy_casedn(ref_db_name).to_lex_cstring();
DBUG_PRINT("info", ("mroonga: casedn ref_db_name=%s", ref_db_name.str));
}
#ifdef MRN_FOREIGN_KEY_USE_CONST_STRING
@ -3685,9 +3683,7 @@ bool ha_mroonga::storage_create_foreign_key(TABLE *table,
#endif
DBUG_PRINT("info", ("mroonga: ref_table_name=%s", ref_table_name.str));
if (ref_table_name.str && lower_case_table_names) {
strmake(ref_table_buff, ref_table_name.str, sizeof(ref_table_buff) - 1);
my_casedn_str(system_charset_info, ref_table_buff);
ref_table_name.str = ref_table_buff;
ref_table_name= ref_table_buff.copy_casedn(ref_table_name).to_lex_cstring();
DBUG_PRINT("info", ("mroonga: casedn ref_table_name=%s", ref_table_name.str));
}
if (ref_db_name.str && strcmp(table->s->db.str, ref_db_name.str))