/* *Thesesymbolsmaybeusedincompile-time#ifdeftestsfortheavailability *ofv14-and-newerlibpqfeatures.
*/ /* Features added in PostgreSQL v14: */ /* Indicates presence of PQenterPipelineMode and friends */ #define LIBPQ_HAS_PIPELINING 1 /* Indicates presence of PQsetTraceFlags; also new PQtrace output format */ #define LIBPQ_HAS_TRACE_FLAGS 1
/* Features added in PostgreSQL v15: */ /* Indicates that PQsslAttribute(NULL, "library") is useful */ #define LIBPQ_HAS_SSL_LIBRARY_DETECTION 1
/* Features added in PostgreSQL v17: */ /* Indicates presence of PGcancelConn typedef and associated routines */ #define LIBPQ_HAS_ASYNC_CANCEL 1 /* Indicates presence of PQchangePassword */ #define LIBPQ_HAS_CHANGE_PASSWORD 1 /* Indicates presence of PQsetChunkedRowsMode, PGRES_TUPLES_CHUNK */ #define LIBPQ_HAS_CHUNK_MODE 1 /* Indicates presence of PQclosePrepared, PQclosePortal, etc */ #define LIBPQ_HAS_CLOSE_PREPARED 1 /* Indicates presence of PQsendPipelineSync */ #define LIBPQ_HAS_SEND_PIPELINE_SYNC 1 /* Indicates presence of PQsocketPoll, PQgetCurrentTimeUSec */ #define LIBPQ_HAS_SOCKET_POLL 1
/* Features added in PostgreSQL v18: */ /* Indicates presence of PQfullProtocolVersion */ #define LIBPQ_HAS_FULL_PROTOCOL_VERSION 1 /* Indicates presence of the PQAUTHDATA_PROMPT_OAUTH_DEVICE authdata hook */ #define LIBPQ_HAS_PROMPT_OAUTH_DEVICE 1
typedefenum
{
CONNECTION_OK,
CONNECTION_BAD, /* Non-blocking mode only below here */
/* *Theexistenceoftheseshouldneverbereliedupon-theyshouldonly *beusedforuserfeedbackorsimilarpurposes.
*/
CONNECTION_STARTED, /* Waiting for connection to be made. */
CONNECTION_MADE, /* Connection OK; waiting to send. */
CONNECTION_AWAITING_RESPONSE, /* Waiting for a response from the
* postmaster. */
CONNECTION_AUTH_OK, /* Received authentication; waiting for
* backend startup. */
CONNECTION_SETENV, /* This state is no longer used. */
CONNECTION_SSL_STARTUP, /* Performing SSL handshake. */
CONNECTION_NEEDED, /* Internal state: connect() needed. */
CONNECTION_CHECK_WRITABLE, /* Checking if session is read-write. */
CONNECTION_CONSUME, /* Consuming any extra messages. */
CONNECTION_GSS_STARTUP, /* Negotiating GSSAPI. */
CONNECTION_CHECK_TARGET, /* Internal state: checking target server
* properties. */
CONNECTION_CHECK_STANDBY, /* Checking if server is in standby mode. */
CONNECTION_ALLOCATED, /* Waiting for connection attempt to be
* started. */
CONNECTION_AUTHENTICATING, /* Authentication is in progress with some
* external system. */
} ConnStatusType;
typedefenum
{
PGRES_POLLING_FAILED = 0,
PGRES_POLLING_READING, /* These two indicate that one may */
PGRES_POLLING_WRITING, /* use select before polling again. */
PGRES_POLLING_OK,
PGRES_POLLING_ACTIVE /* unused; keep for backwards compatibility */
} PostgresPollingStatusType;
typedefenum
{
PGRES_EMPTY_QUERY = 0, /* empty query string was executed */
PGRES_COMMAND_OK, /* a query command that doesn't return *anythingwasexecutedproperlybythe
* backend */
PGRES_TUPLES_OK, /* a query command that returns tuples was *executedproperlybythebackend,PGresult
* contains the result tuples */
PGRES_COPY_OUT, /* Copy Out data transfer in progress */
PGRES_COPY_IN, /* Copy In data transfer in progress */
PGRES_BAD_RESPONSE, /* an unexpected response was recv'd from the
* backend */
PGRES_NONFATAL_ERROR, /* notice or warning message */
PGRES_FATAL_ERROR, /* query failed */
PGRES_COPY_BOTH, /* Copy In/Out data transfer in progress */
PGRES_SINGLE_TUPLE, /* single tuple from larger resultset */
PGRES_PIPELINE_SYNC, /* pipeline synchronization point */
PGRES_PIPELINE_ABORTED, /* Command didn't run because of an abort
* earlier in a pipeline */
PGRES_TUPLES_CHUNK /* chunk of tuples from larger resultset */
} ExecStatusType;
typedefenum
{
PQTRANS_IDLE, /* connection idle */
PQTRANS_ACTIVE, /* command in progress */
PQTRANS_INTRANS, /* idle, within transaction block */
PQTRANS_INERROR, /* idle, within failed transaction */
PQTRANS_UNKNOWN /* cannot determine status */
} PGTransactionStatusType;
typedefenum
{
PQERRORS_TERSE, /* single-line error messages */
PQERRORS_DEFAULT, /* recommended style */
PQERRORS_VERBOSE, /* all the facts, ma'am */
PQERRORS_SQLSTATE /* only error severity and SQLSTATE code */
} PGVerbosity;
typedefenum
{
PQSHOW_CONTEXT_NEVER, /* never show CONTEXT field */
PQSHOW_CONTEXT_ERRORS, /* show CONTEXT for errors only (default) */
PQSHOW_CONTEXT_ALWAYS /* always show CONTEXT field */
} PGContextVisibility;
typedefenum
{
PQPING_OK, /* server is accepting connections */
PQPING_REJECT, /* server is alive but rejecting connections */
PQPING_NO_RESPONSE, /* could not establish connection */
PQPING_NO_ATTEMPT /* connection not attempted (bad params) */
} PGPing;
typedefenum
{
PQAUTHDATA_PROMPT_OAUTH_DEVICE, /* user must visit a device-authorization
* URL */
PQAUTHDATA_OAUTH_BEARER_TOKEN, /* server requests an OAuth Bearer token */
} PGauthData;
/* PGconn encapsulates a connection to the backend. *Thecontentsofthisstructarenotsupposedtobeknowntoapplications.
*/ typedefstruct pg_conn PGconn;
/* PGcancelConn encapsulates a cancel connection to the backend. *Thecontentsofthisstructarenotsupposedtobeknowntoapplications.
*/ typedefstruct pg_cancel_conn PGcancelConn;
/* PGresult encapsulates the result of a query (or more precisely, of a single *SQLcommand---aquerystringgiventoPQsendQuerycancontainmultiple *commandsandthusreturnmultiplePGresultobjects). *Thecontentsofthisstructarenotsupposedtobeknowntoapplications.
*/ typedefstruct pg_result PGresult;
/* PGcancel encapsulates the information needed to cancel a running *queryonanexistingconnection. *Thecontentsofthisstructarenotsupposedtobeknowntoapplications.
*/ typedefstruct pg_cancel PGcancel;
/* PGnotify represents the occurrence of a NOTIFY message. *Ideallythiswouldbeanopaquetypedef,butit'ssosimplethatit's *unlikelytochange. *NOTE:inPostgres6.4andlater,thebe_pidisthenotifyingbackend's, *whereasinearlierversionsitwasalwaysyourownbackend'sPID.
*/ typedefstruct pgNotify
{ char *relname; /* notification condition name */ int be_pid; /* process ID of notifying server process */ char *extra; /* notification parameter */ /* Fields below here are private to libpq; apps should not use 'em */ struct pgNotify *next; /* list link */
} PGnotify;
/* pg_usec_time_t is like time_t, but with microsecond resolution */ typedef int64_t pg_usec_time_t;
/* Function types for notice-handling callbacks */ typedefvoid (*PQnoticeReceiver) (void *arg, const PGresult *res); typedefvoid (*PQnoticeProcessor) (void *arg, constchar *message);
/* Print options for PQprint() */ typedefchar pqbool;
typedefstruct _PQprintOpt
{
pqbool header; /* print output field headings and row count */
pqbool align; /* fill align the fields */
pqbool standard; /* old brain dead format */
pqbool html3; /* output html tables */
pqbool expanded; /* expand tables */
pqbool pager; /* use pager for output if needed */ char *fieldSep; /* field separator */ char *tableOpt; /* insert to HTML <table ...> */ char *caption; /* HTML <caption> */ char **fieldName; /* null terminated array of replacement field
* names */
} PQprintOpt;
/* ---------------- *StructurefortheconninfoparameterdefinitionsreturnedbyPQconndefaults *orPQconninfoParse. * *Allfieldsexcept"val"pointatstaticstringswhichmustnotbealtered. *"val"iseitherNULLoramalloc'dcurrent-valuestring.PQconninfoFree() *willreleaseboththevalstringsandthePQconninfoOptionarrayitself. *----------------
*/ typedefstruct _PQconninfoOption
{ char *keyword; /* The keyword of the option */ char *envvar; /* Fallback environment variable name */ char *compiled; /* Fallback compiled in default value */ char *val; /* Option's current value, or NULL */ char *label; /* Label for field in connect dialog */ char *dispchar; /* Indicates how to display this field in a *connectdialog.Valuesare:""Display *enteredvalueasis"*"Passwordfield- *hidevalue"D"Debugoption-don'tshow
* by default */ int dispsize; /* Field size in characters for dialog */
} PQconninfoOption;
/* ---------------- *PQArgBlock--structureforPQfn()arguments *----------------
*/ typedefstruct
{ int len; int isint; union
{ int *ptr; /* can't use void (dec compiler barfs) */ int integer;
} u;
} PQArgBlock;
/* ---------------- *PGresAttDesc--Dataaboutasingleattribute(column)ofaqueryresult *----------------
*/ typedefstruct pgresAttDesc
{ char *name; /* column name */
Oid tableid; /* source table, if known */ int columnid; /* source column, if known */ int format; /* format code for value (text/binary) */
Oid typid; /* type id */ int typlen; /* type size */ int atttypmod; /* type-specific modifier info */
} PGresAttDesc;
/* Get the OpenSSL structure associated with a connection. Returns NULL for
* unencrypted connections or if any other TLS library is in use. */ externvoid *PQgetssl(PGconn *conn);
/* Tell libpq whether it needs to initialize OpenSSL */ externvoid PQinitSSL(int do_init);
/* More detailed way to tell libpq whether it needs to initialize OpenSSL */ externvoid PQinitOpenSSL(int do_ssl, int do_crypto);
/* Return true if GSSAPI encryption is in use */ externint PQgssEncInUse(PGconn *conn);
/* Returns GSSAPI context if GSSAPI is in use */ externvoid *PQgetgssctx(PGconn *conn);
/* Set verbosity for PQerrorMessage and PQresultErrorMessage */ extern PGVerbosity PQsetErrorVerbosity(PGconn *conn, PGVerbosity verbosity);
/* Set CONTEXT visibility for PQerrorMessage and PQresultErrorMessage */ extern PGContextVisibility PQsetErrorContextVisibility(PGconn *conn,
PGContextVisibility show_context);
/* flags controlling trace output: */ /* omit timestamps from each line */ #define PQTRACE_SUPPRESS_TIMESTAMPS (1<<0) /* redact portions of some messages, for testing frameworks */ #define PQTRACE_REGRESS_MODE (1<<1) externvoid PQsetTraceFlags(PGconn *conn, int flags);
/* === in fe-exec.c === */
/* Simple synchronous query */ extern PGresult *PQexec(PGconn *conn, constchar *query); extern PGresult *PQexecParams(PGconn *conn, constchar *command, int nParams, const Oid *paramTypes, constchar *const *paramValues, constint *paramLengths, constint *paramFormats, int resultFormat); extern PGresult *PQprepare(PGconn *conn, constchar *stmtName, constchar *query, int nParams, const Oid *paramTypes); extern PGresult *PQexecPrepared(PGconn *conn, constchar *stmtName, int nParams, constchar *const *paramValues, constint *paramLengths, constint *paramFormats, int resultFormat);
/* Interface for multiple-result or asynchronous queries */ #define PQ_QUERY_PARAM_MAX_LIMIT 65535
externint PQsendQuery(PGconn *conn, constchar *query); externint PQsendQueryParams(PGconn *conn, constchar *command, int nParams, const Oid *paramTypes, constchar *const *paramValues, constint *paramLengths, constint *paramFormats, int resultFormat); externint PQsendPrepare(PGconn *conn, constchar *stmtName, constchar *query, int nParams, const Oid *paramTypes); externint PQsendQueryPrepared(PGconn *conn, constchar *stmtName, int nParams, constchar *const *paramValues, constint *paramLengths, constint *paramFormats, int resultFormat); externint PQsetSingleRowMode(PGconn *conn); externint PQsetChunkedRowsMode(PGconn *conn, int chunkSize); extern PGresult *PQgetResult(PGconn *conn);
/* Routines for managing an asynchronous query */ externint PQisBusy(PGconn *conn); externint PQconsumeInput(PGconn *conn);
/* LISTEN/NOTIFY support */ extern PGnotify *PQnotifies(PGconn *conn);
/* Routines for copy in/out */ externint PQputCopyData(PGconn *conn, constchar *buffer, int nbytes); externint PQputCopyEnd(PGconn *conn, constchar *errormsg); externint PQgetCopyData(PGconn *conn, char **buffer, int async);
/* Deprecated routines for copy in/out */ externint PQgetline(PGconn *conn, char *buffer, int length); externint PQputline(PGconn *conn, constchar *string); externint PQgetlineAsync(PGconn *conn, char *buffer, int bufsize); externint PQputnbytes(PGconn *conn, constchar *buffer, int nbytes); externint PQendcopy(PGconn *conn);
/* Set blocking/nonblocking connection to the backend */ externint PQsetnonblocking(PGconn *conn, int arg); externint PQisnonblocking(const PGconn *conn); externint PQisthreadsafe(void); extern PGPing PQping(constchar *conninfo); extern PGPing PQpingParams(constchar *const *keywords, constchar *const *values, int expand_dbname);
/* Force the write buffer to be written (or at least try) */ externint PQflush(PGconn *conn);
/* *"Fastpath"interface---notreallyrecommendedforapplication *use
*/ extern PGresult *PQfn(PGconn *conn, int fnid, int *result_buf, int *result_len, int result_is_int, const PQArgBlock *args, int nargs);
/* Accessor functions for PGresult objects */ extern ExecStatusType PQresultStatus(const PGresult *res); externchar *PQresStatus(ExecStatusType status); externchar *PQresultErrorMessage(const PGresult *res); externchar *PQresultVerboseErrorMessage(const PGresult *res,
PGVerbosity verbosity,
PGContextVisibility show_context); externchar *PQresultErrorField(const PGresult *res, int fieldcode); externint PQntuples(const PGresult *res); externint PQnfields(const PGresult *res); externint PQbinaryTuples(const PGresult *res); externchar *PQfname(const PGresult *res, int field_num); externint PQfnumber(const PGresult *res, constchar *field_name); extern Oid PQftable(const PGresult *res, int field_num); externint PQftablecol(const PGresult *res, int field_num); externint PQfformat(const PGresult *res, int field_num); extern Oid PQftype(const PGresult *res, int field_num); externint PQfsize(const PGresult *res, int field_num); externint PQfmod(const PGresult *res, int field_num); externchar *PQcmdStatus(PGresult *res); externchar *PQoidStatus(const PGresult *res); /* old and ugly */ extern Oid PQoidValue(const PGresult *res); /* new and improved */ externchar *PQcmdTuples(PGresult *res); externchar *PQgetvalue(const PGresult *res, int tup_num, int field_num); externint PQgetlength(const PGresult *res, int tup_num, int field_num); externint PQgetisnull(const PGresult *res, int tup_num, int field_num); externint PQnparams(const PGresult *res); extern Oid PQparamtype(const PGresult *res, int param_num);
/* Error when no password was given. */ /* Note: depending on this is deprecated; use PQconnectionNeedsPassword(). */ #define PQnoPasswordSupplied "fe_sendauth: no password supplied\n"
/* Create and manipulate PGresults */ extern PGresult *PQmakeEmptyPGresult(PGconn *conn, ExecStatusType status); extern PGresult *PQcopyResult(const PGresult *src, int flags); externint PQsetResultAttrs(PGresult *res, int numAttributes, PGresAttDesc *attDescs); externvoid *PQresultAlloc(PGresult *res, size_t nBytes); extern size_t PQresultMemorySize(const PGresult *res); externint PQsetvalue(PGresult *res, int tup_num, int field_num, char *value, int len);
/* *reallyoldprintingroutines
*/ externvoid PQdisplayTuples(const PGresult *res,
FILE *fp, /* where to send the output */ int fillAlign, /* pad the fields with spaces */ constchar *fieldSep, /* field separator */ int printHeader, /* display headers? */ int quiet);
externvoid PQprintTuples(const PGresult *res,
FILE *fout, /* output stream */ int PrintAttNames, /* print attribute names */ int TerseOutput, /* delimiter bars */ int colWidth); /* width of column, if 0, use
* variable width */
/* === in fe-lobj.c === */
/* Large-object access routines */ externint lo_open(PGconn *conn, Oid lobjId, int mode); externint lo_close(PGconn *conn, int fd); externint lo_read(PGconn *conn, int fd, char *buf, size_t len); externint lo_write(PGconn *conn, int fd, constchar *buf, size_t len); externint lo_lseek(PGconn *conn, int fd, int offset, int whence); extern int64_t lo_lseek64(PGconn *conn, int fd, int64_t offset, int whence); extern Oid lo_creat(PGconn *conn, int mode); extern Oid lo_create(PGconn *conn, Oid lobjId); externint lo_tell(PGconn *conn, int fd); extern int64_t lo_tell64(PGconn *conn, int fd); externint lo_truncate(PGconn *conn, int fd, size_t len); externint lo_truncate64(PGconn *conn, int fd, int64_t len); externint lo_unlink(PGconn *conn, Oid lobjId); extern Oid lo_import(PGconn *conn, constchar *filename); extern Oid lo_import_with_oid(PGconn *conn, constchar *filename, Oid lobjId); externint lo_export(PGconn *conn, Oid lobjId, constchar *filename);
/* === in fe-misc.c === */
/* Get the version of the libpq library in use */ externint PQlibVersion(void);
/* Poll a socket for reading and/or writing with an optional timeout */ externint PQsocketPoll(int sock, int forRead, int forWrite,
pg_usec_time_t end_time);
/* Get current time in the form PQsocketPoll wants */ extern pg_usec_time_t PQgetCurrentTimeUSec(void);
/* Determine length of multibyte encoded char at *s */ externint PQmblen(constchar *s, int encoding);
/* Same, but not more than the distance to the end of string s */ externint PQmblenBounded(constchar *s, int encoding);
/* Determine display length of multibyte encoded char at *s */ externint PQdsplen(constchar *s, int encoding);
/* Get encoding id from environment variable PGCLIENTENCODING */ externint PQenv2encoding(void);
/* === in fe-auth.c === */
typedefstruct _PGpromptOAuthDevice
{ constchar *verification_uri; /* verification URI to visit */ constchar *user_code; /* user code to enter */ constchar *verification_uri_complete; /* optional combination of URI and
* code, or NULL */ int expires_in; /* seconds until user code expires */
} PGpromptOAuthDevice;
/* *ForPGoauthBearerRequest.async().Thismacrojustallowsclientstoavoid *dependingonlibpq-int.horWinsockforthe"socket"type;it'sundefined *immediatelybelow.
*/ #ifdef _WIN32 #define PQ_SOCKTYPE uintptr_t /* avoids depending on winsock2.h for SOCKET */ #else #define PQ_SOCKTYPE int #endif
typedefstruct PGoauthBearerRequest
{ /* Hook inputs (constant across all calls) */ constchar *openid_configuration; /* OIDC discovery URI */ constchar *scope; /* required scope(s), or NULL */
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.