• Alexander Barkov's avatar
    MDEV-30662 SQL/PL package body does not appear in I_S.ROUTINES.ROUTINE_DEFINITION · 400c1013
    Alexander Barkov authored
    - Moving the code from a public function trim_whitespaces()
      to the class Lex_cstring as methods. This code may
      be useful in other contexts, and also this code becomes
      visible inside sql_class.h
    
    - Adding a helper method THD::strmake_lex_cstring_trim_whitespaces()
    
    - Unifying the way how CREATE PROCEDURE/CREATE FUNCTION and
      CREATE PACKAGE/CREATE PACKAGE BODY work:
    
      a) Now CREATE PACKAGE/CREATE PACKAGE BODY also calls
      Lex->sphead->set_body_start() to remember the cpp body start inside
      an sp_head member.
    
      b) adding a "const char *cpp_body_end" parameter to
      sp_head::set_stmt_end().
    
      These changes made it possible to reuse sp_head::set_stmt_end() inside
      LEX::create_package_finalize() and remove the duplucate code.
    
    - Renaming sp_head::m_body_begin to m_cpp_body_begin and adding a comment
      to make it clear that this member is used only during parsing, and
      points to a fragment inside the cpp buffer.
    
    - Changed sp_head::set_body_start() and sp_head::set_stmt_end()
      to skip the calls related to "body_utf8" in cases when m_parent is not NULL.
      A non-NULL m_parent means that we're inside a package routine.
      "body_utf8" in such case belongs not to the current sphead itself,
      but to parent (the package) sphead.
      So an sphead instance of a package routine should neither initialize,
      nor finalize, nor change in any other ways the "body_utf8" related
      members of Lex_input_stream, and should not take over or copy "body_utf8"
      data from Lex_input_stream to "this".
    400c1013
sql_yacc.yy 584 KB