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

Change parameter of make_sp_name*() from LEX_CSTRING to Lex_ident_sys_st

    XMLWordPrintable

Details

    • Task
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • 11.3.0
    • OTHER
    • None

    Description

      In order to implement MDEV-31606 and MDEV-27490 easier let's change a few LEX methods as follows:

      -  sp_name *make_sp_name(THD *thd, const LEX_CSTRING *name);
      -  sp_name *make_sp_name(THD *thd, const LEX_CSTRING *name1,
      -                                  const LEX_CSTRING *name2);
      -  sp_name *make_sp_name_package_routine(THD *thd, const LEX_CSTRING *name);
      +  sp_name *make_sp_name(THD *thd, const Lex_ident_sys_st &name);
      +  sp_name *make_sp_name(THD *thd, const Lex_ident_sys_st &name1,
      +                                  const Lex_ident_sys_st &name2);
      +  sp_name *make_sp_name_package_routine(THD *thd,
      +                                        const Lex_ident_sys_st &name);
      

      Changing LEX_CSTRING to Lex_ident_sys_st makes the code inside these methods clear, because Lex_ident_sys_st additionally guarantees that the value comes from the "ident" rule from sql_yacc.yy, so:

      • Its LEX_CSTRING::str is not NULL (sql_yacc.yy would abort otherwise)
      • Its LEX_CSTRING::str is 0-terminated
      • Its a valid utf8 string
      • The string pointed by LEX_CSTRING::str was created on THD::mem_root

      Also, let's change "pass by pointer" to "pass by reference", as these parameters can never be NULL - they are Bison stack variables.

      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.