Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-10142 PL/SQL parser
  3. MDEV-13292

Move the code from sp_head::init() to sp_head::sp_head()

    Details

    • 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().

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bar Alexander Barkov
                Reporter:
                bar Alexander Barkov
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: