Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-32019

Replace my_casedn_str(local_buffer) to CharBuffer::copy_casedn()

    XMLWordPrintable

Details

    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

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.