summaryrefslogtreecommitdiff
path: root/sql/sp_cache.h
diff options
context:
space:
mode:
authorpem@mysql.comhem.se <>2003-10-21 12:08:35 +0200
committerpem@mysql.comhem.se <>2003-10-21 12:08:35 +0200
commite42a724fa74a199c791e5d0d30ae208c94746d5a (patch)
tree2a69a7aa7527c9093f6156dee7a663e6404c913f /sql/sp_cache.h
parent52dae5c79e49f4e10256d7c27af8dfa49540ff04 (diff)
downloadmariadb-git-e42a724fa74a199c791e5d0d30ae208c94746d5a.tar.gz
WL#1265: Fix proper ALTER/DROP support in the SP cache.
New sp_cache C API. When an SP is dropped, old caches (in other threads) become invalid and are cleared. Also, the caches in THD are only created on demand.
Diffstat (limited to 'sql/sp_cache.h')
-rw-r--r--sql/sp_cache.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/sql/sp_cache.h b/sql/sp_cache.h
index 5e7825d70fc..f5b330f6755 100644
--- a/sql/sp_cache.h
+++ b/sql/sp_cache.h
@@ -23,11 +23,36 @@
#endif
class sp_head;
+class sp_cache;
+
+/* Initialize the SP caching once at startup */
+void sp_cache_init();
+
+/* Clear the cache *cp and set *cp to NULL */
+void sp_cache_clear(sp_cache **cp);
+
+/* Insert an SP to cache. If 'cp' points to NULL, it's set to a new cache */
+void sp_cache_insert(sp_cache **cp, sp_head *sp);
+
+/* Lookup an SP in cache */
+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);
+
+
+/*
+ *
+ * The cache class. Don't use this directly, use the C API above
+ *
+ */
class sp_cache
{
public:
+ ulong version;
+
sp_cache();
~sp_cache();
@@ -56,6 +81,13 @@ public:
hash_delete(&m_hashtable, (byte *)sp);
}
+ inline void
+ remove_all()
+ {
+ cleanup();
+ init();
+ }
+
private:
HASH m_hashtable;