Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-18796

Synchronize PS grammar between sql_yacc.yy and sql_yacc_ora.yy

    Details

      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.

        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: