mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 04:22:27 +01:00
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...
This commit is contained in:
parent
e42a724fa7
commit
70ea503662
3 changed files with 15 additions and 15 deletions
10
sql/sp.cc
10
sql/sp.cc
|
@ -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 @@ public:
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue