1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 #ifndef WS_PG_RESOURCE_H
30 #define WS_PG_RESOURCE_H
31
32 #include "../../public/nsapi.h"
33
34 #include <libpq-fe.h>
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39
40 typedef struct PgResourcePool {
41
42
43
44 pblock *param;
45
46
47
48
49 pool_handle_t *pool;
50
51
52
53
54 const char *name;
55
56
57
58
59 char *connection;
60
61
62 } PgResourcePool;
63
64 typedef struct PgResource {
65 PGconn *connection;
66 } PgResource;
67
68 ResourceType* pg_get_resource_type(
void);
69
70 void * pg_resourcepool_init(
pool_handle_t *pool,
const char *rpname, pblock *pb);
71 void pg_resourcepool_destroy(PgResourcePool *pg);
72 void * pg_resourcepool_createresource(PgResourcePool *pg);
73 void pg_resourcepool_freeresource(PgResourcePool *pg, PgResource *res);
74 int pg_resourcepool_prepare(PgResourcePool *pg, PgResource *res);
75 int pg_resourcepool_finish(PgResourcePool *pg, PgResource *res);
76 void * pg_resourcepool_getresourcedata(PgResource *res);
77
78
79
80
81
82
83
84 int pg_check_connection(
int loglevel,
const char *rpname, PGconn *connection);
85
86 #ifdef __cplusplus
87 }
88 #endif
89
90 #endif
91
92