Commit 3f7f0c6a authored by Alexander Barkov's avatar Alexander Barkov

MDEV-13531 Add Database_qualified_name::copy()

parent 4d50594d
...@@ -619,14 +619,7 @@ sp_head::init_sp_name(THD *thd, const sp_name *spname) ...@@ -619,14 +619,7 @@ sp_head::init_sp_name(THD *thd, const sp_name *spname)
DBUG_ASSERT(spname && spname->m_db.str && spname->m_db.length); DBUG_ASSERT(spname && spname->m_db.str && spname->m_db.length);
/* We have to copy strings to get them into the right memroot. */ /* We have to copy strings to get them into the right memroot. */
Database_qualified_name::copy(mem_root, spname->m_db, spname->m_name);
m_db.length= spname->m_db.length;
m_db.str= strmake_root(thd->mem_root, spname->m_db.str, spname->m_db.length);
m_name.length= spname->m_name.length;
m_name.str= strmake_root(thd->mem_root, spname->m_name.str,
spname->m_name.length);
m_explicit_name= spname->m_explicit_name; m_explicit_name= spname->m_explicit_name;
spname->make_qname(thd, &m_qname); spname->make_qname(thd, &m_qname);
......
...@@ -7505,4 +7505,15 @@ void AUTHID::parse(const char *str, size_t length) ...@@ -7505,4 +7505,15 @@ void AUTHID::parse(const char *str, size_t length)
} }
void Database_qualified_name::copy(MEM_ROOT *mem_root,
const LEX_CSTRING &db,
const LEX_CSTRING &name)
{
m_db.length= db.length;
m_db.str= strmake_root(mem_root, db.str, db.length);
m_name.length= name.length;
m_name.str= strmake_root(mem_root, name.str, name.length);
}
#endif /* !defined(MYSQL_CLIENT) */ #endif /* !defined(MYSQL_CLIENT) */
...@@ -5974,6 +5974,8 @@ class Database_qualified_name ...@@ -5974,6 +5974,8 @@ class Database_qualified_name
(const uchar *) m_name.str, m_name.length, (const uchar *) m_name.str, m_name.length,
(const uchar *) other->m_name.str, other->m_name.length); (const uchar *) other->m_name.str, other->m_name.length);
} }
void copy(MEM_ROOT *mem_root, const LEX_CSTRING &db,
const LEX_CSTRING &name);
// Export db and name as a qualified name string: 'db.name' // Export db and name as a qualified name string: 'db.name'
size_t make_qname(char *dst, size_t dstlen) const size_t make_qname(char *dst, size_t dstlen) const
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment