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

Split Item_func_hex::val_str_ascii() into virtual methods in Type_handler

    XMLWordPrintable

Details

    Description

      Item_func_hex::val_str_ascii() has a few tests on args[0]->result_type().

         if (args[0]->result_type() == REAL_RESULT ||
             args[0]->result_type() == DECIMAL_RESULT)
      

      We'll move the data type specific code to the corresponding Type_handler_xxx, and rewrite Item_func_hex::val_str_ascii() to call a virtual method in Type_handler, e.g. about like this:

       String *val_str_ascii(String *str)
       {
         return args[0]->type_handler()->Item_func_hex_val_str_ascii(this, str);
       }
      

      Note, the value of args[0]->type_handler() can be cached at fix_length_and_dec() time, to have fewer virtual calls at run time:

       String *val_str_ascii(String *str)
       {
         return m_handler->Item_func_hex_val_str_ascii(this, str);
       }
      

      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.