]> jfr.im git - irc/quakenet/newserv.git/blob - pqsql/pqsql.h
*sigh*
[irc/quakenet/newserv.git] / pqsql / pqsql.h
1 #ifndef __PQSQL_DB_H
2 #define __PQSQL_DB_H
3
4 #include <libpq-fe.h>
5
6 #define QH_CREATE 0x01
7
8 typedef void (*PQQueryHandler)(PGconn *, void *);
9
10 void pqasyncqueryf(PQQueryHandler handler, void *tag, int flags, char *format, ...);
11 void pqloadtable(char *tablename, PQQueryHandler init, PQQueryHandler data, PQQueryHandler fini);
12
13 #define pqasyncquery(handler, tag, format, ...) pqasyncqueryf(handler, tag, 0, format , ##__VA_ARGS__)
14 #define pqcreatequery(format, ...) pqasyncqueryf(NULL, NULL, QH_CREATE, format , ##__VA_ARGS__)
15 #define pqquery(format, ...) pqasyncqueryf(NULL, NULL, 0, format , ##__VA_ARGS__)
16
17 int pqconnected(void);
18
19 #endif