|
libusual
0.1
|
Async Postgres connection framework. More...
Enumerations | |
| enum | PgEvent { PGS_CONNECT_OK, PGS_CONNECT_FAILED, PGS_RESULT_OK, PGS_RESULT_BAD, PGS_TIMEOUT } |
| Event types reported to user handler function. More... | |
Functions | |
| struct PgSocket * | pgs_create (const char *connstr, pgs_handler_f fn, void *arg) |
| Create PgSocket. | |
| void | pgs_free (struct PgSocket *db) |
| Release PgSocket. | |
| void | pgs_set_event_base (struct PgSocket *pgs, struct event_base *base) |
| Change the event base for PgSocket. | |
| void | pgs_set_lifetime (struct PgSocket *pgs, double lifetime) |
| Set connection lifetime (in seconds) | |
| void | pgs_connect (struct PgSocket *db) |
| Launch connection. | |
| void | pgs_disconnect (struct PgSocket *db) |
| Drop connection. | |
| void | pgs_send_query_simple (struct PgSocket *db, const char *query) |
| Send simple query. | |
| void | pgs_send_query_params (struct PgSocket *db, const char *query, int nargs,...) |
| Send extended query, args from varargs. | |
| void | pgs_send_query_params_list (struct PgSocket *db, const char *query, int nargs, const char *argv[]) |
| Send extended query, args from list. | |
| void | pgs_sleep (struct PgSocket *db, double timeout) |
| Ignore the connection for specified time. | |
| void | pgs_reconnect (struct PgSocket *db, double timeout) |
| Disconnect, sleep, reconnect. | |
| int | pgs_connection_valid (struct PgSocket *db) |
| Does PgSocket have established connection. | |
| PGconn * | pgs_get_connection (struct PgSocket *db) |
| Return underlying Postgres connection. | |
Async Postgres connection framework.
| enum PgEvent |
Event types reported to user handler function.
| struct PgSocket* pgs_create | ( | const char * | connstr, |
| pgs_handler_f | fn, | ||
| void * | arg | ||
| ) | [read] |
Create PgSocket.
It does not launch connection yet, use pgs_connect() for that.
| connstr | libpq connect string |
| fn | callback function for event handling |
| arg | extra context for callback |
| void pgs_free | ( | struct PgSocket * | db | ) |
Release PgSocket.
| void pgs_set_event_base | ( | struct PgSocket * | pgs, |
| struct event_base * | base | ||
| ) |
Change the event base for PgSocket.
| void pgs_set_lifetime | ( | struct PgSocket * | pgs, |
| double | lifetime | ||
| ) |
Set connection lifetime (in seconds)
| void pgs_connect | ( | struct PgSocket * | db | ) |
Launch connection.
| void pgs_disconnect | ( | struct PgSocket * | db | ) |
Drop connection.
| void pgs_send_query_simple | ( | struct PgSocket * | db, |
| const char * | query | ||
| ) |
Send simple query.
| void pgs_send_query_params | ( | struct PgSocket * | db, |
| const char * | query, | ||
| int | nargs, | ||
| ... | |||
| ) |
Send extended query, args from varargs.
| void pgs_send_query_params_list | ( | struct PgSocket * | db, |
| const char * | query, | ||
| int | nargs, | ||
| const char * | argv[] | ||
| ) |
Send extended query, args from list.
| void pgs_sleep | ( | struct PgSocket * | db, |
| double | timeout | ||
| ) |
Ignore the connection for specified time.
| void pgs_reconnect | ( | struct PgSocket * | db, |
| double | timeout | ||
| ) |
Disconnect, sleep, reconnect.
| int pgs_connection_valid | ( | struct PgSocket * | db | ) |
Does PgSocket have established connection.
| PGconn* pgs_get_connection | ( | struct PgSocket * | db | ) |
Return underlying Postgres connection.
1.7.6.1