pg: Statement preparing + inspection; less wonky object handling?

This commit is contained in:
Yorhel 2025-02-05 11:49:22 +01:00
parent c51b5f3598
commit 187417f160
5 changed files with 186 additions and 10 deletions

View file

@ -4,6 +4,7 @@
typedef struct PGconn PGconn;
typedef struct PGresult PGresult;
typedef unsigned int Oid;
typedef enum {
PGRES_EMPTY_QUERY = 0, PGRES_COMMAND_OK, PGRES_TUPLES_OK, PGRES_COPY_OUT, PGRES_COPY_IN,
@ -34,20 +35,31 @@ typedef enum { PQSHOW_CONTEXT_NEVER, PQSHOW_CONTEXT_ERRORS, PQSHOW_CONTEXT_ALWAY
#define PG_FUNCS \
X(PQclear, void, PGresult *) \
X(PQconnectdb, PGconn *, const char *) \
X(PQclosePrepared, PGresult *, PGconn *, const char *) \
X(PQcmdTuples, char *, PGresult *) \
X(PQconnectdb, PGconn *, const char *) \
X(PQdescribePrepared, PGresult *, PGconn *, const char *) \
X(PQerrorMessage, char *, const PGconn *) \
X(PQexec, PGresult *, PGconn *, const char *) \
X(PQfinish, void, PGconn *) \
X(PQfmod, int, const PGresult *, int) \
X(PQfname, char *, const PGresult *, int) \
X(PQfreemem, void, void *) \
X(PQftype, Oid, const PGresult *, int) \
X(PQlibVersion, int, void) \
X(PQnfields, int, const PGresult *) \
X(PQnparams, int, const PGresult *) \
X(PQparamtype, Oid, const PGresult *, int) \
X(PQprepare, PGresult *, PGconn *, const char *, const char *, int, const Oid *) \
X(PQresStatus, char *, ExecStatusType) \
X(PQresultErrorField, char *, const PGresult *, int) \
X(PQresultErrorMessage, char *, const PGresult *res) \
X(PQresultStatus, ExecStatusType, const PGresult *) \
X(PQresultVerboseErrorMessage, char *, const PGresult *, PGVerbosity, PGContextVisibility) \
X(PQserverVersion, int, const PGconn *) \
X(PQstatus, int, const PGconn *)
X(PQstatus, int, const PGconn *) \
X(PQtrace, void, PGconn *, FILE *) \
X(PQuntrace, void, PGconn *)
#define X(n, r, ...) static r (*n)(__VA_ARGS__);
PG_FUNCS