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

Refactor sp_add_instr_fetch_cursor to get the target list argument

    XMLWordPrintable

Details

    • Q4/2025 Server Development

    Description

      Under terms of MDEV-10152 we'll need LEX::sp_add_instr_fetch_cursor() to get the target list as a parameter, to be able to rewrite it correctly (to the data type of the REF CURSOR .. RETURN clause, instead of setting it post-factum with help of the method sp_instr_fetch_cursor::set_fetch_target_list().

      Proposal:

      • Change the result type of sp_add_instr_fetch_cursor() from sp_instr_fetch_cursor to bool
      • Rename sp_add_instr_fetch_cursor() to sp_add_fetch_cursor() to avoid problems during merge (the opposite return value in bool context)
      • Add a new parameter to sp_add_fetch_cursor(), so it looks like this:

          bool sp_add_fetch_cursor(THD *thd,
                                   const Lex_ident_sys_st &name,
                                   const List<sp_fetch_target> &list);
        

      • Add a new target list parameter to constructors sp_instr_fetch_cursor, sp_instr_cfetch, sp_instr_cfetch_by_ref, remove the methods sp_instr_fetch_cursor::set_fetch_target_list(), sp_instr_fetch_cursor::add_to_fetch_target_list(), as they won't be needed any more.
      • Remove from sql_yacc.yy the grammar rule sp_proc_stmt_fetch_head and add instead a new rule

        fetch_statement_source:
                  ident { $$= $1; }
                | FROM ident { $$= $2; }
                | NEXT_SYM FROM ident { $$= $3; }
                ;
        

      • Change the grammar rule sp_proc_stmt_fetch to the following:

        sp_proc_stmt_fetch:
                FETCH_SYM fetch_statement_source INTO sp_fetch_list
                {
                  if (unlikely(Lex->sp_add_fetch_cursor(thd, $2, *$4)))
                    MYSQL_YYABORT;
                }
        

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Alexander Barkov Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.