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

Remove sp_name::m_qname

    XMLWordPrintable

    Details

      Description

      The class sp_name has a member LEX_STRING m_qname. This member is needed only for error reporting purposes. it contains redundant information and is always synchronized with the other two members LEX_STRING members
      m_db and m_name. In normal cases (when no errors happen) the current code assumes redundant work to keep m_qname valid whenever m_db and m_name are initially set or are later modified.

      Instead of maintaining the redundant member m_qname we'll introduce two new classes:

      1. Database_qualified_name

      class Database_qualified_name
      {
      public:
        LEX_STRING m_db;
        LEX_STRING m_name;
        ...
      }
      

      Under terms of this task we'll derive sp_name and sp_head from this new class Database_qualified_name.

      Later, under terms of separate tasks, we'll derive more classes from Database_qualified_name. For example, Item_ident is a good candidate for.

      2. ErrConvDQName - a new ErrConv family class (in addition to those defined in sql_error.h}
      This class will be used whenever we need to send a database qualified object name to an error message.

      class ErrConvDQName: public ErrConv
      {
        const Database_qualified_name *m_name;
      public:
        ErrConvDQName(const Database_qualified_name *name)
         :m_name(name)
        { }
        const char *ptr() const
        {
          // code to make a string in format 'dbname.name' in {{ErrConv::err_buffer}}
        }
      };
      

      Open question:
      Perhaps the class name should be Database_qualified_object_name. Because later we'll need a derived class Database_qualfieid_column_name, which will add a new LEX_STRING member to store column names.

        Attachments

          Activity

            People

            Assignee:
            bar Alexander Barkov
            Reporter:
            bar Alexander Barkov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: