2003-07-03 16:01:31 +02:00
|
|
|
/* -*- C++ -*- */
|
|
|
|
/* Copyright (C) 2002 MySQL AB
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
|
|
|
|
|
|
#ifndef _SP_CACHE_H_
|
|
|
|
#define _SP_CACHE_H_
|
|
|
|
|
2005-05-27 12:03:37 +02:00
|
|
|
#ifdef USE_PRAGMA_INTERFACE
|
2003-07-03 16:01:31 +02:00
|
|
|
#pragma interface /* gcc class implementation */
|
|
|
|
#endif
|
|
|
|
|
2005-07-30 10:19:57 +02:00
|
|
|
/*
|
|
|
|
Stored procedures/functions cache. This is used as follows:
|
|
|
|
* Each thread has its own cache.
|
2005-08-09 01:23:34 +02:00
|
|
|
* Each sp_head object is put into its thread cache before it is used, and
|
2005-08-03 12:12:31 +02:00
|
|
|
then remains in the cache until deleted.
|
2005-07-30 10:19:57 +02:00
|
|
|
*/
|
|
|
|
|
2003-07-03 16:01:31 +02:00
|
|
|
class sp_head;
|
2003-10-21 12:08:35 +02:00
|
|
|
class sp_cache;
|
|
|
|
|
2005-08-09 01:23:34 +02:00
|
|
|
/*
|
|
|
|
Cache usage scenarios:
|
|
|
|
1. Application-wide init:
|
|
|
|
sp_cache_init();
|
|
|
|
|
|
|
|
2. SP execution in thread:
|
|
|
|
2.1 While holding sp_head* pointers:
|
|
|
|
|
|
|
|
// look up a routine in the cache (no checks if it is up to date or not)
|
|
|
|
sp_cache_lookup();
|
|
|
|
|
|
|
|
sp_cache_insert();
|
|
|
|
sp_cache_invalidate();
|
|
|
|
|
2005-08-10 23:17:02 +02:00
|
|
|
2.2 When not holding any sp_head* pointers:
|
2005-08-09 01:23:34 +02:00
|
|
|
sp_cache_flush_obsolete();
|
|
|
|
|
|
|
|
3. Before thread exit:
|
|
|
|
sp_cache_clear();
|
|
|
|
*/
|
2003-10-21 12:08:35 +02:00
|
|
|
|
2005-08-09 01:23:34 +02:00
|
|
|
void sp_cache_init();
|
2003-10-21 12:08:35 +02:00
|
|
|
void sp_cache_clear(sp_cache **cp);
|
|
|
|
void sp_cache_insert(sp_cache **cp, sp_head *sp);
|
WL#1366: Use the schema (db) associated with an SP.
Phase 1: Introduced sp_name class, for qualified name support.
sql/item_func.cc:
Introduced sp_name class; moved some methods from item_func.h.
sql/item_func.h:
Introduced sp_name class; moved some methods to item_func.cc.
sql/sp.cc:
Introduced sp_name class, for qualified name support.
sql/sp.h:
Introduced sp_name class, for qualified name support.
sql/sp_cache.cc:
Introduced sp_name class, for qualified name support.
sql/sp_cache.h:
Introduced sp_name class, for qualified name support.
sql/sp_head.cc:
Introduced sp_name class, for qualified name support.
sql/sp_head.h:
Introduced sp_name class, for qualified name support.
sql/sql_lex.h:
Introduced sp_name class, for qualified name support.
sql/sql_parse.cc:
Introduced sp_name class, for qualified name support.
sql/sql_yacc.yy:
Introduced sp_name class, for qualified name support.
2004-02-17 17:36:53 +01:00
|
|
|
sp_head *sp_cache_lookup(sp_cache **cp, sp_name *name);
|
2004-03-22 14:44:41 +01:00
|
|
|
void sp_cache_invalidate();
|
2005-08-09 01:23:34 +02:00
|
|
|
void sp_cache_flush_obsolete(sp_cache **cp);
|
2003-07-03 16:01:31 +02:00
|
|
|
|
|
|
|
#endif /* _SP_CACHE_H_ */
|