summaryrefslogtreecommitdiff
path: root/sql/sp.cc
diff options
context:
space:
mode:
authorunknown <andrey@lmy004.>2006-08-09 17:19:39 +0200
committerunknown <andrey@lmy004.>2006-08-09 17:19:39 +0200
commitb60873b10df5b16071ae5050aa5041cb772f252f (patch)
treeafc063439f2b0976808cc2b0d6304aca9193d74c /sql/sp.cc
parent29701579b346a981faa10fa01b2c666a03457a94 (diff)
parent0231ca09b52bab67e2a351505b00b03a83cdf939 (diff)
downloadmariadb-git-b60873b10df5b16071ae5050aa5041cb772f252f.tar.gz
Merge ahristov@bk-internal.mysql.com:/home/bk/mysql-5.1-runtime
into lmy004.:/work/mysql-5.1-runtime sql/sp.cc: Auto merged sql/sql_yacc.yy: Auto merged mysql-test/r/sp.result: manual merge mysql-test/t/sp.test: manual merge
Diffstat (limited to 'sql/sp.cc')
-rw-r--r--sql/sp.cc21
1 files changed, 15 insertions, 6 deletions
diff --git a/sql/sp.cc b/sql/sp.cc
index c1bfc4f26cd..d8bbd97f601 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -992,6 +992,12 @@ sp_find_routine(THD *thd, int type, sp_name *name, sp_cache **cp,
}
DBUG_RETURN(sp->m_first_free_instance);
}
+ /*
+ Actually depth could be +1 than the actual value in case a SP calls
+ SHOW CREATE PROCEDURE. Hence, the linked list could hold up to one more
+ instance.
+ */
+
level= sp->m_last_cached_sp->m_recursion_level + 1;
if (level > depth)
{
@@ -1161,19 +1167,22 @@ sp_update_procedure(THD *thd, sp_name *name, st_sp_chistics *chistics)
int
sp_show_create_procedure(THD *thd, sp_name *name)
{
+ int ret= SP_KEY_NOT_FOUND;
sp_head *sp;
DBUG_ENTER("sp_show_create_procedure");
DBUG_PRINT("enter", ("name: %.*s", name->m_name.length, name->m_name.str));
+ /*
+ Increase the recursion limit for this statement. SHOW CREATE PROCEDURE
+ does not do actual recursion.
+ */
+ thd->variables.max_sp_recursion_depth++;
if ((sp= sp_find_routine(thd, TYPE_ENUM_PROCEDURE, name,
&thd->sp_proc_cache, FALSE)))
- {
- int ret= sp->show_create_procedure(thd);
+ ret= sp->show_create_procedure(thd);
- DBUG_RETURN(ret);
- }
-
- DBUG_RETURN(SP_KEY_NOT_FOUND);
+ thd->variables.max_sp_recursion_depth--;
+ DBUG_RETURN(ret);
}