From 8feb984211f559ad8bf2f231544cf8852b23632d Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 17 Aug 2016 10:33:31 +0400 Subject: MDEV-10411 Providing compatibility for basic PL/SQL constructs Part 5: EXIT statement Adding unconditional EXIT statement: EXIT [ label ] Conditional EXIT statements with WHERE clause will be added in a separate patch. --- sql/sp_pcontext.cc | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'sql/sp_pcontext.cc') diff --git a/sql/sp_pcontext.cc b/sql/sp_pcontext.cc index e8748ffb852..db2d36978d4 100644 --- a/sql/sp_pcontext.cc +++ b/sql/sp_pcontext.cc @@ -197,10 +197,11 @@ sp_variable *sp_pcontext::add_variable(THD *thd, LEX_STRING name) } -sp_label *sp_pcontext::push_label(THD *thd, LEX_STRING name, uint ip) +sp_label *sp_pcontext::push_label(THD *thd, LEX_STRING name, uint ip, + sp_label::enum_type type) { sp_label *label= - new (thd->mem_root) sp_label(name, ip, sp_label::IMPLICIT, this); + new (thd->mem_root) sp_label(name, ip, type, this); if (!label) return NULL; @@ -236,6 +237,23 @@ sp_label *sp_pcontext::find_label(const LEX_STRING name) } +sp_label *sp_pcontext::find_label_current_loop_start() +{ + List_iterator_fast li(m_labels); + sp_label *lab; + + while ((lab= li++)) + { + if (lab->type == sp_label::ITERATION) + return lab; + } + // See a comment in sp_pcontext::find_label() + return (m_parent && (m_scope == REGULAR_SCOPE)) ? + m_parent->find_label_current_loop_start() : + NULL; +} + + bool sp_pcontext::add_condition(THD *thd, LEX_STRING name, sp_condition_value *value) -- cgit v1.2.1