summaryrefslogtreecommitdiff
path: root/sql/sp.cc
diff options
context:
space:
mode:
authorunknown <anozdrin@mysql.com>2006-02-22 13:44:04 +0300
committerunknown <anozdrin@mysql.com>2006-02-22 13:44:04 +0300
commit85e54a08c4fc468ab89f8df27bc981027cb22e6c (patch)
treec5cc250b79cd5ffa2679fe4e4773114610047ad0 /sql/sp.cc
parentb56d453c8dd28e3499ed161355fc40d8746012aa (diff)
downloadmariadb-git-85e54a08c4fc468ab89f8df27bc981027cb22e6c.tar.gz
Fix for BUG#7787: Stored procedures: improper warning for "grant execute" statement.
The problem was that error flag was not reset. mysql-test/r/sp-security.result: Results for test case for BUG#7787. mysql-test/t/sp-security.test: A test case for BUG#7787. sql/sp.cc: Reset errors after sp_find_routine().
Diffstat (limited to 'sql/sp.cc')
-rw-r--r--sql/sp.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/sql/sp.cc b/sql/sp.cc
index fe249141fea..ce0282bf810 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -1012,6 +1012,7 @@ sp_exist_routines(THD *thd, TABLE_LIST *routines, bool any, bool no_error)
{
TABLE_LIST *routine;
bool result= 0;
+ bool sp_object_found;
DBUG_ENTER("sp_exists_routine");
for (routine= routines; routine; routine= routine->next_global)
{
@@ -1024,10 +1025,12 @@ sp_exist_routines(THD *thd, TABLE_LIST *routines, bool any, bool no_error)
lex_name.str= thd->strmake(routine->table_name, lex_name.length);
name= new sp_name(lex_db, lex_name);
name->init_qname(thd);
- if (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= 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;
+ mysql_reset_errors(thd, TRUE);
+ if (sp_object_found)
{
if (any)
DBUG_RETURN(1);