]> jfr.im git - irc/quakenet/newserv.git/blame - pqsql/pqsql.h
Added capability to pqsql module to use default unix socket.
[irc/quakenet/newserv.git] / pqsql / pqsql.h
CommitLineData
e43481af
CP
1#ifndef __PQSQL_DB_H
2#define __PQSQL_DB_H
3
4#include <libpq-fe.h>
5
67545367 6#define QH_CREATE 0x01
47d8702b 7#define PQ_ERRORMSG_LENGTH 1024
67545367 8
e43481af
CP
9typedef void (*PQQueryHandler)(PGconn *, void *);
10
67545367 11void pqasyncqueryf(PQQueryHandler handler, void *tag, int flags, char *format, ...);
c5373bb8 12void pqloadtable(char *tablename, PQQueryHandler init, PQQueryHandler data, PQQueryHandler fini);
67545367 13
87aeb91e
CP
14#define pqasyncquery(handler, tag, format, ...) pqasyncqueryf(handler, tag, 0, format , ##__VA_ARGS__)
15#define pqcreatequery(format, ...) pqasyncqueryf(NULL, NULL, QH_CREATE, format , ##__VA_ARGS__)
f3a0d096 16#define pqquery(format, ...) pqasyncqueryf(NULL, NULL, 0, format , ##__VA_ARGS__)
67545367 17
e43481af 18int pqconnected(void);
47d8702b 19char* pqlasterror(PGconn * pgconn);
e43481af
CP
20
21#endif