4
* $Header: /cvsroot/pgpool/pgpool-II/pool_relcache.h,v 1.3 2010/08/19 09:25:40 t-ishii Exp $
6
* pgpool: a language independent connection pool server for PostgreSQL
7
* written by Tatsuo Ishii
9
* Copyright (c) 2003-2010 PgPool Global Development Group
11
* Permission to use, copy, modify, and distribute this software and
12
* its documentation for any purpose and without fee is hereby
13
* granted, provided that the above copyright notice appear in all
14
* copies and that both that copyright notice and this permission
15
* notice appear in supporting documentation, and that the name of the
16
* author not be used in advertising or publicity pertaining to
17
* distribution of the software without specific, written prior
18
* permission. The author makes no representations about the
19
* suitability of this software for any purpose. It is provided "as
20
* is" without express or implied warranty.
22
* pool_relcache.h.: pool_relcache.c related header file
26
#ifndef POOL_RELCACHE_H
27
#define POOL_RELCACHE_H
29
/* ------------------------
30
* Relation cache structure
31
*-------------------------
33
#define MAX_ITEM_LENGTH 1024
35
/* Relation lookup cache structure */
37
typedef void *(*func_ptr) ();
40
char dbname[MAX_ITEM_LENGTH]; /* database name */
41
char relname[MAX_ITEM_LENGTH]; /* table name */
42
void *data; /* user data */
43
int refcnt; /* reference count */
44
int session_id; /* LocalSessionId */
48
int num; /* number of cache items */
49
char sql[MAX_ITEM_LENGTH]; /* Query to relation */
51
* User defined function to be called at data register.
52
* Argument is POOL_SELECT_RESULT *.
53
* This function must return a pointer to be
54
* saved in cache->data.
56
func_ptr register_func;
58
* User defined function to be called at data unregister.
59
* Argument cache->data.
61
func_ptr unregister_func;
62
bool cache_is_session_local; /* True if cache life time is session local */
63
PoolRelCache *cache; /* cache data */
66
extern POOL_RELCACHE *pool_create_relcache(int cachesize, char *sql,
67
func_ptr register_func, func_ptr unregister_func,
69
extern void pool_discard_relcache(POOL_RELCACHE *relcache);
70
extern void *pool_search_relcache(POOL_RELCACHE *relcache, POOL_CONNECTION_POOL *backend, char *table);
71
extern void *int_register_func(POOL_SELECT_RESULT *res);
72
extern void *int_unregister_func(void *data);
73
extern void *string_register_func(POOL_SELECT_RESULT *res);
74
extern void *string_unregister_func(void *data);
76
#endif /* POOL_RELCACHE_H */