diff options
author | Dmitry Shulga <dmitry.shulga@mariadb.com> | 2022-06-09 15:27:29 +0700 |
---|---|---|
committer | Dmitry Shulga <dmitry.shulga@mariadb.com> | 2022-06-10 18:55:58 +0700 |
commit | e9d961d77649ded6e468c43b8e116045f9054f43 (patch) | |
tree | 9dbd16270eb01e21e0a4aa90c284c96fd4cb7b87 /sql/sql_class.h | |
parent | 4655641c09472fc5e863f65450b1c359ded280e6 (diff) | |
download | mariadb-git-bb-10.9-MDEV-5816-1.tar.gz |
MDEV-5816: Stored programs: validation of stored program statementsbb-10.9-MDEV-5816-1
This is the prerequisite patch introducing the class sp_lex_instr
that encapsulates access to an instance of sp_lex_keeper. Every SP instruction
that does need access to a LEX object on its processing should inherit this class
and implement two abstract methods:
is_invalid(),
invalidate().
These method will be used in subsequent patches to implement recomplilation of
SP instructions on failure.
Currently, the following instructions are derived from the class sp_lex_instr:
sp_instr_stmt,
sp_instr_set,
sp_instr_set_trigger_field,
sp_instr_jump_if_not,
sp_instr_freturn,
sp_instr_cpush,
sp_instr_cursor_copy_struct,
sp_instr_set_case_expr
Additionally, this patch converts the class sp_instr_opt_meta
to the base abstract class (that is, not inhereted from
the class sp_instr).
Every jump SP instruction now must be inhereted directly from
the class sp_instr_opt_meta and additionally from either the class
sp_lex_instr or sp_instr depending on whether this SP instruction
does need access to LEX object or not.
Moreover, the class sp_cursor is no more owner of sp_lex_keeper.
Instead, the virtual method get_lex_keeper() has been added to the
class sp_cursor() that returns nullptr and this method is overriden
in the derived class sp_instr_cpush to provide a pointer to a real
instance of the class sp_lex_keeper.
Diffstat (limited to 'sql/sql_class.h')
-rw-r--r-- | sql/sql_class.h | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h index 806f77c1ba2..53e59549912 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -5952,19 +5952,17 @@ private: public: sp_cursor() :result(NULL, false), - m_lex_keeper(NULL), server_side_cursor(NULL) { } - sp_cursor(THD *thd_arg, sp_lex_keeper *lex_keeper, bool view_structure_only) + sp_cursor(THD *thd_arg, bool view_structure_only) :result(thd_arg, view_structure_only), - m_lex_keeper(lex_keeper), server_side_cursor(NULL) {} virtual ~sp_cursor() { destroy(); } - sp_lex_keeper *get_lex_keeper() { return m_lex_keeper; } + virtual sp_lex_keeper *get_lex_keeper() { return nullptr; } int open(THD *thd); @@ -5977,17 +5975,15 @@ public: bool export_structure(THD *thd, Row_definition_list *list); - void reset(THD *thd_arg, sp_lex_keeper *lex_keeper) + void reset(THD *thd_arg) { sp_cursor_statistics::reset(); result.reset(thd_arg); - m_lex_keeper= lex_keeper; server_side_cursor= NULL; } private: Select_fetch_into_spvars result; - sp_lex_keeper *m_lex_keeper; Server_side_cursor *server_side_cursor; void destroy(); }; |