Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-10142 PL/SQL parser
  3. MDEV-13414

Fix the SP code to avoid excessive use of strlen

    XMLWordPrintable

Details

    • 10.2.2-3, 10.2.2-1, 10.2.2-2, 10.2.2-4, 10.1.18

    Description

      Functions sp_load_for_information_schema() and show_create_sp() do a lot of strlen calls, e.g.:

        if (parse_user(definer, strlen(definer),
                       definer_user_name.str, &definer_user_name.length,
                       definer_host_name.str, &definer_host_name.length) &&
            definer_user_name.length && !definer_host_name.length)
      

        if (!show_create_sp(thd, &defstr,
                           type,
                           NULL, 0,
                           name->m_name.str, name->m_name.length,
                           params, strlen(params),
                           returns, strlen(returns),
                           body, strlen(body),
                           &chistics, definer_user_name, definer_host_name,
                           sql_mode))
      

        if (!show_create_sp(thd, &defstr, type,
                           sp_db_str.str, sp_db_str.length,
                           sp_name_obj.m_name.str, sp_name_obj.m_name.length,
                           params, strlen(params),
                           returns, strlen(returns), 
                           sp_body, strlen(sp_body),
                           &sp_chistics, &definer_user, &definer_host, sql_mode))
      

      This code is going to be shared by Oracle-style packages soon (MDEV-10591). Before adding packages, it would be nice to get rid of strlen calls.

      Under terms if this task we'll change API for these functions to accept LEX_CSTRING instead of const char * and fix the caller code accordingly.

      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.