Data Structures | |
struct | rxv_spin_conn |
Connection structure. More... | |
struct | rxv_spin_cpool |
Connection pool structure. More... | |
Defines | |
#define | RXV_SPIN_CONN_PGSQL 0x01 |
#define | RXV_SPIN_CONN_MYSQL 0x02 |
#define | RXV_SPIN_CONN_MINID 0x01 |
#define | RXV_SPIN_CONN_MAXID 0x3F |
#define | RXV_SPIN_CONN_FOREIGN 0x40 |
#define | RXV_SPIN_CONN_POOLED 0x80 |
#define | RXV_SPIN_CONN_IS_PGSQL(c) ((((c)->type)&RXV_SPIN_CONN_MAXID)==RXV_SPIN_CONN_PGSQL) |
#define | RXV_SPIN_CONN_IS_MYSQL(c) ((((c)->type)&RXV_SPIN_CONN_MAXID)==RXV_SPIN_CONN_MYSQL) |
#define | RXV_SPIN_CONN_IS_FOREIGN(c) (((c)->type)&RXV_SPIN_CONN_FOREIGN) |
#define | RXV_SPIN_CONN_IS_POOLED(c) (((c)->type)&RXV_SPIN_CONN_POOLED) |
Typedefs | |
typedef struct rxv_spin_conn | rxv_spin_conn_t |
typedef struct rxv_spin_cpool | rxv_spin_cpool_t |
Functions | |
rxv_spin_cpool_t * | rxv_spin_cpool_create (apr_pool_t *pool) |
rxv_spin_conn_t * | rxv_spin_cpool_get (apr_pool_t *pool, rxv_spin_cpool_t *cpool, const char *conninfo) |
rxv_spin_conn_t * | rxv_spin_cpool_set (rxv_spin_cpool_t *cpool, const char *conninfo, void *conn, apr_status_t(*cleanup)(void *data)) |
apr_status_t | rxv_spin_conn_close (rxv_spin_conn_t *conn) |
#define RXV_SPIN_CONN_PGSQL 0x01 |
PostgreSQL connection type
#define RXV_SPIN_CONN_MYSQL 0x02 |
MySQL connection type
#define RXV_SPIN_CONN_MINID 0x01 |
lowest known connection type
#define RXV_SPIN_CONN_MAXID 0x3F |
highest known connection type
#define RXV_SPIN_CONN_FOREIGN 0x40 |
foreign connection type
#define RXV_SPIN_CONN_POOLED 0x80 |
connection pooled flag
#define RXV_SPIN_CONN_IS_PGSQL | ( | c | ) | ((((c)->type)&RXV_SPIN_CONN_MAXID)==RXV_SPIN_CONN_PGSQL) |
check if this connection is of PostgreSQL type
#define RXV_SPIN_CONN_IS_MYSQL | ( | c | ) | ((((c)->type)&RXV_SPIN_CONN_MAXID)==RXV_SPIN_CONN_MYSQL) |
check if this connection is of MySQL type
#define RXV_SPIN_CONN_IS_FOREIGN | ( | c | ) | (((c)->type)&RXV_SPIN_CONN_FOREIGN) |
check if this connection is of MySQL type
#define RXV_SPIN_CONN_IS_POOLED | ( | c | ) | (((c)->type)&RXV_SPIN_CONN_POOLED) |
check if this connection is pooled
typedef struct rxv_spin_conn rxv_spin_conn_t |
connection type
typedef struct rxv_spin_cpool rxv_spin_cpool_t |
connection pool type
rxv_spin_cpool_t* rxv_spin_cpool_create | ( | apr_pool_t * | pool | ) |
Create a connection pool. Connection strings used to search for open connections within the pool are treated as case sensitive and they consist of the actual connection string preceded by the type (a single character).
pool | Memory pool used for allocation |
cpool=rxv_spin_cpool_create(p);
rxv_spin_conn_t* rxv_spin_cpool_get | ( | apr_pool_t * | pool, | |
rxv_spin_cpool_t * | cpool, | |||
const char * | conninfo | |||
) |
Get a registered connection of foreign type from the connection pool.
pool | Memory pool for temporary allocations | |
cpool | Connection pool | |
conninfo | Connection string for this connection |
rxv_spin_cpool_get(ctx->pool,ctx->cpool, "ldap://ldap.example.com/dc=example,dc=com");
rxv_spin_conn_t* rxv_spin_cpool_set | ( | rxv_spin_cpool_t * | cpool, | |
const char * | conninfo, | |||
void * | conn, | |||
apr_status_t(*)(void *data) | cleanup | |||
) |
Register a connection of foreign type with the connection pool.
cpool | Connection pool | |
conninfo | Connection string for this connection | |
conn | Connection pointer | |
cleanup | Cleanup function to call on pool destruction |
rxv_spin_cpool_set(ctx->cpool,"ldap://ldap.example.com/dc=example,dc=com", ldapconn,ldap_cleanup);
apr_status_t rxv_spin_conn_close | ( | rxv_spin_conn_t * | conn | ) |
Close a connection and remove it from the pool.
conn | Connection |
rxv_spin_conn_close(conn);