87 static void dbpool_conn_destroy(
DBPoolConn *conn)
91 if (conn->
conn != NULL)
109 p = gw_malloc(
sizeof(
DBPool));
165 panic(0,
"Unknown dbpool type defined.");
196 unsigned int i, opened = 0;
239 for (i = 0; i < c; i++) {
250 dbpool_conn_destroy(pc);
281 debug(
"dbpool", 0,
"DBPool has no connections, reconnecting up to maximum...");
299 dbpool_conn_destroy(pc);
309 debug(
"dbpool", 0,
"DBPool has too few connections, reconnecting up to maximum...");
321 return (pc->
conn != NULL ? pc : NULL);
335 long i, len, n = 0, reinit = 0;
349 for (i = 0; i < len; i++) {
356 dbpool_conn_destroy(pconn);
378 if (sql == NULL || conn == NULL)
390 if (sql == NULL || conn == NULL)
unsigned int dbpool_check(DBPool *p)
long dbpool_conn_count(DBPool *p)
DBPool * dbpool_create(enum db_type db_type, DBConf *conf, unsigned int connections)
gw_assert(wtls_machine->packet_to_send !=NULL)
void gwlist_produce(List *list, void *item)
long gwlist_len(List *list)
void * gwlist_get(List *list, long pos)
int(* update)(void *conn, const Octstr *sql, List *binds)
unsigned int dbpool_decrease(DBPool *p, unsigned int conn)
unsigned int dbpool_increase(DBPool *p, unsigned int conn)
void(* close)(void *conn)
void dbpool_conn_produce(DBPoolConn *conn)
void gwlist_unlock(List *list)
void * gwlist_extract_first(List *list)
void gwlist_delete(List *list, long pos, long count)
void(* conf_destroy)(DBConf *conf)
void gwlist_remove_producer(List *list)
void gwthread_sleep(double seconds)
void gwlist_lock(List *list)
void dbpool_destroy(DBPool *p)
int dbpool_conn_update(DBPoolConn *conn, const Octstr *sql, List *binds)
void * gwlist_consume(List *list)
void debug(const char *place, int err, const char *fmt,...)
int dbpool_conn_select(DBPoolConn *conn, const Octstr *sql, List *binds, List **result)
int(* select)(void *conn, const Octstr *sql, List *binds, List **result)
DBPoolConn * dbpool_conn_consume(DBPool *p)
void gwlist_add_producer(List *list)
void *(* open)(const DBConf *conf)
void gwlist_destroy(List *list, gwlist_item_destructor_t *destructor)