Commit 7e8cc90a authored by unknown's avatar unknown

Bugfix of previous WL#1265 commit.

Need a sp_cache_remove() function with implicit name lookup to make the WL task
to work. It's a cleaner and more convenient interface anyway...


sql/sp.cc:
  Modified sp_cache_remove() function calls; just remove by name.
sql/sp_cache.cc:
  Modified sp_cache_remove() function. Get name and lookup/remove, return the
  removed entry, if any.
sql/sp_cache.h:
  Modified sp_cache_remove() function. Get name and lookup/remove, return the
  removed entry, if any.
parent 562a04d5
...@@ -286,12 +286,9 @@ sp_drop_procedure(THD *thd, char *name, uint namelen) ...@@ -286,12 +286,9 @@ sp_drop_procedure(THD *thd, char *name, uint namelen)
sp_head *sp; sp_head *sp;
int ret; int ret;
sp= sp_cache_lookup(&thd->sp_proc_cache, name, namelen); sp= sp_cache_remove(&thd->sp_proc_cache, name, namelen);
if (sp) if (sp)
{
sp_cache_remove(&thd->sp_proc_cache, sp);
delete sp; delete sp;
}
ret= db_drop_routine(thd, TYPE_ENUM_PROCEDURE, name, namelen); ret= db_drop_routine(thd, TYPE_ENUM_PROCEDURE, name, namelen);
DBUG_RETURN(ret); DBUG_RETURN(ret);
...@@ -344,12 +341,9 @@ sp_drop_function(THD *thd, char *name, uint namelen) ...@@ -344,12 +341,9 @@ sp_drop_function(THD *thd, char *name, uint namelen)
sp_head *sp; sp_head *sp;
int ret; int ret;
sp= sp_cache_lookup(&thd->sp_func_cache, name, namelen); sp= sp_cache_remove(&thd->sp_func_cache, name, namelen);
if (sp) if (sp)
{
sp_cache_remove(&thd->sp_func_cache, sp);
delete sp; delete sp;
}
ret= db_drop_routine(thd, TYPE_ENUM_FUNCTION, name, namelen); ret= db_drop_routine(thd, TYPE_ENUM_FUNCTION, name, namelen);
DBUG_RETURN(ret); DBUG_RETURN(ret);
......
...@@ -92,10 +92,11 @@ sp_cache_lookup(sp_cache **cp, char *name, uint namelen) ...@@ -92,10 +92,11 @@ sp_cache_lookup(sp_cache **cp, char *name, uint namelen)
return c->lookup(name, namelen); return c->lookup(name, namelen);
} }
void sp_head *
sp_cache_remove(sp_cache **cp, sp_head *sp) sp_cache_remove(sp_cache **cp, char *name, uint namelen)
{ {
sp_cache *c= *cp; sp_cache *c= *cp;
sp_head *sp= NULL;
if (c) if (c)
{ {
...@@ -108,9 +109,10 @@ sp_cache_remove(sp_cache **cp, sp_head *sp) ...@@ -108,9 +109,10 @@ sp_cache_remove(sp_cache **cp, sp_head *sp)
if (c->version < v) if (c->version < v)
c->remove_all(); c->remove_all();
else else
c->remove(sp); sp= c->remove(name, namelen);
c->version= v+1; c->version= v+1;
} }
return sp;
} }
......
...@@ -38,7 +38,7 @@ void sp_cache_insert(sp_cache **cp, sp_head *sp); ...@@ -38,7 +38,7 @@ void sp_cache_insert(sp_cache **cp, sp_head *sp);
sp_head *sp_cache_lookup(sp_cache **cp, char *name, uint namelen); sp_head *sp_cache_lookup(sp_cache **cp, char *name, uint namelen);
/* Remove an SP from cache */ /* Remove an SP from cache */
void sp_cache_remove(sp_cache **cp, sp_head *sp); sp_head *sp_cache_remove(sp_cache **cp, char *name, uint namelen);
/* /*
...@@ -75,10 +75,14 @@ class sp_cache ...@@ -75,10 +75,14 @@ class sp_cache
return (sp_head *)hash_search(&m_hashtable, (const byte *)name, namelen); return (sp_head *)hash_search(&m_hashtable, (const byte *)name, namelen);
} }
inline void inline sp_head *
remove(sp_head *sp) remove(char *name, uint namelen)
{ {
hash_delete(&m_hashtable, (byte *)sp); sp_head *sp= lookup(name, namelen);
if (sp)
hash_delete(&m_hashtable, (byte *)sp);
return sp;
} }
inline void inline void
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment