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

Duplicate code cleanup: add function normalize_db_name()

Details

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

    Description

      There is a duplicate code in sql_db.cc, in functions mysql_create_db_internal() and mysql_rm_db_internal().

      char db_tmp[SAFE_NAME_LEN], *dbnorm;
      if (lower_case_table_names)
      {
        strmake_buf(db_tmp, db);
        my_casedn_str(system_charset_info, db_tmp);
        dbnorm= db_tmp;
      }
      else
        dbnorm= db;
      

      Will introduce a new function normalize_db_name() and reuse it.

      This change was originally a part of MDEV-11952, but it was decided to commit it as a standalone change.

      Attachments

        Issue Links

          Activity

            bar Alexander Barkov created issue -
            bar Alexander Barkov made changes -
            Field Original Value New Value
            bar Alexander Barkov made changes -
            Description
            There is a duplicate code in {{sql_db.cc}}, in functions {{mysql_create_db_internal()}} and {{mysql_rm_db_internal()}}.

            {code:cpp}
            char db_tmp[SAFE_NAME_LEN], *dbnorm;
            if (lower_case_table_names)
            {
              strmake_buf(db_tmp, db);
              my_casedn_str(system_charset_info, db_tmp);
              dbnorm= db_tmp;
            }
            else
              dbnorm= db;
            {code}

            Will introduce a new function {{normalize_db_name()}} and reuse it.
            There is a duplicate code in {{sql_db.cc}}, in functions {{mysql_create_db_internal()}} and {{mysql_rm_db_internal()}}.

            {code:cpp}
            char db_tmp[SAFE_NAME_LEN], *dbnorm;
            if (lower_case_table_names)
            {
              strmake_buf(db_tmp, db);
              my_casedn_str(system_charset_info, db_tmp);
              dbnorm= db_tmp;
            }
            else
              dbnorm= db;
            {code}

            Will introduce a new function {{normalize_db_name()}} and reuse it.
            bar Alexander Barkov made changes -
            Description There is a duplicate code in {{sql_db.cc}}, in functions {{mysql_create_db_internal()}} and {{mysql_rm_db_internal()}}.

            {code:cpp}
            char db_tmp[SAFE_NAME_LEN], *dbnorm;
            if (lower_case_table_names)
            {
              strmake_buf(db_tmp, db);
              my_casedn_str(system_charset_info, db_tmp);
              dbnorm= db_tmp;
            }
            else
              dbnorm= db;
            {code}

            Will introduce a new function {{normalize_db_name()}} and reuse it.
            There is a duplicate code in {{sql_db.cc}}, in functions {{mysql_create_db_internal()}} and {{mysql_rm_db_internal()}}.

            {code:cpp}
            char db_tmp[SAFE_NAME_LEN], *dbnorm;
            if (lower_case_table_names)
            {
              strmake_buf(db_tmp, db);
              my_casedn_str(system_charset_info, db_tmp);
              dbnorm= db_tmp;
            }
            else
              dbnorm= db;
            {code}

            Will introduce a new function {{normalize_db_name()}} and reuse it.

            This change was originally a part of MDEV-11952, but it was decided to commit it as a standalone change.
            bar Alexander Barkov made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            bar Alexander Barkov made changes -
            issue.field.resolutiondate 2017-03-29 15:11:21.0 2017-03-29 15:11:21.542
            bar Alexander Barkov made changes -
            Fix Version/s 10.3.0 [ 22127 ]
            Fix Version/s 10.3 [ 22126 ]
            Resolution Fixed [ 1 ]
            Status In Progress [ 3 ] Closed [ 6 ]
            bar Alexander Barkov made changes -
            Labels Compatibility Compatibility refactoring
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 80172 ] MariaDB v4 [ 151881 ]

            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.