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)
sp_head *sp;
int ret;
sp= sp_cache_lookup(&thd->sp_proc_cache, name, namelen);
sp= sp_cache_remove(&thd->sp_proc_cache, name, namelen);
if (sp)
{
sp_cache_remove(&thd->sp_proc_cache, sp);
delete sp;
}
ret= db_drop_routine(thd, TYPE_ENUM_PROCEDURE, name, namelen);
DBUG_RETURN(ret);
......@@ -344,12 +341,9 @@ sp_drop_function(THD *thd, char *name, uint namelen)
sp_head *sp;
int ret;
sp= sp_cache_lookup(&thd->sp_func_cache, name, namelen);
sp= sp_cache_remove(&thd->sp_func_cache, name, namelen);
if (sp)
{
sp_cache_remove(&thd->sp_func_cache, sp);
delete sp;
}
ret= db_drop_routine(thd, TYPE_ENUM_FUNCTION, name, namelen);
DBUG_RETURN(ret);
......
......@@ -92,10 +92,11 @@ sp_cache_lookup(sp_cache **cp, char *name, uint namelen)
return c->lookup(name, namelen);
}
void
sp_cache_remove(sp_cache **cp, sp_head *sp)
sp_head *
sp_cache_remove(sp_cache **cp, char *name, uint namelen)
{
sp_cache *c= *cp;
sp_head *sp= NULL;
if (c)
{
......@@ -108,9 +109,10 @@ sp_cache_remove(sp_cache **cp, sp_head *sp)
if (c->version < v)
c->remove_all();
else
c->remove(sp);
sp= c->remove(name, namelen);
c->version= v+1;
}
return 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);
/* 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
return (sp_head *)hash_search(&m_hashtable, (const byte *)name, namelen);
}
inline void
remove(sp_head *sp)
inline sp_head *
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
......
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