[MDEV-12415] Remove sp_name::m_qname Created: 2017-03-31  Updated: 2017-04-07  Resolved: 2017-03-31

Status: Closed
Project: MariaDB Server
Component/s: Parser, Stored routines
Fix Version/s: 10.3.0

Type: Task Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: refactoring


 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.



 Comments   
Comment by Oleksandr Byelkin [ 2017-03-31 ]

OK to push

Comment by Alexander Barkov [ 2017-03-31 ]

Pushed to bb-10.2-ext.

Generated at Thu Feb 08 07:57:32 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.