Thanks to visit codestin.com
Credit goes to doxygen.postgresql.org

PostgreSQL Source Code git master
libpq-fe.h
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 *
3 * libpq-fe.h
4 * This file contains definitions for structures and
5 * externs for functions used by frontend postgres applications.
6 *
7 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
9 *
10 * src/interfaces/libpq/libpq-fe.h
11 *
12 *-------------------------------------------------------------------------
13 */
14
15#ifndef LIBPQ_FE_H
16#define LIBPQ_FE_H
17
18#ifdef __cplusplus
19extern "C"
20{
21#endif
22
23#include <stdint.h>
24#include <stdio.h>
25
26/*
27 * postgres_ext.h defines the backend's externally visible types,
28 * such as Oid.
29 */
30#include "postgres_ext.h"
31
32/*
33 * These symbols may be used in compile-time #ifdef tests for the availability
34 * of v14-and-newer libpq features.
35 */
36/* Features added in PostgreSQL v14: */
37/* Indicates presence of PQenterPipelineMode and friends */
38#define LIBPQ_HAS_PIPELINING 1
39/* Indicates presence of PQsetTraceFlags; also new PQtrace output format */
40#define LIBPQ_HAS_TRACE_FLAGS 1
41
42/* Features added in PostgreSQL v15: */
43/* Indicates that PQsslAttribute(NULL, "library") is useful */
44#define LIBPQ_HAS_SSL_LIBRARY_DETECTION 1
45
46/* Features added in PostgreSQL v17: */
47/* Indicates presence of PGcancelConn typedef and associated routines */
48#define LIBPQ_HAS_ASYNC_CANCEL 1
49/* Indicates presence of PQchangePassword */
50#define LIBPQ_HAS_CHANGE_PASSWORD 1
51/* Indicates presence of PQsetChunkedRowsMode, PGRES_TUPLES_CHUNK */
52#define LIBPQ_HAS_CHUNK_MODE 1
53/* Indicates presence of PQclosePrepared, PQclosePortal, etc */
54#define LIBPQ_HAS_CLOSE_PREPARED 1
55/* Indicates presence of PQsendPipelineSync */
56#define LIBPQ_HAS_SEND_PIPELINE_SYNC 1
57/* Indicates presence of PQsocketPoll, PQgetCurrentTimeUSec */
58#define LIBPQ_HAS_SOCKET_POLL 1
59
60/* Features added in PostgreSQL v18: */
61/* Indicates presence of PQfullProtocolVersion */
62#define LIBPQ_HAS_FULL_PROTOCOL_VERSION 1
63/* Indicates presence of the PQAUTHDATA_PROMPT_OAUTH_DEVICE authdata hook */
64#define LIBPQ_HAS_PROMPT_OAUTH_DEVICE 1
65
66/*
67 * Option flags for PQcopyResult
68 */
69#define PG_COPYRES_ATTRS 0x01
70#define PG_COPYRES_TUPLES 0x02 /* Implies PG_COPYRES_ATTRS */
71#define PG_COPYRES_EVENTS 0x04
72#define PG_COPYRES_NOTICEHOOKS 0x08
73
74/* Application-visible enum types */
75
76/*
77 * Although it is okay to add to these lists, values which become unused
78 * should never be removed, nor should constants be redefined - that would
79 * break compatibility with existing code.
80 */
81
82typedef enum
83{
86 /* Non-blocking mode only below here */
87
88 /*
89 * The existence of these should never be relied upon - they should only
90 * be used for user feedback or similar purposes.
91 */
92 CONNECTION_STARTED, /* Waiting for connection to be made. */
93 CONNECTION_MADE, /* Connection OK; waiting to send. */
94 CONNECTION_AWAITING_RESPONSE, /* Waiting for a response from the
95 * postmaster. */
96 CONNECTION_AUTH_OK, /* Received authentication; waiting for
97 * backend startup. */
98 CONNECTION_SETENV, /* This state is no longer used. */
99 CONNECTION_SSL_STARTUP, /* Performing SSL handshake. */
100 CONNECTION_NEEDED, /* Internal state: connect() needed. */
101 CONNECTION_CHECK_WRITABLE, /* Checking if session is read-write. */
102 CONNECTION_CONSUME, /* Consuming any extra messages. */
103 CONNECTION_GSS_STARTUP, /* Negotiating GSSAPI. */
104 CONNECTION_CHECK_TARGET, /* Internal state: checking target server
105 * properties. */
106 CONNECTION_CHECK_STANDBY, /* Checking if server is in standby mode. */
107 CONNECTION_ALLOCATED, /* Waiting for connection attempt to be
108 * started. */
109 CONNECTION_AUTHENTICATING, /* Authentication is in progress with some
110 * external system. */
112
113typedef enum
114{
116 PGRES_POLLING_READING, /* These two indicate that one may */
117 PGRES_POLLING_WRITING, /* use select before polling again. */
119 PGRES_POLLING_ACTIVE /* unused; keep for backwards compatibility */
121
122typedef enum
123{
124 PGRES_EMPTY_QUERY = 0, /* empty query string was executed */
125 PGRES_COMMAND_OK, /* a query command that doesn't return
126 * anything was executed properly by the
127 * backend */
128 PGRES_TUPLES_OK, /* a query command that returns tuples was
129 * executed properly by the backend, PGresult
130 * contains the result tuples */
131 PGRES_COPY_OUT, /* Copy Out data transfer in progress */
132 PGRES_COPY_IN, /* Copy In data transfer in progress */
133 PGRES_BAD_RESPONSE, /* an unexpected response was recv'd from the
134 * backend */
135 PGRES_NONFATAL_ERROR, /* notice or warning message */
136 PGRES_FATAL_ERROR, /* query failed */
137 PGRES_COPY_BOTH, /* Copy In/Out data transfer in progress */
138 PGRES_SINGLE_TUPLE, /* single tuple from larger resultset */
139 PGRES_PIPELINE_SYNC, /* pipeline synchronization point */
140 PGRES_PIPELINE_ABORTED, /* Command didn't run because of an abort
141 * earlier in a pipeline */
142 PGRES_TUPLES_CHUNK /* chunk of tuples from larger resultset */
144
145typedef enum
146{
147 PQTRANS_IDLE, /* connection idle */
148 PQTRANS_ACTIVE, /* command in progress */
149 PQTRANS_INTRANS, /* idle, within transaction block */
150 PQTRANS_INERROR, /* idle, within failed transaction */
151 PQTRANS_UNKNOWN /* cannot determine status */
153
154typedef enum
155{
156 PQERRORS_TERSE, /* single-line error messages */
157 PQERRORS_DEFAULT, /* recommended style */
158 PQERRORS_VERBOSE, /* all the facts, ma'am */
159 PQERRORS_SQLSTATE /* only error severity and SQLSTATE code */
161
162typedef enum
163{
164 PQSHOW_CONTEXT_NEVER, /* never show CONTEXT field */
165 PQSHOW_CONTEXT_ERRORS, /* show CONTEXT for errors only (default) */
166 PQSHOW_CONTEXT_ALWAYS /* always show CONTEXT field */
168
169/*
170 * PGPing - The ordering of this enum should not be altered because the
171 * values are exposed externally via pg_isready.
172 */
173
174typedef enum
175{
176 PQPING_OK, /* server is accepting connections */
177 PQPING_REJECT, /* server is alive but rejecting connections */
178 PQPING_NO_RESPONSE, /* could not establish connection */
179 PQPING_NO_ATTEMPT /* connection not attempted (bad params) */
181
182/*
183 * PGpipelineStatus - Current status of pipeline mode
184 */
185typedef enum
186{
191
192typedef enum
193{
194 PQAUTHDATA_PROMPT_OAUTH_DEVICE, /* user must visit a device-authorization
195 * URL */
196 PQAUTHDATA_OAUTH_BEARER_TOKEN, /* server requests an OAuth Bearer token */
197} PGauthData;
198
199/* PGconn encapsulates a connection to the backend.
200 * The contents of this struct are not supposed to be known to applications.
201 */
202typedef struct pg_conn PGconn;
203
204/* PGcancelConn encapsulates a cancel connection to the backend.
205 * The contents of this struct are not supposed to be known to applications.
206 */
208
209/* PGresult encapsulates the result of a query (or more precisely, of a single
210 * SQL command --- a query string given to PQsendQuery can contain multiple
211 * commands and thus return multiple PGresult objects).
212 * The contents of this struct are not supposed to be known to applications.
213 */
214typedef struct pg_result PGresult;
215
216/* PGcancel encapsulates the information needed to cancel a running
217 * query on an existing connection.
218 * The contents of this struct are not supposed to be known to applications.
219 */
220typedef struct pg_cancel PGcancel;
221
222/* PGnotify represents the occurrence of a NOTIFY message.
223 * Ideally this would be an opaque typedef, but it's so simple that it's
224 * unlikely to change.
225 * NOTE: in Postgres 6.4 and later, the be_pid is the notifying backend's,
226 * whereas in earlier versions it was always your own backend's PID.
227 */
228typedef struct pgNotify
229{
230 char *relname; /* notification condition name */
231 int be_pid; /* process ID of notifying server process */
232 char *extra; /* notification parameter */
233 /* Fields below here are private to libpq; apps should not use 'em */
234 struct pgNotify *next; /* list link */
236
237/* pg_usec_time_t is like time_t, but with microsecond resolution */
238typedef int64_t pg_usec_time_t;
239
240/* Function types for notice-handling callbacks */
241typedef void (*PQnoticeReceiver) (void *arg, const PGresult *res);
242typedef void (*PQnoticeProcessor) (void *arg, const char *message);
243
244/* Print options for PQprint() */
245typedef char pqbool;
246
247typedef struct _PQprintOpt
248{
249 pqbool header; /* print output field headings and row count */
250 pqbool align; /* fill align the fields */
251 pqbool standard; /* old brain dead format */
252 pqbool html3; /* output html tables */
253 pqbool expanded; /* expand tables */
254 pqbool pager; /* use pager for output if needed */
255 char *fieldSep; /* field separator */
256 char *tableOpt; /* insert to HTML <table ...> */
257 char *caption; /* HTML <caption> */
258 char **fieldName; /* null terminated array of replacement field
259 * names */
261
262/* ----------------
263 * Structure for the conninfo parameter definitions returned by PQconndefaults
264 * or PQconninfoParse.
265 *
266 * All fields except "val" point at static strings which must not be altered.
267 * "val" is either NULL or a malloc'd current-value string. PQconninfoFree()
268 * will release both the val strings and the PQconninfoOption array itself.
269 * ----------------
270 */
271typedef struct _PQconninfoOption
272{
273 char *keyword; /* The keyword of the option */
274 char *envvar; /* Fallback environment variable name */
275 char *compiled; /* Fallback compiled in default value */
276 char *val; /* Option's current value, or NULL */
277 char *label; /* Label for field in connect dialog */
278 char *dispchar; /* Indicates how to display this field in a
279 * connect dialog. Values are: "" Display
280 * entered value as is "*" Password field -
281 * hide value "D" Debug option - don't show
282 * by default */
283 int dispsize; /* Field size in characters for dialog */
285
286/* ----------------
287 * PQArgBlock -- structure for PQfn() arguments
288 * ----------------
289 */
290typedef struct
291{
292 int len;
293 int isint;
294 union
295 {
296 int *ptr; /* can't use void (dec compiler barfs) */
298 } u;
299} PQArgBlock;
300
301/* ----------------
302 * PGresAttDesc -- Data about a single attribute (column) of a query result
303 * ----------------
304 */
305typedef struct pgresAttDesc
306{
307 char *name; /* column name */
308 Oid tableid; /* source table, if known */
309 int columnid; /* source column, if known */
310 int format; /* format code for value (text/binary) */
311 Oid typid; /* type id */
312 int typlen; /* type size */
313 int atttypmod; /* type-specific modifier info */
315
316/* ----------------
317 * Exported functions of libpq
318 * ----------------
319 */
320
321/* === in fe-connect.c === */
322
323/* make a new client connection to the backend */
324/* Asynchronous (non-blocking) */
325extern PGconn *PQconnectStart(const char *conninfo);
326extern PGconn *PQconnectStartParams(const char *const *keywords,
327 const char *const *values, int expand_dbname);
329
330/* Synchronous (blocking) */
331extern PGconn *PQconnectdb(const char *conninfo);
332extern PGconn *PQconnectdbParams(const char *const *keywords,
333 const char *const *values, int expand_dbname);
334extern PGconn *PQsetdbLogin(const char *pghost, const char *pgport,
335 const char *pgoptions, const char *pgtty,
336 const char *dbName,
337 const char *login, const char *pwd);
338
339#define PQsetdb(M_PGHOST,M_PGPORT,M_PGOPT,M_PGTTY,M_DBNAME) \
340 PQsetdbLogin(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME, NULL, NULL)
341
342/* close the current connection and free the PGconn data structure */
343extern void PQfinish(PGconn *conn);
344
345/* get info about connection options known to PQconnectdb */
346extern PQconninfoOption *PQconndefaults(void);
347
348/* parse connection options in same way as PQconnectdb */
349extern PQconninfoOption *PQconninfoParse(const char *conninfo, char **errmsg);
350
351/* return the connection options used by a live connection */
353
354/* free the data structure returned by PQconndefaults() or PQconninfoParse() */
355extern void PQconninfoFree(PQconninfoOption *connOptions);
356
357/*
358 * close the current connection and reestablish a new one with the same
359 * parameters
360 */
361/* Asynchronous (non-blocking) */
362extern int PQresetStart(PGconn *conn);
364
365/* Synchronous (blocking) */
366extern void PQreset(PGconn *conn);
367
368/* Create a PGcancelConn that's used to cancel a query on the given PGconn */
370
371/* issue a cancel request in a non-blocking manner */
373
374/* issue a blocking cancel request */
376
377/* poll a non-blocking cancel request */
380extern int PQcancelSocket(const PGcancelConn *cancelConn);
381extern char *PQcancelErrorMessage(const PGcancelConn *cancelConn);
384
385
386/* request a cancel structure */
388
389/* free a cancel structure */
390extern void PQfreeCancel(PGcancel *cancel);
391
392/* deprecated version of PQcancelBlocking, but one which is signal-safe */
393extern int PQcancel(PGcancel *cancel, char *errbuf, int errbufsize);
394
395/* deprecated version of PQcancel; not thread-safe */
396extern int PQrequestCancel(PGconn *conn);
397
398/* Accessor functions for PGconn objects */
399extern char *PQdb(const PGconn *conn);
400extern char *PQuser(const PGconn *conn);
401extern char *PQpass(const PGconn *conn);
402extern char *PQhost(const PGconn *conn);
403extern char *PQhostaddr(const PGconn *conn);
404extern char *PQport(const PGconn *conn);
405extern char *PQtty(const PGconn *conn);
406extern char *PQoptions(const PGconn *conn);
407extern ConnStatusType PQstatus(const PGconn *conn);
409extern const char *PQparameterStatus(const PGconn *conn,
410 const char *paramName);
411extern int PQprotocolVersion(const PGconn *conn);
412extern int PQfullProtocolVersion(const PGconn *conn);
413extern int PQserverVersion(const PGconn *conn);
414extern char *PQerrorMessage(const PGconn *conn);
415extern int PQsocket(const PGconn *conn);
416extern int PQbackendPID(const PGconn *conn);
418extern int PQconnectionNeedsPassword(const PGconn *conn);
419extern int PQconnectionUsedPassword(const PGconn *conn);
420extern int PQconnectionUsedGSSAPI(const PGconn *conn);
421extern int PQclientEncoding(const PGconn *conn);
422extern int PQsetClientEncoding(PGconn *conn, const char *encoding);
423
424/* SSL information functions */
425extern int PQsslInUse(PGconn *conn);
426extern void *PQsslStruct(PGconn *conn, const char *struct_name);
427extern const char *PQsslAttribute(PGconn *conn, const char *attribute_name);
428extern const char *const *PQsslAttributeNames(PGconn *conn);
429
430/* Get the OpenSSL structure associated with a connection. Returns NULL for
431 * unencrypted connections or if any other TLS library is in use. */
432extern void *PQgetssl(PGconn *conn);
433
434/* Tell libpq whether it needs to initialize OpenSSL */
435extern void PQinitSSL(int do_init);
436
437/* More detailed way to tell libpq whether it needs to initialize OpenSSL */
438extern void PQinitOpenSSL(int do_ssl, int do_crypto);
439
440/* Return true if GSSAPI encryption is in use */
441extern int PQgssEncInUse(PGconn *conn);
442
443/* Returns GSSAPI context if GSSAPI is in use */
444extern void *PQgetgssctx(PGconn *conn);
445
446/* Set verbosity for PQerrorMessage and PQresultErrorMessage */
448
449/* Set CONTEXT visibility for PQerrorMessage and PQresultErrorMessage */
451 PGContextVisibility show_context);
452
453/* Override default notice handling routines */
455 PQnoticeReceiver proc,
456 void *arg);
459 void *arg);
460
461/*
462 * Used to set callback that prevents concurrent access to
463 * non-thread safe functions that libpq needs.
464 * The default implementation uses a libpq internal mutex.
465 * Only required for multithreaded apps that use kerberos
466 * both within their app and for postgresql connections.
467 */
468typedef void (*pgthreadlock_t) (int acquire);
469
471
472/* === in fe-trace.c === */
473extern void PQtrace(PGconn *conn, FILE *debug_port);
474extern void PQuntrace(PGconn *conn);
475
476/* flags controlling trace output: */
477/* omit timestamps from each line */
478#define PQTRACE_SUPPRESS_TIMESTAMPS (1<<0)
479/* redact portions of some messages, for testing frameworks */
480#define PQTRACE_REGRESS_MODE (1<<1)
481extern void PQsetTraceFlags(PGconn *conn, int flags);
482
483/* === in fe-exec.c === */
484
485/* Simple synchronous query */
486extern PGresult *PQexec(PGconn *conn, const char *query);
488 const char *command,
489 int nParams,
490 const Oid *paramTypes,
491 const char *const *paramValues,
492 const int *paramLengths,
493 const int *paramFormats,
494 int resultFormat);
495extern PGresult *PQprepare(PGconn *conn, const char *stmtName,
496 const char *query, int nParams,
497 const Oid *paramTypes);
499 const char *stmtName,
500 int nParams,
501 const char *const *paramValues,
502 const int *paramLengths,
503 const int *paramFormats,
504 int resultFormat);
505
506/* Interface for multiple-result or asynchronous queries */
507#define PQ_QUERY_PARAM_MAX_LIMIT 65535
508
509extern int PQsendQuery(PGconn *conn, const char *query);
510extern int PQsendQueryParams(PGconn *conn,
511 const char *command,
512 int nParams,
513 const Oid *paramTypes,
514 const char *const *paramValues,
515 const int *paramLengths,
516 const int *paramFormats,
517 int resultFormat);
518extern int PQsendPrepare(PGconn *conn, const char *stmtName,
519 const char *query, int nParams,
520 const Oid *paramTypes);
522 const char *stmtName,
523 int nParams,
524 const char *const *paramValues,
525 const int *paramLengths,
526 const int *paramFormats,
527 int resultFormat);
528extern int PQsetSingleRowMode(PGconn *conn);
529extern int PQsetChunkedRowsMode(PGconn *conn, int chunkSize);
531
532/* Routines for managing an asynchronous query */
533extern int PQisBusy(PGconn *conn);
534extern int PQconsumeInput(PGconn *conn);
535
536/* Routines for pipeline mode management */
537extern int PQenterPipelineMode(PGconn *conn);
538extern int PQexitPipelineMode(PGconn *conn);
539extern int PQpipelineSync(PGconn *conn);
540extern int PQsendFlushRequest(PGconn *conn);
541extern int PQsendPipelineSync(PGconn *conn);
542
543/* LISTEN/NOTIFY support */
545
546/* Routines for copy in/out */
547extern int PQputCopyData(PGconn *conn, const char *buffer, int nbytes);
548extern int PQputCopyEnd(PGconn *conn, const char *errormsg);
549extern int PQgetCopyData(PGconn *conn, char **buffer, int async);
550
551/* Deprecated routines for copy in/out */
552extern int PQgetline(PGconn *conn, char *buffer, int length);
553extern int PQputline(PGconn *conn, const char *string);
554extern int PQgetlineAsync(PGconn *conn, char *buffer, int bufsize);
555extern int PQputnbytes(PGconn *conn, const char *buffer, int nbytes);
556extern int PQendcopy(PGconn *conn);
557
558/* Set blocking/nonblocking connection to the backend */
559extern int PQsetnonblocking(PGconn *conn, int arg);
560extern int PQisnonblocking(const PGconn *conn);
561extern int PQisthreadsafe(void);
562extern PGPing PQping(const char *conninfo);
563extern PGPing PQpingParams(const char *const *keywords,
564 const char *const *values, int expand_dbname);
565
566/* Force the write buffer to be written (or at least try) */
567extern int PQflush(PGconn *conn);
568
569/*
570 * "Fast path" interface --- not really recommended for application
571 * use
572 */
573extern PGresult *PQfn(PGconn *conn,
574 int fnid,
575 int *result_buf,
576 int *result_len,
577 int result_is_int,
578 const PQArgBlock *args,
579 int nargs);
580
581/* Accessor functions for PGresult objects */
582extern ExecStatusType PQresultStatus(const PGresult *res);
583extern char *PQresStatus(ExecStatusType status);
584extern char *PQresultErrorMessage(const PGresult *res);
585extern char *PQresultVerboseErrorMessage(const PGresult *res,
586 PGVerbosity verbosity,
587 PGContextVisibility show_context);
588extern char *PQresultErrorField(const PGresult *res, int fieldcode);
589extern int PQntuples(const PGresult *res);
590extern int PQnfields(const PGresult *res);
591extern int PQbinaryTuples(const PGresult *res);
592extern char *PQfname(const PGresult *res, int field_num);
593extern int PQfnumber(const PGresult *res, const char *field_name);
594extern Oid PQftable(const PGresult *res, int field_num);
595extern int PQftablecol(const PGresult *res, int field_num);
596extern int PQfformat(const PGresult *res, int field_num);
597extern Oid PQftype(const PGresult *res, int field_num);
598extern int PQfsize(const PGresult *res, int field_num);
599extern int PQfmod(const PGresult *res, int field_num);
600extern char *PQcmdStatus(PGresult *res);
601extern char *PQoidStatus(const PGresult *res); /* old and ugly */
602extern Oid PQoidValue(const PGresult *res); /* new and improved */
603extern char *PQcmdTuples(PGresult *res);
604extern char *PQgetvalue(const PGresult *res, int tup_num, int field_num);
605extern int PQgetlength(const PGresult *res, int tup_num, int field_num);
606extern int PQgetisnull(const PGresult *res, int tup_num, int field_num);
607extern int PQnparams(const PGresult *res);
608extern Oid PQparamtype(const PGresult *res, int param_num);
609
610/* Describe prepared statements and portals */
611extern PGresult *PQdescribePrepared(PGconn *conn, const char *stmt);
612extern PGresult *PQdescribePortal(PGconn *conn, const char *portal);
613extern int PQsendDescribePrepared(PGconn *conn, const char *stmt);
614extern int PQsendDescribePortal(PGconn *conn, const char *portal);
615
616/* Close prepared statements and portals */
617extern PGresult *PQclosePrepared(PGconn *conn, const char *stmt);
618extern PGresult *PQclosePortal(PGconn *conn, const char *portal);
619extern int PQsendClosePrepared(PGconn *conn, const char *stmt);
620extern int PQsendClosePortal(PGconn *conn, const char *portal);
621
622/* Delete a PGresult */
623extern void PQclear(PGresult *res);
624
625/* For freeing other alloc'd results, such as PGnotify structs */
626extern void PQfreemem(void *ptr);
627
628/* Exists for backward compatibility. bjm 2003-03-24 */
629#define PQfreeNotify(ptr) PQfreemem(ptr)
630
631/* Error when no password was given. */
632/* Note: depending on this is deprecated; use PQconnectionNeedsPassword(). */
633#define PQnoPasswordSupplied "fe_sendauth: no password supplied\n"
634
635/* Create and manipulate PGresults */
637extern PGresult *PQcopyResult(const PGresult *src, int flags);
638extern int PQsetResultAttrs(PGresult *res, int numAttributes, PGresAttDesc *attDescs);
639extern void *PQresultAlloc(PGresult *res, size_t nBytes);
640extern size_t PQresultMemorySize(const PGresult *res);
641extern int PQsetvalue(PGresult *res, int tup_num, int field_num, char *value, int len);
642
643/* Quoting strings before inclusion in queries. */
644extern size_t PQescapeStringConn(PGconn *conn,
645 char *to, const char *from, size_t length,
646 int *error);
647extern char *PQescapeLiteral(PGconn *conn, const char *str, size_t len);
648extern char *PQescapeIdentifier(PGconn *conn, const char *str, size_t len);
649extern unsigned char *PQescapeByteaConn(PGconn *conn,
650 const unsigned char *from, size_t from_length,
651 size_t *to_length);
652extern unsigned char *PQunescapeBytea(const unsigned char *strtext,
653 size_t *retbuflen);
654
655/* These forms are deprecated! */
656extern size_t PQescapeString(char *to, const char *from, size_t length);
657extern unsigned char *PQescapeBytea(const unsigned char *from, size_t from_length,
658 size_t *to_length);
659
660
661
662/* === in fe-print.c === */
663
664extern void PQprint(FILE *fout, /* output stream */
665 const PGresult *res,
666 const PQprintOpt *po); /* option structure */
667
668/*
669 * really old printing routines
670 */
671extern void PQdisplayTuples(const PGresult *res,
672 FILE *fp, /* where to send the output */
673 int fillAlign, /* pad the fields with spaces */
674 const char *fieldSep, /* field separator */
675 int printHeader, /* display headers? */
676 int quiet);
677
678extern void PQprintTuples(const PGresult *res,
679 FILE *fout, /* output stream */
680 int PrintAttNames, /* print attribute names */
681 int TerseOutput, /* delimiter bars */
682 int colWidth); /* width of column, if 0, use
683 * variable width */
684
685
686/* === in fe-lobj.c === */
687
688/* Large-object access routines */
689extern int lo_open(PGconn *conn, Oid lobjId, int mode);
690extern int lo_close(PGconn *conn, int fd);
691extern int lo_read(PGconn *conn, int fd, char *buf, size_t len);
692extern int lo_write(PGconn *conn, int fd, const char *buf, size_t len);
693extern int lo_lseek(PGconn *conn, int fd, int offset, int whence);
694extern int64_t lo_lseek64(PGconn *conn, int fd, int64_t offset, int whence);
695extern Oid lo_creat(PGconn *conn, int mode);
696extern Oid lo_create(PGconn *conn, Oid lobjId);
697extern int lo_tell(PGconn *conn, int fd);
698extern int64_t lo_tell64(PGconn *conn, int fd);
699extern int lo_truncate(PGconn *conn, int fd, size_t len);
700extern int lo_truncate64(PGconn *conn, int fd, int64_t len);
701extern int lo_unlink(PGconn *conn, Oid lobjId);
702extern Oid lo_import(PGconn *conn, const char *filename);
703extern Oid lo_import_with_oid(PGconn *conn, const char *filename, Oid lobjId);
704extern int lo_export(PGconn *conn, Oid lobjId, const char *filename);
705
706/* === in fe-misc.c === */
707
708/* Get the version of the libpq library in use */
709extern int PQlibVersion(void);
710
711/* Poll a socket for reading and/or writing with an optional timeout */
712extern int PQsocketPoll(int sock, int forRead, int forWrite,
714
715/* Get current time in the form PQsocketPoll wants */
717
718/* Determine length of multibyte encoded char at *s */
719extern int PQmblen(const char *s, int encoding);
720
721/* Same, but not more than the distance to the end of string s */
722extern int PQmblenBounded(const char *s, int encoding);
723
724/* Determine display length of multibyte encoded char at *s */
725extern int PQdsplen(const char *s, int encoding);
726
727/* Get encoding id from environment variable PGCLIENTENCODING */
728extern int PQenv2encoding(void);
729
730/* === in fe-auth.c === */
731
733{
734 const char *verification_uri; /* verification URI to visit */
735 const char *user_code; /* user code to enter */
736 const char *verification_uri_complete; /* optional combination of URI and
737 * code, or NULL */
738 int expires_in; /* seconds until user code expires */
740
741/* for PGoauthBearerRequest.async() */
742#ifdef _WIN32
743#define SOCKTYPE uintptr_t /* avoids depending on winsock2.h for SOCKET */
744#else
745#define SOCKTYPE int
746#endif
747
749{
750 /* Hook inputs (constant across all calls) */
751 const char *openid_configuration; /* OIDC discovery URI */
752 const char *scope; /* required scope(s), or NULL */
753
754 /* Hook outputs */
755
756 /*---------
757 * Callback implementing a custom asynchronous OAuth flow.
758 *
759 * The callback may return
760 * - PGRES_POLLING_READING/WRITING, to indicate that a socket descriptor
761 * has been stored in *altsock and libpq should wait until it is
762 * readable or writable before calling back;
763 * - PGRES_POLLING_OK, to indicate that the flow is complete and
764 * request->token has been set; or
765 * - PGRES_POLLING_FAILED, to indicate that token retrieval has failed.
766 *
767 * This callback is optional. If the token can be obtained without
768 * blocking during the original call to the PQAUTHDATA_OAUTH_BEARER_TOKEN
769 * hook, it may be returned directly, but one of request->async or
770 * request->token must be set by the hook.
771 */
773 struct PGoauthBearerRequest *request,
774 SOCKTYPE * altsock);
775
776 /*
777 * Callback to clean up custom allocations. A hook implementation may use
778 * this to free request->token and any resources in request->user.
779 *
780 * This is technically optional, but highly recommended, because there is
781 * no other indication as to when it is safe to free the token.
782 */
783 void (*cleanup) (PGconn *conn, struct PGoauthBearerRequest *request);
784
785 /*
786 * The hook should set this to the Bearer token contents for the
787 * connection, once the flow is completed. The token contents must remain
788 * available to libpq until the hook's cleanup callback is called.
789 */
790 char *token;
791
792 /*
793 * Hook-defined data. libpq will not modify this pointer across calls to
794 * the async callback, so it can be used to keep track of
795 * application-specific state. Resources allocated here should be freed by
796 * the cleanup callback.
797 */
798 void *user;
800
801#undef SOCKTYPE
802
803extern char *PQencryptPassword(const char *passwd, const char *user);
804extern char *PQencryptPasswordConn(PGconn *conn, const char *passwd, const char *user, const char *algorithm);
805extern PGresult *PQchangePassword(PGconn *conn, const char *user, const char *passwd);
806
808extern void PQsetAuthDataHook(PQauthDataHook_type hook);
811
812/* === in encnames.c === */
813
814extern int pg_char_to_encoding(const char *name);
815extern const char *pg_encoding_to_char(int encoding);
817
818/* === in fe-secure-openssl.c === */
819
820/* Support for overriding sslpassword handling with a callback */
821typedef int (*PQsslKeyPassHook_OpenSSL_type) (char *buf, int size, PGconn *conn);
824extern int PQdefaultSSLKeyPassHook_OpenSSL(char *buf, int size, PGconn *conn);
825
826#ifdef __cplusplus
827}
828#endif
829
830#endif /* LIBPQ_FE_H */
static Datum values[MAXATTR]
Definition: bootstrap.c:153
static PGcancel *volatile cancelConn
Definition: cancel.c:43
int errmsg(const char *fmt,...)
Definition: elog.c:1071
const char * str
#define stmt
Definition: indent_codes.h:59
#define bufsize
Definition: indent_globs.h:36
static struct @166 value
static const JsonPathKeyword keywords[]
ConnStatusType
Definition: libpq-fe.h:83
@ CONNECTION_CONSUME
Definition: libpq-fe.h:102
@ CONNECTION_AUTHENTICATING
Definition: libpq-fe.h:109
@ CONNECTION_CHECK_STANDBY
Definition: libpq-fe.h:106
@ CONNECTION_STARTED
Definition: libpq-fe.h:92
@ CONNECTION_AWAITING_RESPONSE
Definition: libpq-fe.h:94
@ CONNECTION_MADE
Definition: libpq-fe.h:93
@ CONNECTION_CHECK_WRITABLE
Definition: libpq-fe.h:101
@ CONNECTION_BAD
Definition: libpq-fe.h:85
@ CONNECTION_OK
Definition: libpq-fe.h:84
@ CONNECTION_GSS_STARTUP
Definition: libpq-fe.h:103
@ CONNECTION_ALLOCATED
Definition: libpq-fe.h:107
@ CONNECTION_SSL_STARTUP
Definition: libpq-fe.h:99
@ CONNECTION_AUTH_OK
Definition: libpq-fe.h:96
@ CONNECTION_CHECK_TARGET
Definition: libpq-fe.h:104
@ CONNECTION_NEEDED
Definition: libpq-fe.h:100
@ CONNECTION_SETENV
Definition: libpq-fe.h:98
int PQserverVersion(const PGconn *conn)
Definition: fe-connect.c:7669
char * PQencryptPasswordConn(PGconn *conn, const char *passwd, const char *user, const char *algorithm)
Definition: fe-auth.c:1406
int PQprotocolVersion(const PGconn *conn)
Definition: fe-connect.c:7649
char pqbool
Definition: libpq-fe.h:245
int PQresetStart(PGconn *conn)
Definition: fe-connect.c:5352
int PQsendQueryParams(PGconn *conn, const char *command, int nParams, const Oid *paramTypes, const char *const *paramValues, const int *paramLengths, const int *paramFormats, int resultFormat)
Definition: fe-exec.c:1503
int PQgetlength(const PGresult *res, int tup_num, int field_num)
Definition: fe-exec.c:3898
int PQsetSingleRowMode(PGconn *conn)
Definition: fe-exec.c:1959
void PQsetAuthDataHook(PQauthDataHook_type hook)
Definition: fe-auth.c:1595
char * PQoptions(const PGconn *conn)
Definition: fe-connect.c:7608
int PQbinaryTuples(const PGresult *res)
Definition: fe-exec.c:3508
int PQflush(PGconn *conn)
Definition: fe-exec.c:4011
PGresult * PQcopyResult(const PGresult *src, int flags)
Definition: fe-exec.c:318
void PQfreemem(void *ptr)
Definition: fe-exec.c:4043
void PQdisplayTuples(const PGresult *res, FILE *fp, int fillAlign, const char *fieldSep, int printHeader, int quiet)
Definition: fe-print.c:574
int PQgetline(PGconn *conn, char *buffer, int length)
Definition: fe-exec.c:2865
int(* PQauthDataHook_type)(PGauthData type, PGconn *conn, void *data)
Definition: libpq-fe.h:807
ExecStatusType
Definition: libpq-fe.h:123
@ PGRES_COPY_IN
Definition: libpq-fe.h:132
@ PGRES_COPY_BOTH
Definition: libpq-fe.h:137
@ PGRES_COMMAND_OK
Definition: libpq-fe.h:125
@ PGRES_TUPLES_CHUNK
Definition: libpq-fe.h:142
@ PGRES_FATAL_ERROR
Definition: libpq-fe.h:136
@ PGRES_SINGLE_TUPLE
Definition: libpq-fe.h:138
@ PGRES_COPY_OUT
Definition: libpq-fe.h:131
@ PGRES_EMPTY_QUERY
Definition: libpq-fe.h:124
@ PGRES_PIPELINE_SYNC
Definition: libpq-fe.h:139
@ PGRES_BAD_RESPONSE
Definition: libpq-fe.h:133
@ PGRES_PIPELINE_ABORTED
Definition: libpq-fe.h:140
@ PGRES_NONFATAL_ERROR
Definition: libpq-fe.h:135
@ PGRES_TUPLES_OK
Definition: libpq-fe.h:128
char * PQdb(const PGconn *conn)
Definition: fe-connect.c:7513
void PQinitSSL(int do_init)
Definition: fe-secure.c:117
Oid PQftype(const PGresult *res, int field_num)
Definition: fe-exec.c:3730
PGresult * PQchangePassword(PGconn *conn, const char *user, const char *passwd)
Definition: fe-auth.c:1531
void(* pgthreadlock_t)(int acquire)
Definition: libpq-fe.h:468
int lo_tell(PGconn *conn, int fd)
Definition: fe-lobj.c:515
void * PQgetssl(PGconn *conn)
char * PQresultVerboseErrorMessage(const PGresult *res, PGVerbosity verbosity, PGContextVisibility show_context)
Definition: fe-exec.c:3446
struct PGoauthBearerRequest PGoauthBearerRequest
PGresult * PQdescribePrepared(PGconn *conn, const char *stmt)
Definition: fe-exec.c:2466
PGresult * PQexecParams(PGconn *conn, const char *command, int nParams, const Oid *paramTypes, const char *const *paramValues, const int *paramLengths, const int *paramFormats, int resultFormat)
Definition: fe-exec.c:2287
int PQexitPipelineMode(PGconn *conn)
Definition: fe-exec.c:3084
#define SOCKTYPE
Definition: libpq-fe.h:745
PGresult * PQexecPrepared(PGconn *conn, const char *stmtName, int nParams, const char *const *paramValues, const int *paramLengths, const int *paramFormats, int resultFormat)
Definition: fe-exec.c:2334
int PQsendClosePortal(PGconn *conn, const char *portal)
Definition: fe-exec.c:2580
PGPing
Definition: libpq-fe.h:175
@ PQPING_OK
Definition: libpq-fe.h:176
@ PQPING_REJECT
Definition: libpq-fe.h:177
@ PQPING_NO_RESPONSE
Definition: libpq-fe.h:178
@ PQPING_NO_ATTEMPT
Definition: libpq-fe.h:179
PGcancel * PQgetCancel(PGconn *conn)
Definition: fe-cancel.c:368
int PQsetResultAttrs(PGresult *res, int numAttributes, PGresAttDesc *attDescs)
Definition: fe-exec.c:249
PGContextVisibility
Definition: libpq-fe.h:163
@ PQSHOW_CONTEXT_NEVER
Definition: libpq-fe.h:164
@ PQSHOW_CONTEXT_ALWAYS
Definition: libpq-fe.h:166
@ PQSHOW_CONTEXT_ERRORS
Definition: libpq-fe.h:165
void PQcancelReset(PGcancelConn *cancelConn)
Definition: fe-cancel.c:337
int lo_close(PGconn *conn, int fd)
Definition: fe-lobj.c:96
struct _PQconninfoOption PQconninfoOption
unsigned char * PQunescapeBytea(const unsigned char *strtext, size_t *retbuflen)
Definition: fe-exec.c:4566
int PQenv2encoding(void)
Definition: fe-misc.c:1285
const char * pg_encoding_to_char(int encoding)
Definition: encnames.c:587
PQsslKeyPassHook_OpenSSL_type PQgetSSLKeyPassHook_OpenSSL(void)
void * PQsslStruct(PGconn *conn, const char *struct_name)
int PQfullProtocolVersion(const PGconn *conn)
Definition: fe-connect.c:7659
void PQreset(PGconn *conn)
Definition: fe-connect.c:5319
int PQenterPipelineMode(PGconn *conn)
Definition: fe-exec.c:3053
int PQsocketPoll(int sock, int forRead, int forWrite, pg_usec_time_t end_time)
Definition: fe-misc.c:1141
int lo_truncate64(PGconn *conn, int fd, int64_t len)
Definition: fe-lobj.c:195
size_t PQescapeStringConn(PGconn *conn, char *to, const char *from, size_t length, int *error)
Definition: fe-exec.c:4188
void PQtrace(PGconn *conn, FILE *debug_port)
Definition: fe-trace.c:35
char * PQport(const PGconn *conn)
Definition: fe-connect.c:7582
PGresult * PQclosePrepared(PGconn *conn, const char *stmt)
Definition: fe-exec.c:2532
PGTransactionStatusType PQtransactionStatus(const PGconn *conn)
Definition: fe-connect.c:7624
PGcancelConn * PQcancelCreate(PGconn *conn)
Definition: fe-cancel.c:68
PGTransactionStatusType
Definition: libpq-fe.h:146
@ PQTRANS_INTRANS
Definition: libpq-fe.h:149
@ PQTRANS_IDLE
Definition: libpq-fe.h:147
@ PQTRANS_ACTIVE
Definition: libpq-fe.h:148
@ PQTRANS_UNKNOWN
Definition: libpq-fe.h:151
@ PQTRANS_INERROR
Definition: libpq-fe.h:150
PQauthDataHook_type PQgetAuthDataHook(void)
Definition: fe-auth.c:1589
char * PQgetvalue(const PGresult *res, int tup_num, int field_num)
Definition: fe-exec.c:3887
void * PQgetgssctx(PGconn *conn)
PGresult * PQclosePortal(PGconn *conn, const char *portal)
Definition: fe-exec.c:2550
PGresult * PQgetResult(PGconn *conn)
Definition: fe-exec.c:2073
ExecStatusType PQresultStatus(const PGresult *res)
Definition: fe-exec.c:3422
Oid PQparamtype(const PGresult *res, int param_num)
Definition: fe-exec.c:3937
PGconn * PQconnectdb(const char *conninfo)
Definition: fe-connect.c:823
char * PQhost(const PGconn *conn)
Definition: fe-connect.c:7546
int PQnparams(const PGresult *res)
Definition: fe-exec.c:3926
int PQdefaultSSLKeyPassHook_OpenSSL(char *buf, int size, PGconn *conn)
int pg_char_to_encoding(const char *name)
Definition: encnames.c:549
void PQprintTuples(const PGresult *res, FILE *fout, int PrintAttNames, int TerseOutput, int colWidth)
Definition: fe-print.c:671
void PQclear(PGresult *res)
Definition: fe-exec.c:721
int PQsendClosePrepared(PGconn *conn, const char *stmt)
Definition: fe-exec.c:2567
char * PQcmdTuples(PGresult *res)
Definition: fe-exec.c:3833
struct _PQprintOpt PQprintOpt
int PQconnectionUsedPassword(const PGconn *conn)
Definition: fe-connect.c:7747
PQconninfoOption * PQconninfo(PGconn *conn)
Definition: fe-connect.c:7456
int PQfformat(const PGresult *res, int field_num)
Definition: fe-exec.c:3719
void(* PQnoticeReceiver)(void *arg, const PGresult *res)
Definition: libpq-fe.h:241
int PQlibVersion(void)
Definition: fe-misc.c:63
int64_t pg_usec_time_t
Definition: libpq-fe.h:238
void(* PQnoticeProcessor)(void *arg, const char *message)
Definition: libpq-fe.h:242
int PQendcopy(PGconn *conn)
Definition: fe-exec.c:2960
int PQgssEncInUse(PGconn *conn)
PostgresPollingStatusType PQconnectPoll(PGconn *conn)
Definition: fe-connect.c:2911
int PQdefaultAuthDataHook(PGauthData type, PGconn *conn, void *data)
Definition: fe-auth.c:1601
int PQputCopyEnd(PGconn *conn, const char *errormsg)
Definition: fe-exec.c:2760
void PQconninfoFree(PQconninfoOption *connOptions)
Definition: fe-connect.c:7500
Oid lo_creat(PGconn *conn, int mode)
Definition: fe-lobj.c:438
int PQsendPipelineSync(PGconn *conn)
Definition: fe-exec.c:3293
int(* PQsslKeyPassHook_OpenSSL_type)(char *buf, int size, PGconn *conn)
Definition: libpq-fe.h:821
int lo_read(PGconn *conn, int fd, char *buf, size_t len)
Definition: fe-lobj.c:245
int lo_lseek(PGconn *conn, int fd, int offset, int whence)
Definition: fe-lobj.c:344
int PQntuples(const PGresult *res)
Definition: fe-exec.c:3492
int PQputnbytes(PGconn *conn, const char *buffer, int nbytes)
Definition: fe-exec.c:2939
void PQprint(FILE *fout, const PGresult *res, const PQprintOpt *po)
Definition: fe-print.c:68
int pg_valid_server_encoding_id(int encoding)
Definition: encnames.c:513
int PQmblen(const char *s, int encoding)
Definition: fe-misc.c:1255
int PQputline(PGconn *conn, const char *string)
Definition: fe-exec.c:2929
int PQgetlineAsync(PGconn *conn, char *buffer, int bufsize)
Definition: fe-exec.c:2912
int lo_open(PGconn *conn, Oid lobjId, int mode)
Definition: fe-lobj.c:57
PostgresPollingStatusType
Definition: libpq-fe.h:114
@ PGRES_POLLING_ACTIVE
Definition: libpq-fe.h:119
@ PGRES_POLLING_OK
Definition: libpq-fe.h:118
@ PGRES_POLLING_READING
Definition: libpq-fe.h:116
@ PGRES_POLLING_WRITING
Definition: libpq-fe.h:117
@ PGRES_POLLING_FAILED
Definition: libpq-fe.h:115
char * PQtty(const PGconn *conn)
Definition: fe-connect.c:7600
int PQputCopyData(PGconn *conn, const char *buffer, int nbytes)
Definition: fe-exec.c:2706
PQconninfoOption * PQconninfoParse(const char *conninfo, char **errmsg)
Definition: fe-connect.c:6216
const char * PQparameterStatus(const PGconn *conn, const char *paramName)
Definition: fe-connect.c:7634
PGresult * PQmakeEmptyPGresult(PGconn *conn, ExecStatusType status)
Definition: fe-exec.c:159
ConnStatusType PQcancelStatus(const PGcancelConn *cancelConn)
Definition: fe-cancel.c:302
int64_t lo_lseek64(PGconn *conn, int fd, int64_t offset, int whence)
Definition: fe-lobj.c:385
PGresult * PQprepare(PGconn *conn, const char *stmtName, const char *query, int nParams, const Oid *paramTypes)
Definition: fe-exec.c:2317
int64_t lo_tell64(PGconn *conn, int fd)
Definition: fe-lobj.c:548
int lo_write(PGconn *conn, int fd, const char *buf, size_t len)
Definition: fe-lobj.c:295
int PQisthreadsafe(void)
Definition: fe-exec.c:4003
int PQconnectionNeedsPassword(const PGconn *conn)
Definition: fe-connect.c:7732
char * PQresultErrorMessage(const PGresult *res)
Definition: fe-exec.c:3438
char * PQencryptPassword(const char *passwd, const char *user)
Definition: fe-auth.c:1363
char * PQpass(const PGconn *conn)
Definition: fe-connect.c:7529
void PQinitOpenSSL(int do_ssl, int do_crypto)
Definition: fe-secure.c:129
int PQcancelBlocking(PGcancelConn *cancelConn)
Definition: fe-cancel.c:190
int lo_truncate(PGconn *conn, int fd, size_t len)
Definition: fe-lobj.c:131
int PQsendDescribePrepared(PGconn *conn, const char *stmt)
Definition: fe-exec.c:2502
char * PQfname(const PGresult *res, int field_num)
Definition: fe-exec.c:3578
Oid lo_create(PGconn *conn, Oid lobjId)
Definition: fe-lobj.c:474
PostgresPollingStatusType PQresetPoll(PGconn *conn)
Definition: fe-connect.c:5371
int PQsslInUse(PGconn *conn)
Definition: fe-secure.c:103
int PQconnectionUsedGSSAPI(const PGconn *conn)
Definition: fe-connect.c:7758
size_t PQescapeString(char *to, const char *from, size_t length)
Definition: fe-exec.c:4210
int PQconsumeInput(PGconn *conn)
Definition: fe-exec.c:1995
int PQcancel(PGcancel *cancel, char *errbuf, int errbufsize)
Definition: fe-cancel.c:548
PGauthData
Definition: libpq-fe.h:193
@ PQAUTHDATA_PROMPT_OAUTH_DEVICE
Definition: libpq-fe.h:194
@ PQAUTHDATA_OAUTH_BEARER_TOKEN
Definition: libpq-fe.h:196
struct pgNotify PGnotify
ConnStatusType PQstatus(const PGconn *conn)
Definition: fe-connect.c:7616
PGconn * PQconnectStart(const char *conninfo)
Definition: fe-connect.c:951
Oid PQftable(const PGresult *res, int field_num)
Definition: fe-exec.c:3697
int PQfnumber(const PGresult *res, const char *field_name)
Definition: fe-exec.c:3600
unsigned char * PQescapeBytea(const unsigned char *from, size_t from_length, size_t *to_length)
Definition: fe-exec.c:4541
int PQsetnonblocking(PGconn *conn, int arg)
Definition: fe-exec.c:3955
int PQclientEncoding(const PGconn *conn)
Definition: fe-connect.c:7769
PGconn * PQconnectStartParams(const char *const *keywords, const char *const *values, int expand_dbname)
Definition: fe-connect.c:870
char * PQescapeLiteral(PGconn *conn, const char *str, size_t len)
Definition: fe-exec.c:4376
void PQfinish(PGconn *conn)
Definition: fe-connect.c:5305
PGresult * PQfn(PGconn *conn, int fnid, int *result_buf, int *result_len, int result_is_int, const PQArgBlock *args, int nargs)
Definition: fe-exec.c:2991
PGPing PQping(const char *conninfo)
Definition: fe-connect.c:839
int PQsendPrepare(PGconn *conn, const char *stmtName, const char *query, int nParams, const Oid *paramTypes)
Definition: fe-exec.c:1547
PGresult * PQdescribePortal(PGconn *conn, const char *portal)
Definition: fe-exec.c:2485
int PQfmod(const PGresult *res, int field_num)
Definition: fe-exec.c:3752
PGContextVisibility PQsetErrorContextVisibility(PGconn *conn, PGContextVisibility show_context)
Definition: fe-connect.c:7831
PGpipelineStatus
Definition: libpq-fe.h:186
@ PQ_PIPELINE_OFF
Definition: libpq-fe.h:187
@ PQ_PIPELINE_ABORTED
Definition: libpq-fe.h:189
@ PQ_PIPELINE_ON
Definition: libpq-fe.h:188
int PQdsplen(const char *s, int encoding)
Definition: fe-misc.c:1276
int PQgetisnull(const PGresult *res, int tup_num, int field_num)
Definition: fe-exec.c:3912
int PQftablecol(const PGresult *res, int field_num)
Definition: fe-exec.c:3708
int PQsetChunkedRowsMode(PGconn *conn, int chunkSize)
Definition: fe-exec.c:1976
const char * PQsslAttribute(PGconn *conn, const char *attribute_name)
char * PQresultErrorField(const PGresult *res, int fieldcode)
Definition: fe-exec.c:3477
int PQsetvalue(PGresult *res, int tup_num, int field_num, char *value, int len)
Definition: fe-exec.c:452
int PQsendQuery(PGconn *conn, const char *query)
Definition: fe-exec.c:1427
char * PQcmdStatus(PGresult *res)
Definition: fe-exec.c:3763
int PQpipelineSync(PGconn *conn)
Definition: fe-exec.c:3283
PostgresPollingStatusType PQcancelPoll(PGcancelConn *cancelConn)
Definition: fe-cancel.c:226
char * PQoidStatus(const PGresult *res)
Definition: fe-exec.c:3776
PQnoticeReceiver PQsetNoticeReceiver(PGconn *conn, PQnoticeReceiver proc, void *arg)
Definition: fe-connect.c:7843
int PQsendDescribePortal(PGconn *conn, const char *portal)
Definition: fe-exec.c:2515
void PQcancelFinish(PGcancelConn *cancelConn)
Definition: fe-cancel.c:353
PGconn * PQsetdbLogin(const char *pghost, const char *pgport, const char *pgoptions, const char *pgtty, const char *dbName, const char *login, const char *pwd)
Definition: fe-connect.c:2234
struct _PGpromptOAuthDevice PGpromptOAuthDevice
void PQsetTraceFlags(PGconn *conn, int flags)
Definition: fe-trace.c:64
char * PQhostaddr(const PGconn *conn)
Definition: fe-connect.c:7569
char * PQresStatus(ExecStatusType status)
Definition: fe-exec.c:3430
size_t PQresultMemorySize(const PGresult *res)
Definition: fe-exec.c:663
int PQbackendPID(const PGconn *conn)
Definition: fe-connect.c:7715
void * PQresultAlloc(PGresult *res, size_t nBytes)
Definition: fe-exec.c:543
PQconninfoOption * PQconndefaults(void)
Definition: fe-connect.c:2196
int PQisBusy(PGconn *conn)
Definition: fe-exec.c:2042
PGresult * PQexec(PGconn *conn, const char *query)
Definition: fe-exec.c:2273
pg_usec_time_t PQgetCurrentTimeUSec(void)
Definition: fe-misc.c:1235
unsigned char * PQescapeByteaConn(PGconn *conn, const unsigned char *from, size_t from_length, size_t *to_length)
Definition: fe-exec.c:4525
int PQsendQueryPrepared(PGconn *conn, const char *stmtName, int nParams, const char *const *paramValues, const int *paramLengths, const int *paramFormats, int resultFormat)
Definition: fe-exec.c:1644
char * PQescapeIdentifier(PGconn *conn, const char *str, size_t len)
Definition: fe-exec.c:4382
PGVerbosity
Definition: libpq-fe.h:155
@ PQERRORS_VERBOSE
Definition: libpq-fe.h:158
@ PQERRORS_DEFAULT
Definition: libpq-fe.h:157
@ PQERRORS_TERSE
Definition: libpq-fe.h:156
@ PQERRORS_SQLSTATE
Definition: libpq-fe.h:159
int PQsendFlushRequest(PGconn *conn)
Definition: fe-exec.c:3382
int PQrequestCancel(PGconn *conn)
Definition: fe-cancel.c:752
void PQfreeCancel(PGcancel *cancel)
Definition: fe-cancel.c:502
char * PQuser(const PGconn *conn)
Definition: fe-connect.c:7521
int PQcancelSocket(const PGcancelConn *cancelConn)
Definition: fe-cancel.c:313
PGpipelineStatus PQpipelineStatus(const PGconn *conn)
Definition: fe-connect.c:7723
int lo_unlink(PGconn *conn, Oid lobjId)
Definition: fe-lobj.c:589
int PQisnonblocking(const PGconn *conn)
Definition: fe-exec.c:3994
void PQuntrace(PGconn *conn)
Definition: fe-trace.c:49
PGVerbosity PQsetErrorVerbosity(PGconn *conn, PGVerbosity verbosity)
Definition: fe-connect.c:7819
PQnoticeProcessor PQsetNoticeProcessor(PGconn *conn, PQnoticeProcessor proc, void *arg)
Definition: fe-connect.c:7860
char * PQcancelErrorMessage(const PGcancelConn *cancelConn)
Definition: fe-cancel.c:325
Oid lo_import(PGconn *conn, const char *filename)
Definition: fe-lobj.c:626
Oid PQoidValue(const PGresult *res)
Definition: fe-exec.c:3804
int PQmblenBounded(const char *s, int encoding)
Definition: fe-misc.c:1266
int lo_export(PGconn *conn, Oid lobjId, const char *filename)
Definition: fe-lobj.c:748
const char *const * PQsslAttributeNames(PGconn *conn)
int PQcancelStart(PGcancelConn *cancelConn)
Definition: fe-cancel.c:204
int PQnfields(const PGresult *res)
Definition: fe-exec.c:3500
char * PQerrorMessage(const PGconn *conn)
Definition: fe-connect.c:7679
Oid lo_import_with_oid(PGconn *conn, const char *filename, Oid lobjId)
Definition: fe-lobj.c:641
void PQsetSSLKeyPassHook_OpenSSL(PQsslKeyPassHook_OpenSSL_type hook)
PGPing PQpingParams(const char *const *keywords, const char *const *values, int expand_dbname)
Definition: fe-connect.c:786
int PQsocket(const PGconn *conn)
Definition: fe-connect.c:7705
int PQfsize(const PGresult *res, int field_num)
Definition: fe-exec.c:3741
PGnotify * PQnotifies(PGconn *conn)
Definition: fe-exec.c:2678
int PQsetClientEncoding(PGconn *conn, const char *encoding)
Definition: fe-connect.c:7777
PGconn * PQconnectdbParams(const char *const *keywords, const char *const *values, int expand_dbname)
Definition: fe-connect.c:768
struct pgresAttDesc PGresAttDesc
pgthreadlock_t PQregisterThreadLock(pgthreadlock_t newhandler)
Definition: fe-connect.c:8337
int PQgetCopyData(PGconn *conn, char **buffer, int async)
Definition: fe-exec.c:2827
void * arg
static PgChecksumMode mode
Definition: pg_checksums.c:55
const void size_t len
const void * data
static void do_init(void)
Definition: pg_ctl.c:902
int32 encoding
Definition: pg_database.h:41
static char * filename
Definition: pg_dumpall.c:120
static char * user
Definition: pg_regress.c:119
static char * buf
Definition: pg_test_fsync.c:72
static int64 end_time
Definition: pgbench.c:176
static const char * pghost
Definition: pgbench.c:295
static const char * pgport
Definition: pgbench.c:296
static const char * dbName
Definition: pgbench.c:298
unsigned int Oid
Definition: postgres_ext.h:32
static int fd(const char *x, int i)
Definition: preproc-init.c:105
static void error(void)
Definition: sql-dyntest.c:147
PGconn * conn
Definition: streamutil.c:52
const char * scope
Definition: libpq-fe.h:752
void(* cleanup)(PGconn *conn, struct PGoauthBearerRequest *request)
Definition: libpq-fe.h:783
const char * openid_configuration
Definition: libpq-fe.h:751
PostgresPollingStatusType(* async)(PGconn *conn, struct PGoauthBearerRequest *request, SOCKTYPE *altsock)
Definition: libpq-fe.h:772
int isint
Definition: libpq-fe.h:293
int * ptr
Definition: libpq-fe.h:296
int integer
Definition: libpq-fe.h:297
const char * verification_uri_complete
Definition: libpq-fe.h:736
const char * verification_uri
Definition: libpq-fe.h:734
const char * user_code
Definition: libpq-fe.h:735
pqbool align
Definition: libpq-fe.h:250
pqbool pager
Definition: libpq-fe.h:254
pqbool standard
Definition: libpq-fe.h:251
pqbool html3
Definition: libpq-fe.h:252
char * caption
Definition: libpq-fe.h:257
pqbool header
Definition: libpq-fe.h:249
pqbool expanded
Definition: libpq-fe.h:253
char * fieldSep
Definition: libpq-fe.h:255
char ** fieldName
Definition: libpq-fe.h:258
char * tableOpt
Definition: libpq-fe.h:256
struct pgNotify * next
Definition: libpq-fe.h:234
int be_pid
Definition: libpq-fe.h:231
char * relname
Definition: libpq-fe.h:230
char * extra
Definition: libpq-fe.h:232
char * name
Definition: libpq-fe.h:307
int columnid
Definition: libpq-fe.h:309
int atttypmod
Definition: libpq-fe.h:313
const char * type
const char * name