]>
Commit | Line | Data |
---|---|---|
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 | |
332870cd CP |
9 | #define QH_NULLIDENTIFIER 0 |
10 | #define QH_ALREADYFIRED 1 | |
11 | ||
12 | typedef int PQModuleIdentifier; | |
e43481af CP |
13 | typedef void (*PQQueryHandler)(PGconn *, void *); |
14 | ||
c5373bb8 | 15 | void pqloadtable(char *tablename, PQQueryHandler init, PQQueryHandler data, PQQueryHandler fini); |
67545367 | 16 | |
332870cd CP |
17 | void pqasyncqueryf(PQModuleIdentifier identifier, PQQueryHandler handler, void *tag, int flags, char *format, ...); |
18 | #define pqasyncqueryi(identifier, handler, tag, format, ...) pqasyncqueryf(identifier, handler, tag, 0, format , ##__VA_ARGS__) | |
19 | #define pqasyncquery(handler, tag, format, ...) pqasyncqueryf(QH_NULLIDENTIFIER, handler, tag, 0, format , ##__VA_ARGS__) | |
20 | #define pqcreatequery(format, ...) pqasyncqueryf(QH_NULLIDENTIFIER, NULL, NULL, QH_CREATE, format , ##__VA_ARGS__) | |
21 | #define pqquery(format, ...) pqasyncqueryf(QH_NULLIDENTIFIER, NULL, NULL, 0, format , ##__VA_ARGS__) | |
67545367 | 22 | |
e43481af | 23 | int pqconnected(void); |
332870cd CP |
24 | char* pqlasterror(PGconn *pgconn); |
25 | ||
26 | PQModuleIdentifier pqgetid(void); | |
27 | void pqfreeid(PQModuleIdentifier identifier); | |
e43481af CP |
28 | |
29 | #endif |