6 #define PQ_ERRORMSG_LENGTH 1024
8 #define QH_ALREADYFIRED 1
10 typedef struct PQResult
{
16 typedef int PQModuleIdentifier
;
17 typedef void (*PQQueryHandler
)(PGconn
*, void *);
19 void pqloadtable(char *tablename
, PQQueryHandler init
, PQQueryHandler data
, PQQueryHandler fini
, void *tag
);
21 void pqasyncqueryf(PQModuleIdentifier identifier
, PQQueryHandler handler
, void *tag
, int flags
, char *format
, ...) __attribute__ ((format (printf
, 5, 6)));
22 #define pqasyncqueryi(identifier, handler, tag, format, ...) pqasyncqueryf(identifier, handler, tag, 0, format , ##__VA_ARGS__)
23 #define pqasyncquery(handler, tag, format, ...) pqasyncqueryf(DB_NULLIDENTIFIER, handler, tag, 0, format , ##__VA_ARGS__)
24 #define pqcreatequery(format, ...) pqasyncqueryf(DB_NULLIDENTIFIER, NULL, NULL, DB_CREATE, format , ##__VA_ARGS__)
25 #define pqquery(format, ...) pqasyncqueryf(DB_NULLIDENTIFIER, NULL, NULL, 0, format , ##__VA_ARGS__)
27 int pqconnected(void);
29 PQModuleIdentifier
pqgetid(void);
30 void pqfreeid(PQModuleIdentifier identifier
);
32 #define pqquerysuccessful(x) (x && (PQresultStatus(x->result) == PGRES_TUPLES_OK))
34 PQResult
*pqgetresult(PGconn
*c
);
35 int pqfetchrow(PQResult
*res
);
36 char *pqgetvalue(PQResult
*res
, int column
);
37 void pqclear(PQResult
*res
);
39 #define pqcreateschema(schema) pqcreatequery("CREATE SCHEMA %s;", schema)