Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-10142 PL/SQL parser
  3. MDEV-13415

Wrap the code in sp.cc into a class Sp_handler

    XMLWordPrintable

Details

    • 10.2.2-3, 10.2.2-1, 10.2.2-2, 10.2.2-4, 10.1.18

    Description

      The code in sp.sp, sp_head.cc, sql_acl.cc, sql_lex.cc, sql_show.cc, sql_yacc*.yy uses a lot of conditions on the routine type, e.g.

        if (type == TYPE_ENUM_FUNCTION)
          do_func;
        else
          do_proc;
      

      Oracle style packages (MDEV-10591) will introduce new SP object types: TYPE_ENUM_PACKAGE_SPEC and TYPE_ENUM_PACKAGE_BODY.
      The conditional type-related code will get more complex.

      Under terms of this code we'll create a new class Sp_handler with a number of virtual methods, to simplify handling of SP objects of different types and therefore simplify adding packages.

      We'll add the be the top level abstract class Sp_handler with this approximate set of virtual methods:

      class Sp_handler
      {
      public:
        virtual const char *show_create_routine_col1_caption() const;
        virtual const char *show_create_routine_col3_caption() const;
        virtual stored_procedure_type type() const;
        virtual LEX_CSTRING type_lex_cstring() const;
        virtual LEX_CSTRING empty_body_lex_cstring() const;
        virtual MDL_key::enum_mdl_namespace get_mdl_type() const;
        virtual sp_cache **get_cache(THD *) const;  
        virtual HASH *priv_hash() const;
        virtual ulong recursion_depth(THD *thd) const;
        virtual void recursion_level_error(THD *thd, const sp_head *sp) const;
      };
      

      and will add instantiable sub-classes for certain SP object types:

      Sp_handler
        Sp_handler_procedure
        Sp_handler_trigger
        Sp_handler_function
      

      MDEV-10591 will later add Sp_handler_package_spec and Sp_handler_package_body sub-classes.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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