[MDEV-18796] Synchronize PS grammar between sql_yacc.yy and sql_yacc_ora.yy Created: 2019-03-02  Updated: 2019-03-04  Resolved: 2019-03-03

Status: Closed
Project: MariaDB Server
Component/s: Parser, Prepared Statements
Fix Version/s: 10.4.4

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

Issue Links:
Blocks
blocks MDEV-12518 Unify sql_yacc.yy and sql_yacc_ora.yy Closed
is blocked by MDEV-18806 Synchronize ALTER TABLE EXCHANGE PART... Closed

 Description   

PS related C++ code blocks diverged in the two *.yy files.
Under terms of this task we'll synchronize the code.
Let's move these LEX members:

  LEX_CSTRING prepared_stmt_name;
  Item *prepared_stmt_code;
  List<Item> prepared_stmt_params;

into a separate new class Lex_prepared_stmt, move the C++ code blocks to LEX and to the new class as methods and reuse these methods in *.yy files.
In the new reduction the grammar will look as simple as follows:

prepare:
          PREPARE_SYM ident FROM prepare_src
          {
            if (Lex->stmt_prepare($2, $4))
              MYSQL_YYABORT;
          }
        ;
 
execute:
          EXECUTE_SYM ident execute_using
          {
            if (Lex->stmt_execute($2, $3))
              MYSQL_YYABORT;
          }
        | EXECUTE_SYM IMMEDIATE_SYM prepare_src execute_using
          {
            if (Lex->stmt_execute_immediate($3, $4))
              MYSQL_YYABORT;
          }
        ;

i.e. one method call per statement.

Note, a separate class Lex_prepared_stmt will help to move PS related data structures from LEX to new new classes for all PS based statements:

  • Sql_cmd_prepare
  • Sql_cmd_deallocate
  • Sql_cmd_execute
  • Sql_cmd_execute_immediate

This will be done separately, eventually.


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