diff options
Diffstat (limited to 'sql/sp.cc')
-rw-r--r-- | sql/sp.cc | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/sql/sp.cc b/sql/sp.cc index 334b5e12ba3..4b65f835f70 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -1751,7 +1751,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. @@ -1759,7 +1760,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; @@ -1775,17 +1776,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); |