PL/SQL parser (MDEV-10142)

[MDEV-13533] Remove the THD parameter from sp_head::init_sp_name() Created: 2017-08-15  Updated: 2018-08-31  Resolved: 2017-08-15

Status: Closed
Project: MariaDB Server
Component/s: Stored routines
Affects Version/s: None
Fix Version/s: 10.3.1

Type: Technical task Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Blocks
blocks MDEV-10591 Oracle-style packages Closed
Sprint: 10.2.2-3, 10.2.2-1, 10.2.2-2, 10.2.2-4, 10.1.18

 Description   

sp_head has its own member MEM_ROOT main_mem_root.
The caller of sp_head::init_sp_name() currently makes sure to set THD::mem_root to &sphead::main_mem_root, by calling sphead::reset_thd_mem_root(THD*). So the name is effectively created on main_mem_root anyway.

There is no a need to pass a pointer to THD to init_sp_name(). It's much safer to create the name by allocating memory directly on sp_head::main_mem_root, instead of using its alias THD::mem_root.

Under terms of this task we'll do the following:

  • Change:

    void init_sp_name(THD *thd, const sp_name *spname);
    

    to

    void init_sp_name(const sp_name *spname);
    

  • Change:

    bool Database_qualified_name::make_qname(THD *thd, LEX_CSTRING *dst) const;
    

    to

    bool make_qname(MEM_ROOT *mem_root, LEX_CSTRING *dst) const;
    

After this change, the code will be more flexible, as it will be possible to call init_sp_name() without prior call for sp->reset_thd_mem_root(thd).



 Comments   
Comment by Alexander Barkov [ 2017-08-15 ]

Pushed to bb-10.2-ext and 10.3

Generated at Thu Feb 08 08:06:19 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.