diff options
author | Dmitry Shulga <dmitry.shulga@mariadb.com> | 2022-12-15 21:19:56 +0700 |
---|---|---|
committer | Dmitry Shulga <dmitry.shulga@mariadb.com> | 2022-12-15 21:19:56 +0700 |
commit | e7d2a50c3490a102dea580fd54dd760eeabe7906 (patch) | |
tree | 3e2294ec7fc93aa9a83cd4bb54c7ffc96029cdaf /sql/sp_instr.h | |
parent | f89cf1cf4bb89cadfc997f08be7b6b26fbe9d40d (diff) | |
download | mariadb-git-10.11-MDEV-5816-1.tar.gz |
MDEV-5816: Stored programs: validation of stored program statements10.11-MDEV-5816-1
This is the follow-up to the commit i943b463cfaa303845a298d50a5c757cba6ab05e4
that fixes the issue with NEW/OLD pseudo-column in re-comipling SP statement.
Diffstat (limited to 'sql/sp_instr.h')
-rw-r--r-- | sql/sp_instr.h | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/sql/sp_instr.h b/sql/sp_instr.h index b8e9d79d34c..ffdc36133a6 100644 --- a/sql/sp_instr.h +++ b/sql/sp_instr.h @@ -601,12 +601,11 @@ protected: { DBUG_ASSERT(thd->lex->current_select->item_list.elements == 1); - // TODO: how to get an item corresponding to an expression in - // the statement SET var=expr ? m_value= thd->lex->current_select->item_list.head(); DBUG_ASSERT(m_value != nullptr); - return false; + // Return error in release version if m_value == nullptr + return m_value == nullptr; } sp_rcontext *get_rcontext(THD *thd) const; @@ -714,7 +713,11 @@ public: trigger_field(trg_fld), value(val), m_expr_str(value_query) - {} + { + m_trigger_field_name= + LEX_CSTRING{strdup_root(current_thd->mem_root, trg_fld->field_name.str), + trg_fld->field_name.length}; + } int execute(THD *thd, uint *nextp) override; @@ -732,6 +735,8 @@ public: value= nullptr; } + bool on_after_expr_parsing(THD *thd) override; + protected: LEX_CSTRING get_expr_query() const override { @@ -746,6 +751,7 @@ private: */ LEX_CSTRING m_expr_str; + LEX_CSTRING m_trigger_field_name; public: PSI_statement_info* get_psi_info() override { return & psi_info; } static PSI_statement_info psi_info; @@ -925,7 +931,8 @@ protected: m_expr= thd->lex->current_select->item_list.head(); DBUG_ASSERT(m_expr != nullptr); - return false; + // Return error in release version if m_expr == nullptr + return m_expr == nullptr; } private: @@ -1013,8 +1020,6 @@ protected: void invalidate() override { - /* TODO: be careful and check that the object referenced by m_value - is not leaked */ m_value= nullptr; } @@ -1022,6 +1027,9 @@ protected: { DBUG_ASSERT(thd->lex->current_select->item_list.elements == 1); m_value= thd->lex->current_select->item_list.head(); + DBUG_ASSERT(m_value != nullptr); + + // Return error in release version if m_value == nullptr return m_value == nullptr; } @@ -1230,6 +1238,12 @@ protected: return m_cursor_query; } + bool on_after_expr_parsing(THD *) override + { + m_metadata_changed= false; + return false; + } + private: uint m_cursor; /**< Frame offset (for debugging) */ @@ -1544,7 +1558,8 @@ protected: m_case_expr= thd->lex->current_select->item_list.head(); DBUG_ASSERT(m_case_expr != nullptr); - return false; + // Return error in release version if m_case_expr == nullptr + return m_case_expr == nullptr; } private: |