PL/SQL parser (MDEV-10142)

[MDEV-13528] Add LEX::sp_body_finalize_{procedure|function} 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: Compatibility

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   

This change is done under terms of a separate MDEV, to reduce the patch size for MDEV-10591.

In order to save some duplicate code in sql_yacc.yy and sql_yacc_ora.yy, between

  • FUNCTION
  • PROCEDURE
  • Package FUNCTION (coming soon in MDEV-10591)
  • Package PROCEDURE (coming soon in MDEV-10591)
    we'll introduce two new methods:

bool LEX::sp_body_finalize_procedure(THD *thd)
{
  if (sphead->check_unresolved_goto())
    return true;
  sphead->set_stmt_end(thd);
  sphead->restore_thd_mem_root(thd);
  return false;
}
 
bool LEX::sp_body_finalize_function(THD *thd)
{
  if (sphead->is_not_allowed_in_function("function"))
    return true;
  if (!(sphead->m_flags & sp_head::HAS_RETURN))
  {
    my_error(ER_SP_NORETURN, MYF(0), ErrConvDQName(sphead).ptr());
    return true;
  }
  if (sp_body_finalize_procedure(thd))
    return true;
  (void) is_native_function_with_warn(thd, &sphead->m_name);
  return false;
}

and use these methods in *.yy files.



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

Pushed to bb-10.2-ext and 10.3.

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