summaryrefslogtreecommitdiff
path: root/sql/sp.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sp.cc')
-rw-r--r--sql/sp.cc22
1 files changed, 10 insertions, 12 deletions
diff --git a/sql/sp.cc b/sql/sp.cc
index 46970bafdfc..6ec59143720 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -1797,7 +1797,8 @@ sp_find_routine(THD *thd, stored_procedure_type type, sp_name *name,
@param thd Thread handler
@param routines List of needles in the hay stack
- @param any Any of the needles are good enough
+ @param is_proc Indicates whether routines in the list are procedures
+ or functions.
@return
@retval FALSE Found.
@@ -1805,7 +1806,7 @@ sp_find_routine(THD *thd, stored_procedure_type type, sp_name *name,
*/
bool
-sp_exist_routines(THD *thd, TABLE_LIST *routines, bool any)
+sp_exist_routines(THD *thd, TABLE_LIST *routines, bool is_proc)
{
TABLE_LIST *routine;
bool sp_object_found;
@@ -1821,17 +1822,14 @@ sp_exist_routines(THD *thd, TABLE_LIST *routines, bool any)
lex_name.str= thd->strmake(routine->table_name, lex_name.length);
name= new sp_name(lex_db, lex_name, true);
name->init_qname(thd);
- sp_object_found= sp_find_routine(thd, TYPE_ENUM_PROCEDURE, name,
- &thd->sp_proc_cache, FALSE) != NULL ||
- sp_find_routine(thd, TYPE_ENUM_FUNCTION, name,
- &thd->sp_func_cache, FALSE) != NULL;
+ sp_object_found= is_proc ? sp_find_routine(thd, TYPE_ENUM_PROCEDURE,
+ name, &thd->sp_proc_cache,
+ FALSE) != NULL :
+ sp_find_routine(thd, TYPE_ENUM_FUNCTION,
+ name, &thd->sp_func_cache,
+ FALSE) != NULL;
thd->get_stmt_da()->clear_warning_info(thd->query_id);
- if (sp_object_found)
- {
- if (any)
- break;
- }
- else if (!any)
+ if (! sp_object_found)
{
my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION or PROCEDURE",
routine->table_name);