summaryrefslogtreecommitdiff
path: root/sql/sql_class.h
diff options
context:
space:
mode:
authorDmitry Shulga <dmitry.shulga@mariadb.com>2022-09-20 21:44:41 +0700
committerDmitry Shulga <dmitry.shulga@mariadb.com>2022-09-20 21:44:41 +0700
commitfba5b5a3b04b62dad220913d46b31df2da37a76f (patch)
tree12eabb1eda5bd8502d5c25ad001f34610274d25b /sql/sql_class.h
parent318b30c59d96173f3c73322537afcd4362f5d3b0 (diff)
downloadmariadb-git-bb-10.11-MDEV-5816.tar.gz
MDEV-5816: Stored programs: validation of stored program statementsbb-10.11-MDEV-5816
This is the prerequisite patch introducing the class sp_lex_instr that encapsulates access to an instance of the class sp_lex_keeper. Every SP instruction that need to get access to a LEX object on its processing should inherit this class and implement two abstract methods: is_invalid(), invalidate(). These methods will be used in subsequent patches to implement recompilation 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 base abstract class (that is, not inherited from the class sp_instr). Since this class originally was designed to provide a way for opimizer to update a destination address for jump SP-instructions, the only useful method at the interface of this class is set_destination and therefore inheritance from the class sp_instr is meaningless. 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 need to get access to a LEX object or not. Moreover, the class sp_cursor doesn't own a data member of the class sp_lex_keeper any more. Instead, the virtual method get_lex_keeper() has been added to the class sp_cursor() that returns nullptr and this method is overridden in the derived class sp_instr_cpush to provide a pointer to a real instance of the class sp_lex_keeper. Doing this way we exclude duplication of a data member of the type sp_lex_keeper at the class sp_instr_cpush since it is derived both from sp_lex_instr and sp_cursor, and sp_lex_instr already encapsulates a data member of the class sp_lex_keeper.
Diffstat (limited to 'sql/sql_class.h')
-rw-r--r--sql/sql_class.h10
1 files changed, 3 insertions, 7 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 8fc1b5839a2..c0f0480faa5 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -5942,19 +5942,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);
@@ -5967,17 +5965,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();
};