Commit 59350ce0 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-13292 Move the code from sp_head::init() to sp_head::sp_head()

parent 42cb3dcb
......@@ -540,15 +540,30 @@ sp_head::operator delete(void *ptr, size_t size) throw()
}
sp_head::sp_head()
sp_head::sp_head(stored_procedure_type type)
:Query_arena(&main_mem_root, STMT_INITIALIZED_FOR_SP),
Database_qualified_name(&null_clex_str, &null_clex_str),
m_type(type),
m_flags(0),
m_explicit_name(false),
/*
FIXME: the only use case when name is NULL is events, and it should
be rewritten soon. Remove the else part and replace 'if' with
an assert when this is done.
*/
m_qname(null_clex_str),
m_params(null_clex_str),
m_body(null_clex_str),
m_body_utf8(null_clex_str),
m_defstr(null_clex_str),
m_sp_cache_version(0),
m_creation_ctx(0),
unsafe_flags(0),
m_recursion_level(0),
m_next_cached_sp(0),
m_param_begin(NULL),
m_param_end(NULL),
m_body_begin(NULL),
m_cont_level(0)
{
m_first_instance= this;
......@@ -556,12 +571,6 @@ sp_head::sp_head()
m_last_cached_sp= this;
m_return_field_def.charset = NULL;
/*
FIXME: the only use case when name is NULL is events, and it should
be rewritten soon. Remove the else part and replace 'if' with
an assert when this is done.
*/
m_qname= null_clex_str;
DBUG_ENTER("sp_head::sp_head");
......@@ -573,9 +582,6 @@ sp_head::sp_head()
my_hash_init(&m_sroutines, system_charset_info, 0, 0, 0, sp_sroutine_key,
0, 0);
m_body_utf8.str= NULL;
m_body_utf8.length= 0;
DBUG_VOID_RETURN;
}
......@@ -597,33 +603,6 @@ sp_head::init(LEX *lex)
lex->trg_table_fields.empty();
my_init_dynamic_array(&m_instr, sizeof(sp_instr *), 16, 8, MYF(0));
m_param_begin= NULL;
m_param_end= NULL;
m_body_begin= NULL ;
m_qname.str= NULL;
m_qname.length= 0;
m_explicit_name= false;
m_db.str= NULL;
m_db.length= 0;
m_name.str= NULL;
m_name.length= 0;
m_params.str= NULL;
m_params.length= 0;
m_body.str= NULL;
m_body.length= 0;
m_defstr.str= NULL;
m_defstr.length= 0;
m_return_field_def.charset= NULL;
DBUG_VOID_RETURN;
}
......
......@@ -303,7 +303,7 @@ class sp_head :private Query_arena,
static void
operator delete(void *ptr, size_t size) throw ();
sp_head();
sp_head(stored_procedure_type type);
/// Initialize after we have reset mem_root
void
......
......@@ -5825,11 +5825,10 @@ sp_head *LEX::make_sp_head(THD *thd, sp_name *name,
sp_head *sp;
/* Order is important here: new - reset - init */
if ((sp= new sp_head()))
if ((sp= new sp_head(type)))
{
sp->reset_thd_mem_root(thd);
sp->init(this);
sp->m_type= type;
if (name)
sp->init_sp_name(thd, name);
sp->m_chistics= &sp_chistics;
......
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