summaryrefslogtreecommitdiff
path: root/sql/sp_pcontext.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2016-08-17 10:33:31 +0400
committerAlexander Barkov <bar@mariadb.org>2017-04-05 15:02:44 +0400
commit8feb984211f559ad8bf2f231544cf8852b23632d (patch)
tree7fac25a4c0ff09df8cbca18390efb652c560c9c8 /sql/sp_pcontext.cc
parent765d9d6429588d3aa27ded3e58bb6bac3e7c139b (diff)
downloadmariadb-git-8feb984211f559ad8bf2f231544cf8852b23632d.tar.gz
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.
Diffstat (limited to 'sql/sp_pcontext.cc')
-rw-r--r--sql/sp_pcontext.cc22
1 files changed, 20 insertions, 2 deletions
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<sp_label> 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)