PL/SQL parser (MDEV-10142)

[MDEV-13292] Move the code from sp_head::init() to sp_head::sp_head() Created: 2017-07-11  Updated: 2018-08-31  Resolved: 2017-08-15

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

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

Issue Links:
Blocks
blocks MDEV-10591 Oracle-style packages Closed
blocks MDEV-13139 Package-wide variables in CREATE PACKAGE Stalled
Sprint: 10.2.2-3, 10.2.2-1, 10.2.2-2, 10.2.2-4, 10.1.18

 Description   

This task is a part of MDEV-10591 Oracle-style packages.

In order for packages to reuse all routine features, such as:

  • package-wide variables, exceptions, cursors, etc
  • package executable initialization block
    under terms of MDEV-10591 we'll introduce new classes (with proposed names Package and Package_body)
    and derived these classes from sp_head.

To simplify initialization of the Package* instances, we need to move most the code from sp_head::init to sp_head::sp_head.

The relevant code:

sp_head::init(LEX *lex)
{
  ...
  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;
  ...
}

Currently new instances of sp_head are created by LEX::make_sp_head, in this code:

  ...
  if ((sp= new sp_head(type)))
  {
    sp->reset_thd_mem_root(thd);
    sp->init(this);
  ...

Notice, the constructor call in new is immediately followed by init(this).
After this task, the above members will be initialized in the constructor rather than in init().



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

Pushed to bb-10.2-ext and 10.3.

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