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-2024, 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
19 extern "C"
20 {
21 #endif
22 
23 #include <stdio.h>
24 
25 /*
26  * postgres_ext.h defines the backend's externally visible types,
27  * such as Oid.
28  */
29 #include "postgres_ext.h"
30 
31 /*
32  * These symbols may be used in compile-time #ifdef tests for the availability
33  * of v14-and-newer libpq features.
34  */
35 /* Features added in PostgreSQL v14: */
36 /* Indicates presence of PQenterPipelineMode and friends */
37 #define LIBPQ_HAS_PIPELINING 1
38 /* Indicates presence of PQsetTraceFlags; also new PQtrace output format */
39 #define LIBPQ_HAS_TRACE_FLAGS 1
40 
41 /* Features added in PostgreSQL v15: */
42 /* Indicates that PQsslAttribute(NULL, "library") is useful */
43 #define LIBPQ_HAS_SSL_LIBRARY_DETECTION 1
44 
45 /* Features added in PostgreSQL v17: */
46 /* Indicates presence of PGcancelConn typedef and associated routines */
47 #define LIBPQ_HAS_ASYNC_CANCEL 1
48 /* Indicates presence of PQchangePassword */
49 #define LIBPQ_HAS_CHANGE_PASSWORD 1
50 /* Indicates presence of PQsetChunkedRowsMode, PGRES_TUPLES_CHUNK */
51 #define LIBPQ_HAS_CHUNK_MODE 1
52 /* Indicates presence of PQclosePrepared, PQclosePortal, etc */
53 #define LIBPQ_HAS_CLOSE_PREPARED 1
54 /* Indicates presence of PQsendPipelineSync */
55 #define LIBPQ_HAS_SEND_PIPELINE_SYNC 1
56 /* Indicates presence of PQsocketPoll, PQgetCurrentTimeUSec */
57 #define LIBPQ_HAS_SOCKET_POLL 1
58 
59 /* Features added in PostgreSQL v18: */
60 /* Indicates presence of PQfullProtocolVersion */
61 #define LIBPQ_HAS_FULL_PROTOCOL_VERSION 1
62 
63 /*
64  * Option flags for PQcopyResult
65  */
66 #define PG_COPYRES_ATTRS 0x01
67 #define PG_COPYRES_TUPLES 0x02 /* Implies PG_COPYRES_ATTRS */
68 #define PG_COPYRES_EVENTS 0x04
69 #define PG_COPYRES_NOTICEHOOKS 0x08
70 
71 /* Application-visible enum types */
72 
73 /*
74  * Although it is okay to add to these lists, values which become unused
75  * should never be removed, nor should constants be redefined - that would
76  * break compatibility with existing code.
77  */
78 
79 typedef enum
80 {
83  /* Non-blocking mode only below here */
84 
85  /*
86  * The existence of these should never be relied upon - they should only
87  * be used for user feedback or similar purposes.
88  */
89  CONNECTION_STARTED, /* Waiting for connection to be made. */
90  CONNECTION_MADE, /* Connection OK; waiting to send. */
91  CONNECTION_AWAITING_RESPONSE, /* Waiting for a response from the
92  * postmaster. */
93  CONNECTION_AUTH_OK, /* Received authentication; waiting for
94  * backend startup. */
95  CONNECTION_SETENV, /* This state is no longer used. */
96  CONNECTION_SSL_STARTUP, /* Performing SSL handshake. */
97  CONNECTION_NEEDED, /* Internal state: connect() needed. */
98  CONNECTION_CHECK_WRITABLE, /* Checking if session is read-write. */
99  CONNECTION_CONSUME, /* Consuming any extra messages. */
100  CONNECTION_GSS_STARTUP, /* Negotiating GSSAPI. */
101  CONNECTION_CHECK_TARGET, /* Internal state: checking target server
102  * properties. */
103  CONNECTION_CHECK_STANDBY, /* Checking if server is in standby mode. */
104  CONNECTION_ALLOCATED, /* Waiting for connection attempt to be
105  * started. */
107 
108 typedef enum
109 {
111  PGRES_POLLING_READING, /* These two indicate that one may */
112  PGRES_POLLING_WRITING, /* use select before polling again. */
114  PGRES_POLLING_ACTIVE /* unused; keep for backwards compatibility */
116 
117 typedef enum
118 {
119  PGRES_EMPTY_QUERY = 0, /* empty query string was executed */
120  PGRES_COMMAND_OK, /* a query command that doesn't return
121  * anything was executed properly by the
122  * backend */
123  PGRES_TUPLES_OK, /* a query command that returns tuples was
124  * executed properly by the backend, PGresult
125  * contains the result tuples */
126  PGRES_COPY_OUT, /* Copy Out data transfer in progress */
127  PGRES_COPY_IN, /* Copy In data transfer in progress */
128  PGRES_BAD_RESPONSE, /* an unexpected response was recv'd from the
129  * backend */
130  PGRES_NONFATAL_ERROR, /* notice or warning message */
131  PGRES_FATAL_ERROR, /* query failed */
132  PGRES_COPY_BOTH, /* Copy In/Out data transfer in progress */
133  PGRES_SINGLE_TUPLE, /* single tuple from larger resultset */
134  PGRES_PIPELINE_SYNC, /* pipeline synchronization point */
135  PGRES_PIPELINE_ABORTED, /* Command didn't run because of an abort
136  * earlier in a pipeline */
137  PGRES_TUPLES_CHUNK /* chunk of tuples from larger resultset */
139 
140 typedef enum
141 {
142  PQTRANS_IDLE, /* connection idle */
143  PQTRANS_ACTIVE, /* command in progress */
144  PQTRANS_INTRANS, /* idle, within transaction block */
145  PQTRANS_INERROR, /* idle, within failed transaction */
146  PQTRANS_UNKNOWN /* cannot determine status */
148 
149 typedef enum
150 {
151  PQERRORS_TERSE, /* single-line error messages */
152  PQERRORS_DEFAULT, /* recommended style */
153  PQERRORS_VERBOSE, /* all the facts, ma'am */
154  PQERRORS_SQLSTATE /* only error severity and SQLSTATE code */
156 
157 typedef enum
158 {
159  PQSHOW_CONTEXT_NEVER, /* never show CONTEXT field */
160  PQSHOW_CONTEXT_ERRORS, /* show CONTEXT for errors only (default) */
161  PQSHOW_CONTEXT_ALWAYS /* always show CONTEXT field */
163 
164 /*
165  * PGPing - The ordering of this enum should not be altered because the
166  * values are exposed externally via pg_isready.
167  */
168 
169 typedef enum
170 {
171  PQPING_OK, /* server is accepting connections */
172  PQPING_REJECT, /* server is alive but rejecting connections */
173  PQPING_NO_RESPONSE, /* could not establish connection */
174  PQPING_NO_ATTEMPT /* connection not attempted (bad params) */
176 
177 /*
178  * PGpipelineStatus - Current status of pipeline mode
179  */
180 typedef enum
181 {
186 
187 /* PGconn encapsulates a connection to the backend.
188  * The contents of this struct are not supposed to be known to applications.
189  */
190 typedef struct pg_conn PGconn;
191 
192 /* PGcancelConn encapsulates a cancel connection to the backend.
193  * The contents of this struct are not supposed to be known to applications.
194  */
195 typedef struct pg_cancel_conn PGcancelConn;
196 
197 /* PGresult encapsulates the result of a query (or more precisely, of a single
198  * SQL command --- a query string given to PQsendQuery can contain multiple
199  * commands and thus return multiple PGresult objects).
200  * The contents of this struct are not supposed to be known to applications.
201  */
202 typedef struct pg_result PGresult;
203 
204 /* PGcancel encapsulates the information needed to cancel a running
205  * query on an existing connection.
206  * The contents of this struct are not supposed to be known to applications.
207  */
208 typedef struct pg_cancel PGcancel;
209 
210 /* PGnotify represents the occurrence of a NOTIFY message.
211  * Ideally this would be an opaque typedef, but it's so simple that it's
212  * unlikely to change.
213  * NOTE: in Postgres 6.4 and later, the be_pid is the notifying backend's,
214  * whereas in earlier versions it was always your own backend's PID.
215  */
216 typedef struct pgNotify
217 {
218  char *relname; /* notification condition name */
219  int be_pid; /* process ID of notifying server process */
220  char *extra; /* notification parameter */
221  /* Fields below here are private to libpq; apps should not use 'em */
222  struct pgNotify *next; /* list link */
224 
225 /* pg_usec_time_t is like time_t, but with microsecond resolution */
227 
228 /* Function types for notice-handling callbacks */
229 typedef void (*PQnoticeReceiver) (void *arg, const PGresult *res);
230 typedef void (*PQnoticeProcessor) (void *arg, const char *message);
231 
232 /* Print options for PQprint() */
233 typedef char pqbool;
234 
235 typedef struct _PQprintOpt
236 {
237  pqbool header; /* print output field headings and row count */
238  pqbool align; /* fill align the fields */
239  pqbool standard; /* old brain dead format */
240  pqbool html3; /* output html tables */
241  pqbool expanded; /* expand tables */
242  pqbool pager; /* use pager for output if needed */
243  char *fieldSep; /* field separator */
244  char *tableOpt; /* insert to HTML <table ...> */
245  char *caption; /* HTML <caption> */
246  char **fieldName; /* null terminated array of replacement field
247  * names */
249 
250 /* ----------------
251  * Structure for the conninfo parameter definitions returned by PQconndefaults
252  * or PQconninfoParse.
253  *
254  * All fields except "val" point at static strings which must not be altered.
255  * "val" is either NULL or a malloc'd current-value string. PQconninfoFree()
256  * will release both the val strings and the PQconninfoOption array itself.
257  * ----------------
258  */
259 typedef struct _PQconninfoOption
260 {
261  char *keyword; /* The keyword of the option */
262  char *envvar; /* Fallback environment variable name */
263  char *compiled; /* Fallback compiled in default value */
264  char *val; /* Option's current value, or NULL */
265  char *label; /* Label for field in connect dialog */
266  char *dispchar; /* Indicates how to display this field in a
267  * connect dialog. Values are: "" Display
268  * entered value as is "*" Password field -
269  * hide value "D" Debug option - don't show
270  * by default */
271  int dispsize; /* Field size in characters for dialog */
273 
274 /* ----------------
275  * PQArgBlock -- structure for PQfn() arguments
276  * ----------------
277  */
278 typedef struct
279 {
280  int len;
281  int isint;
282  union
283  {
284  int *ptr; /* can't use void (dec compiler barfs) */
285  int integer;
286  } u;
287 } PQArgBlock;
288 
289 /* ----------------
290  * PGresAttDesc -- Data about a single attribute (column) of a query result
291  * ----------------
292  */
293 typedef struct pgresAttDesc
294 {
295  char *name; /* column name */
296  Oid tableid; /* source table, if known */
297  int columnid; /* source column, if known */
298  int format; /* format code for value (text/binary) */
299  Oid typid; /* type id */
300  int typlen; /* type size */
301  int atttypmod; /* type-specific modifier info */
303 
304 /* ----------------
305  * Exported functions of libpq
306  * ----------------
307  */
308 
309 /* === in fe-connect.c === */
310 
311 /* make a new client connection to the backend */
312 /* Asynchronous (non-blocking) */
313 extern PGconn *PQconnectStart(const char *conninfo);
314 extern PGconn *PQconnectStartParams(const char *const *keywords,
315  const char *const *values, int expand_dbname);
317 
318 /* Synchronous (blocking) */
319 extern PGconn *PQconnectdb(const char *conninfo);
320 extern PGconn *PQconnectdbParams(const char *const *keywords,
321  const char *const *values, int expand_dbname);
322 extern PGconn *PQsetdbLogin(const char *pghost, const char *pgport,
323  const char *pgoptions, const char *pgtty,
324  const char *dbName,
325  const char *login, const char *pwd);
326 
327 #define PQsetdb(M_PGHOST,M_PGPORT,M_PGOPT,M_PGTTY,M_DBNAME) \
328  PQsetdbLogin(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME, NULL, NULL)
329 
330 /* close the current connection and free the PGconn data structure */
331 extern void PQfinish(PGconn *conn);
332 
333 /* get info about connection options known to PQconnectdb */
334 extern PQconninfoOption *PQconndefaults(void);
335 
336 /* parse connection options in same way as PQconnectdb */
337 extern PQconninfoOption *PQconninfoParse(const char *conninfo, char **errmsg);
338 
339 /* return the connection options used by a live connection */
341 
342 /* free the data structure returned by PQconndefaults() or PQconninfoParse() */
343 extern void PQconninfoFree(PQconninfoOption *connOptions);
344 
345 /*
346  * close the current connection and reestablish a new one with the same
347  * parameters
348  */
349 /* Asynchronous (non-blocking) */
350 extern int PQresetStart(PGconn *conn);
352 
353 /* Synchronous (blocking) */
354 extern void PQreset(PGconn *conn);
355 
356 /* Create a PGcancelConn that's used to cancel a query on the given PGconn */
358 
359 /* issue a cancel request in a non-blocking manner */
361 
362 /* issue a blocking cancel request */
364 
365 /* poll a non-blocking cancel request */
368 extern int PQcancelSocket(const PGcancelConn *cancelConn);
369 extern char *PQcancelErrorMessage(const PGcancelConn *cancelConn);
372 
373 
374 /* request a cancel structure */
375 extern PGcancel *PQgetCancel(PGconn *conn);
376 
377 /* free a cancel structure */
378 extern void PQfreeCancel(PGcancel *cancel);
379 
380 /* deprecated version of PQcancelBlocking, but one which is signal-safe */
381 extern int PQcancel(PGcancel *cancel, char *errbuf, int errbufsize);
382 
383 /* deprecated version of PQcancel; not thread-safe */
384 extern int PQrequestCancel(PGconn *conn);
385 
386 /* Accessor functions for PGconn objects */
387 extern char *PQdb(const PGconn *conn);
388 extern char *PQuser(const PGconn *conn);
389 extern char *PQpass(const PGconn *conn);
390 extern char *PQhost(const PGconn *conn);
391 extern char *PQhostaddr(const PGconn *conn);
392 extern char *PQport(const PGconn *conn);
393 extern char *PQtty(const PGconn *conn);
394 extern char *PQoptions(const PGconn *conn);
395 extern ConnStatusType PQstatus(const PGconn *conn);
397 extern const char *PQparameterStatus(const PGconn *conn,
398  const char *paramName);
399 extern int PQprotocolVersion(const PGconn *conn);
400 extern int PQfullProtocolVersion(const PGconn *conn);
401 extern int PQserverVersion(const PGconn *conn);
402 extern char *PQerrorMessage(const PGconn *conn);
403 extern int PQsocket(const PGconn *conn);
404 extern int PQbackendPID(const PGconn *conn);
406 extern int PQconnectionNeedsPassword(const PGconn *conn);
407 extern int PQconnectionUsedPassword(const PGconn *conn);
408 extern int PQconnectionUsedGSSAPI(const PGconn *conn);
409 extern int PQclientEncoding(const PGconn *conn);
410 extern int PQsetClientEncoding(PGconn *conn, const char *encoding);
411 
412 /* SSL information functions */
413 extern int PQsslInUse(PGconn *conn);
414 extern void *PQsslStruct(PGconn *conn, const char *struct_name);
415 extern const char *PQsslAttribute(PGconn *conn, const char *attribute_name);
416 extern const char *const *PQsslAttributeNames(PGconn *conn);
417 
418 /* Get the OpenSSL structure associated with a connection. Returns NULL for
419  * unencrypted connections or if any other TLS library is in use. */
420 extern void *PQgetssl(PGconn *conn);
421 
422 /* Tell libpq whether it needs to initialize OpenSSL */
423 extern void PQinitSSL(int do_init);
424 
425 /* More detailed way to tell libpq whether it needs to initialize OpenSSL */
426 extern void PQinitOpenSSL(int do_ssl, int do_crypto);
427 
428 /* Return true if GSSAPI encryption is in use */
429 extern int PQgssEncInUse(PGconn *conn);
430 
431 /* Returns GSSAPI context if GSSAPI is in use */
432 extern void *PQgetgssctx(PGconn *conn);
433 
434 /* Set verbosity for PQerrorMessage and PQresultErrorMessage */
436 
437 /* Set CONTEXT visibility for PQerrorMessage and PQresultErrorMessage */
439  PGContextVisibility show_context);
440 
441 /* Override default notice handling routines */
443  PQnoticeReceiver proc,
444  void *arg);
446  PQnoticeProcessor proc,
447  void *arg);
448 
449 /*
450  * Used to set callback that prevents concurrent access to
451  * non-thread safe functions that libpq needs.
452  * The default implementation uses a libpq internal mutex.
453  * Only required for multithreaded apps that use kerberos
454  * both within their app and for postgresql connections.
455  */
456 typedef void (*pgthreadlock_t) (int acquire);
457 
459 
460 /* === in fe-trace.c === */
461 extern void PQtrace(PGconn *conn, FILE *debug_port);
462 extern void PQuntrace(PGconn *conn);
463 
464 /* flags controlling trace output: */
465 /* omit timestamps from each line */
466 #define PQTRACE_SUPPRESS_TIMESTAMPS (1<<0)
467 /* redact portions of some messages, for testing frameworks */
468 #define PQTRACE_REGRESS_MODE (1<<1)
469 extern void PQsetTraceFlags(PGconn *conn, int flags);
470 
471 /* === in fe-exec.c === */
472 
473 /* Simple synchronous query */
474 extern PGresult *PQexec(PGconn *conn, const char *query);
476  const char *command,
477  int nParams,
478  const Oid *paramTypes,
479  const char *const *paramValues,
480  const int *paramLengths,
481  const int *paramFormats,
482  int resultFormat);
483 extern PGresult *PQprepare(PGconn *conn, const char *stmtName,
484  const char *query, int nParams,
485  const Oid *paramTypes);
487  const char *stmtName,
488  int nParams,
489  const char *const *paramValues,
490  const int *paramLengths,
491  const int *paramFormats,
492  int resultFormat);
493 
494 /* Interface for multiple-result or asynchronous queries */
495 #define PQ_QUERY_PARAM_MAX_LIMIT 65535
496 
497 extern int PQsendQuery(PGconn *conn, const char *query);
498 extern int PQsendQueryParams(PGconn *conn,
499  const char *command,
500  int nParams,
501  const Oid *paramTypes,
502  const char *const *paramValues,
503  const int *paramLengths,
504  const int *paramFormats,
505  int resultFormat);
506 extern int PQsendPrepare(PGconn *conn, const char *stmtName,
507  const char *query, int nParams,
508  const Oid *paramTypes);
509 extern int PQsendQueryPrepared(PGconn *conn,
510  const char *stmtName,
511  int nParams,
512  const char *const *paramValues,
513  const int *paramLengths,
514  const int *paramFormats,
515  int resultFormat);
516 extern int PQsetSingleRowMode(PGconn *conn);
517 extern int PQsetChunkedRowsMode(PGconn *conn, int chunkSize);
518 extern PGresult *PQgetResult(PGconn *conn);
519 
520 /* Routines for managing an asynchronous query */
521 extern int PQisBusy(PGconn *conn);
522 extern int PQconsumeInput(PGconn *conn);
523 
524 /* Routines for pipeline mode management */
525 extern int PQenterPipelineMode(PGconn *conn);
526 extern int PQexitPipelineMode(PGconn *conn);
527 extern int PQpipelineSync(PGconn *conn);
528 extern int PQsendFlushRequest(PGconn *conn);
529 extern int PQsendPipelineSync(PGconn *conn);
530 
531 /* LISTEN/NOTIFY support */
532 extern PGnotify *PQnotifies(PGconn *conn);
533 
534 /* Routines for copy in/out */
535 extern int PQputCopyData(PGconn *conn, const char *buffer, int nbytes);
536 extern int PQputCopyEnd(PGconn *conn, const char *errormsg);
537 extern int PQgetCopyData(PGconn *conn, char **buffer, int async);
538 
539 /* Deprecated routines for copy in/out */
540 extern int PQgetline(PGconn *conn, char *buffer, int length);
541 extern int PQputline(PGconn *conn, const char *string);
542 extern int PQgetlineAsync(PGconn *conn, char *buffer, int bufsize);
543 extern int PQputnbytes(PGconn *conn, const char *buffer, int nbytes);
544 extern int PQendcopy(PGconn *conn);
545 
546 /* Set blocking/nonblocking connection to the backend */
547 extern int PQsetnonblocking(PGconn *conn, int arg);
548 extern int PQisnonblocking(const PGconn *conn);
549 extern int PQisthreadsafe(void);
550 extern PGPing PQping(const char *conninfo);
551 extern PGPing PQpingParams(const char *const *keywords,
552  const char *const *values, int expand_dbname);
553 
554 /* Force the write buffer to be written (or at least try) */
555 extern int PQflush(PGconn *conn);
556 
557 /*
558  * "Fast path" interface --- not really recommended for application
559  * use
560  */
561 extern PGresult *PQfn(PGconn *conn,
562  int fnid,
563  int *result_buf,
564  int *result_len,
565  int result_is_int,
566  const PQArgBlock *args,
567  int nargs);
568 
569 /* Accessor functions for PGresult objects */
571 extern char *PQresStatus(ExecStatusType status);
572 extern char *PQresultErrorMessage(const PGresult *res);
573 extern char *PQresultVerboseErrorMessage(const PGresult *res,
574  PGVerbosity verbosity,
575  PGContextVisibility show_context);
576 extern char *PQresultErrorField(const PGresult *res, int fieldcode);
577 extern int PQntuples(const PGresult *res);
578 extern int PQnfields(const PGresult *res);
579 extern int PQbinaryTuples(const PGresult *res);
580 extern char *PQfname(const PGresult *res, int field_num);
581 extern int PQfnumber(const PGresult *res, const char *field_name);
582 extern Oid PQftable(const PGresult *res, int field_num);
583 extern int PQftablecol(const PGresult *res, int field_num);
584 extern int PQfformat(const PGresult *res, int field_num);
585 extern Oid PQftype(const PGresult *res, int field_num);
586 extern int PQfsize(const PGresult *res, int field_num);
587 extern int PQfmod(const PGresult *res, int field_num);
588 extern char *PQcmdStatus(PGresult *res);
589 extern char *PQoidStatus(const PGresult *res); /* old and ugly */
590 extern Oid PQoidValue(const PGresult *res); /* new and improved */
591 extern char *PQcmdTuples(PGresult *res);
592 extern char *PQgetvalue(const PGresult *res, int tup_num, int field_num);
593 extern int PQgetlength(const PGresult *res, int tup_num, int field_num);
594 extern int PQgetisnull(const PGresult *res, int tup_num, int field_num);
595 extern int PQnparams(const PGresult *res);
596 extern Oid PQparamtype(const PGresult *res, int param_num);
597 
598 /* Describe prepared statements and portals */
599 extern PGresult *PQdescribePrepared(PGconn *conn, const char *stmt);
600 extern PGresult *PQdescribePortal(PGconn *conn, const char *portal);
601 extern int PQsendDescribePrepared(PGconn *conn, const char *stmt);
602 extern int PQsendDescribePortal(PGconn *conn, const char *portal);
603 
604 /* Close prepared statements and portals */
605 extern PGresult *PQclosePrepared(PGconn *conn, const char *stmt);
606 extern PGresult *PQclosePortal(PGconn *conn, const char *portal);
607 extern int PQsendClosePrepared(PGconn *conn, const char *stmt);
608 extern int PQsendClosePortal(PGconn *conn, const char *portal);
609 
610 /* Delete a PGresult */
611 extern void PQclear(PGresult *res);
612 
613 /* For freeing other alloc'd results, such as PGnotify structs */
614 extern void PQfreemem(void *ptr);
615 
616 /* Exists for backward compatibility. bjm 2003-03-24 */
617 #define PQfreeNotify(ptr) PQfreemem(ptr)
618 
619 /* Error when no password was given. */
620 /* Note: depending on this is deprecated; use PQconnectionNeedsPassword(). */
621 #define PQnoPasswordSupplied "fe_sendauth: no password supplied\n"
622 
623 /* Create and manipulate PGresults */
625 extern PGresult *PQcopyResult(const PGresult *src, int flags);
626 extern int PQsetResultAttrs(PGresult *res, int numAttributes, PGresAttDesc *attDescs);
627 extern void *PQresultAlloc(PGresult *res, size_t nBytes);
628 extern size_t PQresultMemorySize(const PGresult *res);
629 extern int PQsetvalue(PGresult *res, int tup_num, int field_num, char *value, int len);
630 
631 /* Quoting strings before inclusion in queries. */
632 extern size_t PQescapeStringConn(PGconn *conn,
633  char *to, const char *from, size_t length,
634  int *error);
635 extern char *PQescapeLiteral(PGconn *conn, const char *str, size_t len);
636 extern char *PQescapeIdentifier(PGconn *conn, const char *str, size_t len);
637 extern unsigned char *PQescapeByteaConn(PGconn *conn,
638  const unsigned char *from, size_t from_length,
639  size_t *to_length);
640 extern unsigned char *PQunescapeBytea(const unsigned char *strtext,
641  size_t *retbuflen);
642 
643 /* These forms are deprecated! */
644 extern size_t PQescapeString(char *to, const char *from, size_t length);
645 extern unsigned char *PQescapeBytea(const unsigned char *from, size_t from_length,
646  size_t *to_length);
647 
648 
649 
650 /* === in fe-print.c === */
651 
652 extern void PQprint(FILE *fout, /* output stream */
653  const PGresult *res,
654  const PQprintOpt *po); /* option structure */
655 
656 /*
657  * really old printing routines
658  */
659 extern void PQdisplayTuples(const PGresult *res,
660  FILE *fp, /* where to send the output */
661  int fillAlign, /* pad the fields with spaces */
662  const char *fieldSep, /* field separator */
663  int printHeader, /* display headers? */
664  int quiet);
665 
666 extern void PQprintTuples(const PGresult *res,
667  FILE *fout, /* output stream */
668  int PrintAttNames, /* print attribute names */
669  int TerseOutput, /* delimiter bars */
670  int colWidth); /* width of column, if 0, use
671  * variable width */
672 
673 
674 /* === in fe-lobj.c === */
675 
676 /* Large-object access routines */
677 extern int lo_open(PGconn *conn, Oid lobjId, int mode);
678 extern int lo_close(PGconn *conn, int fd);
679 extern int lo_read(PGconn *conn, int fd, char *buf, size_t len);
680 extern int lo_write(PGconn *conn, int fd, const char *buf, size_t len);
681 extern int lo_lseek(PGconn *conn, int fd, int offset, int whence);
682 extern pg_int64 lo_lseek64(PGconn *conn, int fd, pg_int64 offset, int whence);
683 extern Oid lo_creat(PGconn *conn, int mode);
684 extern Oid lo_create(PGconn *conn, Oid lobjId);
685 extern int lo_tell(PGconn *conn, int fd);
686 extern pg_int64 lo_tell64(PGconn *conn, int fd);
687 extern int lo_truncate(PGconn *conn, int fd, size_t len);
688 extern int lo_truncate64(PGconn *conn, int fd, pg_int64 len);
689 extern int lo_unlink(PGconn *conn, Oid lobjId);
690 extern Oid lo_import(PGconn *conn, const char *filename);
691 extern Oid lo_import_with_oid(PGconn *conn, const char *filename, Oid lobjId);
692 extern int lo_export(PGconn *conn, Oid lobjId, const char *filename);
693 
694 /* === in fe-misc.c === */
695 
696 /* Get the version of the libpq library in use */
697 extern int PQlibVersion(void);
698 
699 /* Poll a socket for reading and/or writing with an optional timeout */
700 extern int PQsocketPoll(int sock, int forRead, int forWrite,
702 
703 /* Get current time in the form PQsocketPoll wants */
705 
706 /* Determine length of multibyte encoded char at *s */
707 extern int PQmblen(const char *s, int encoding);
708 
709 /* Same, but not more than the distance to the end of string s */
710 extern int PQmblenBounded(const char *s, int encoding);
711 
712 /* Determine display length of multibyte encoded char at *s */
713 extern int PQdsplen(const char *s, int encoding);
714 
715 /* Get encoding id from environment variable PGCLIENTENCODING */
716 extern int PQenv2encoding(void);
717 
718 /* === in fe-auth.c === */
719 
720 extern char *PQencryptPassword(const char *passwd, const char *user);
721 extern char *PQencryptPasswordConn(PGconn *conn, const char *passwd, const char *user, const char *algorithm);
722 extern PGresult *PQchangePassword(PGconn *conn, const char *user, const char *passwd);
723 
724 /* === in encnames.c === */
725 
726 extern int pg_char_to_encoding(const char *name);
727 extern const char *pg_encoding_to_char(int encoding);
728 extern int pg_valid_server_encoding_id(int encoding);
729 
730 /* === in fe-secure-openssl.c === */
731 
732 /* Support for overriding sslpassword handling with a callback */
733 typedef int (*PQsslKeyPassHook_OpenSSL_type) (char *buf, int size, PGconn *conn);
736 extern int PQdefaultSSLKeyPassHook_OpenSSL(char *buf, int size, PGconn *conn);
737 
738 #ifdef __cplusplus
739 }
740 #endif
741 
742 #endif /* LIBPQ_FE_H */
static Datum values[MAXATTR]
Definition: bootstrap.c:150
static PGcancel *volatile cancelConn
Definition: cancel.c:43
int errmsg(const char *fmt,...)
Definition: elog.c:1070
const char * str
#define stmt
Definition: indent_codes.h:59
#define bufsize
Definition: indent_globs.h:36
static struct @157 value
ConnStatusType
Definition: libpq-fe.h:80
@ CONNECTION_CONSUME
Definition: libpq-fe.h:99
@ CONNECTION_CHECK_STANDBY
Definition: libpq-fe.h:103
@ CONNECTION_STARTED
Definition: libpq-fe.h:89
@ CONNECTION_AWAITING_RESPONSE
Definition: libpq-fe.h:91
@ CONNECTION_MADE
Definition: libpq-fe.h:90
@ CONNECTION_CHECK_WRITABLE
Definition: libpq-fe.h:98
@ CONNECTION_BAD
Definition: libpq-fe.h:82
@ CONNECTION_OK
Definition: libpq-fe.h:81
@ CONNECTION_GSS_STARTUP
Definition: libpq-fe.h:100
@ CONNECTION_ALLOCATED
Definition: libpq-fe.h:104
@ CONNECTION_SSL_STARTUP
Definition: libpq-fe.h:96
@ CONNECTION_AUTH_OK
Definition: libpq-fe.h:93
@ CONNECTION_CHECK_TARGET
Definition: libpq-fe.h:101
@ CONNECTION_NEEDED
Definition: libpq-fe.h:97
@ CONNECTION_SETENV
Definition: libpq-fe.h:95
const char * PQparameterStatus(const PGconn *conn, const char *paramName)
Definition: fe-connect.c:7167
int PQserverVersion(const PGconn *conn)
Definition: fe-connect.c:7202
int PQprotocolVersion(const PGconn *conn)
Definition: fe-connect.c:7182
char pqbool
Definition: libpq-fe.h:233
PQconninfoOption * PQconninfoParse(const char *conninfo, char **errmsg)
Definition: fe-connect.c:5753
unsigned char * PQescapeBytea(const unsigned char *from, size_t from_length, size_t *to_length)
Definition: fe-exec.c:4469
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:2980
int PQresetStart(PGconn *conn)
Definition: fe-connect.c:4940
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:1492
int PQgetlength(const PGresult *res, int tup_num, int field_num)
Definition: fe-exec.c:3887
PGcancel * PQgetCancel(PGconn *conn)
Definition: fe-cancel.c:349
int PQsetSingleRowMode(PGconn *conn)
Definition: fe-exec.c:1948
int PQbinaryTuples(const PGresult *res)
Definition: fe-exec.c:3497
int PQflush(PGconn *conn)
Definition: fe-exec.c:4000
void PQfreemem(void *ptr)
Definition: fe-exec.c:4032
PGconn * PQconnectStartParams(const char *const *keywords, const char *const *values, int expand_dbname)
Definition: fe-connect.c:792
void PQdisplayTuples(const PGresult *res, FILE *fp, int fillAlign, const char *fieldSep, int printHeader, int quiet)
Definition: fe-print.c:574
PGnotify * PQnotifies(PGconn *conn)
Definition: fe-exec.c:2667
PGresult * PQprepare(PGconn *conn, const char *stmtName, const char *query, int nParams, const Oid *paramTypes)
Definition: fe-exec.c:2306
int PQgetline(PGconn *conn, char *buffer, int length)
Definition: fe-exec.c:2854
unsigned char * PQunescapeBytea(const unsigned char *strtext, size_t *retbuflen)
Definition: fe-exec.c:4494
ExecStatusType
Definition: libpq-fe.h:118
@ PGRES_COPY_IN
Definition: libpq-fe.h:127
@ PGRES_COPY_BOTH
Definition: libpq-fe.h:132
@ PGRES_COMMAND_OK
Definition: libpq-fe.h:120
@ PGRES_TUPLES_CHUNK
Definition: libpq-fe.h:137
@ PGRES_FATAL_ERROR
Definition: libpq-fe.h:131
@ PGRES_SINGLE_TUPLE
Definition: libpq-fe.h:133
@ PGRES_COPY_OUT
Definition: libpq-fe.h:126
@ PGRES_EMPTY_QUERY
Definition: libpq-fe.h:119
@ PGRES_PIPELINE_SYNC
Definition: libpq-fe.h:134
@ PGRES_BAD_RESPONSE
Definition: libpq-fe.h:128
@ PGRES_PIPELINE_ABORTED
Definition: libpq-fe.h:135
@ PGRES_NONFATAL_ERROR
Definition: libpq-fe.h:130
@ PGRES_TUPLES_OK
Definition: libpq-fe.h:123
void PQinitSSL(int do_init)
Definition: fe-secure.c:117
Oid PQftype(const PGresult *res, int field_num)
Definition: fe-exec.c:3719
void(* pgthreadlock_t)(int acquire)
Definition: libpq-fe.h:456
int lo_tell(PGconn *conn, int fd)
Definition: fe-lobj.c:515
int PQexitPipelineMode(PGconn *conn)
Definition: fe-exec.c:3073
PGresult * PQchangePassword(PGconn *conn, const char *user, const char *passwd)
Definition: fe-auth.c:1442
char * PQhost(const PGconn *conn)
Definition: fe-connect.c:7081
int PQsendClosePortal(PGconn *conn, const char *portal)
Definition: fe-exec.c:2569
PGPing
Definition: libpq-fe.h:170
@ PQPING_OK
Definition: libpq-fe.h:171
@ PQPING_REJECT
Definition: libpq-fe.h:172
@ PQPING_NO_RESPONSE
Definition: libpq-fe.h:173
@ PQPING_NO_ATTEMPT
Definition: libpq-fe.h:174
int PQsetResultAttrs(PGresult *res, int numAttributes, PGresAttDesc *attDescs)
Definition: fe-exec.c:249
PGContextVisibility
Definition: libpq-fe.h:158
@ PQSHOW_CONTEXT_NEVER
Definition: libpq-fe.h:159
@ PQSHOW_CONTEXT_ALWAYS
Definition: libpq-fe.h:161
@ PQSHOW_CONTEXT_ERRORS
Definition: libpq-fe.h:160
void PQcancelReset(PGcancelConn *cancelConn)
Definition: fe-cancel.c:318
int lo_close(PGconn *conn, int fd)
Definition: fe-lobj.c:96
struct _PQconninfoOption PQconninfoOption
pg_int64 lo_tell64(PGconn *conn, int fd)
Definition: fe-lobj.c:548
int PQenv2encoding(void)
Definition: fe-misc.c:1253
PGconn * PQconnectStart(const char *conninfo)
Definition: fe-connect.c:873
PQsslKeyPassHook_OpenSSL_type PQgetSSLKeyPassHook_OpenSSL(void)
PGconn * PQconnectdbParams(const char *const *keywords, const char *const *values, int expand_dbname)
Definition: fe-connect.c:690
char * PQdb(const PGconn *conn)
Definition: fe-connect.c:7048
char * PQescapeIdentifier(PGconn *conn, const char *str, size_t len)
Definition: fe-exec.c:4310
int PQfullProtocolVersion(const PGconn *conn)
Definition: fe-connect.c:7192
PGcancelConn * PQcancelCreate(PGconn *conn)
Definition: fe-cancel.c:65
void PQreset(PGconn *conn)
Definition: fe-connect.c:4907
int PQenterPipelineMode(PGconn *conn)
Definition: fe-exec.c:3042
int PQsocketPoll(int sock, int forRead, int forWrite, pg_usec_time_t end_time)
Definition: fe-misc.c:1106
size_t PQescapeStringConn(PGconn *conn, char *to, const char *from, size_t length, int *error)
Definition: fe-exec.c:4145
void PQtrace(PGconn *conn, FILE *debug_port)
Definition: fe-trace.c:35
PGTransactionStatusType PQtransactionStatus(const PGconn *conn)
Definition: fe-connect.c:7157
PGTransactionStatusType
Definition: libpq-fe.h:141
@ PQTRANS_INTRANS
Definition: libpq-fe.h:144
@ PQTRANS_IDLE
Definition: libpq-fe.h:142
@ PQTRANS_ACTIVE
Definition: libpq-fe.h:143
@ PQTRANS_UNKNOWN
Definition: libpq-fe.h:146
@ PQTRANS_INERROR
Definition: libpq-fe.h:145
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:2276
ExecStatusType PQresultStatus(const PGresult *res)
Definition: fe-exec.c:3411
Oid PQparamtype(const PGresult *res, int param_num)
Definition: fe-exec.c:3926
PGresult * PQdescribePrepared(PGconn *conn, const char *stmt)
Definition: fe-exec.c:2455
int PQnparams(const PGresult *res)
Definition: fe-exec.c:3915
int PQdefaultSSLKeyPassHook_OpenSSL(char *buf, int size, PGconn *conn)
char * PQencryptPassword(const char *passwd, const char *user)
Definition: fe-auth.c:1274
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:2556
char * PQcmdTuples(PGresult *res)
Definition: fe-exec.c:3822
char * PQresultErrorMessage(const PGresult *res)
Definition: fe-exec.c:3427
PQconninfoOption * PQconndefaults(void)
Definition: fe-connect.c:1882
struct _PQprintOpt PQprintOpt
int PQconnectionUsedPassword(const PGconn *conn)
Definition: fe-connect.c:7278
int PQfformat(const PGresult *res, int field_num)
Definition: fe-exec.c:3708
void(* PQnoticeReceiver)(void *arg, const PGresult *res)
Definition: libpq-fe.h:229
PGresult * PQclosePortal(PGconn *conn, const char *portal)
Definition: fe-exec.c:2539
int PQlibVersion(void)
Definition: fe-misc.c:63
char * PQtty(const PGconn *conn)
Definition: fe-connect.c:7133
void(* PQnoticeProcessor)(void *arg, const char *message)
Definition: libpq-fe.h:230
char * PQhostaddr(const PGconn *conn)
Definition: fe-connect.c:7104
int PQendcopy(PGconn *conn)
Definition: fe-exec.c:2949
int PQgssEncInUse(PGconn *conn)
PostgresPollingStatusType PQconnectPoll(PGconn *conn)
Definition: fe-connect.c:2597
int PQputCopyEnd(PGconn *conn, const char *errormsg)
Definition: fe-exec.c:2749
void PQconninfoFree(PQconninfoOption *connOptions)
Definition: fe-connect.c:7035
Oid lo_creat(PGconn *conn, int mode)
Definition: fe-lobj.c:438
int PQsendPipelineSync(PGconn *conn)
Definition: fe-exec.c:3282
int(* PQsslKeyPassHook_OpenSSL_type)(char *buf, int size, PGconn *conn)
Definition: libpq-fe.h:733
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:3481
int PQputnbytes(PGconn *conn, const char *buffer, int nbytes)
Definition: fe-exec.c:2928
void PQprint(FILE *fout, const PGresult *res, const PQprintOpt *po)
Definition: fe-print.c:68
pg_int64 lo_lseek64(PGconn *conn, int fd, pg_int64 offset, int whence)
Definition: fe-lobj.c:385
int pg_valid_server_encoding_id(int encoding)
Definition: encnames.c:513
int PQmblen(const char *s, int encoding)
Definition: fe-misc.c:1224
int PQputline(PGconn *conn, const char *string)
Definition: fe-exec.c:2918
int PQgetlineAsync(PGconn *conn, char *buffer, int bufsize)
Definition: fe-exec.c:2901
int lo_open(PGconn *conn, Oid lobjId, int mode)
Definition: fe-lobj.c:57
PostgresPollingStatusType
Definition: libpq-fe.h:109
@ PGRES_POLLING_ACTIVE
Definition: libpq-fe.h:114
@ PGRES_POLLING_OK
Definition: libpq-fe.h:113
@ PGRES_POLLING_READING
Definition: libpq-fe.h:111
@ PGRES_POLLING_WRITING
Definition: libpq-fe.h:112
@ PGRES_POLLING_FAILED
Definition: libpq-fe.h:110
int PQputCopyData(PGconn *conn, const char *buffer, int nbytes)
Definition: fe-exec.c:2695
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:2323
ConnStatusType PQcancelStatus(const PGcancelConn *cancelConn)
Definition: fe-cancel.c:283
pg_int64 pg_usec_time_t
Definition: libpq-fe.h:226
PQconninfoOption * PQconninfo(PGconn *conn)
Definition: fe-connect.c:6991
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:3992
char * PQfname(const PGresult *res, int field_num)
Definition: fe-exec.c:3567
int PQconnectionNeedsPassword(const PGconn *conn)
Definition: fe-connect.c:7263
void PQinitOpenSSL(int do_ssl, int do_crypto)
Definition: fe-secure.c:129
char * PQescapeLiteral(PGconn *conn, const char *str, size_t len)
Definition: fe-exec.c:4304
int PQcancelBlocking(PGcancelConn *cancelConn)
Definition: fe-cancel.c:171
int lo_truncate(PGconn *conn, int fd, size_t len)
Definition: fe-lobj.c:131
PGresult * PQdescribePortal(PGconn *conn, const char *portal)
Definition: fe-exec.c:2474
int PQsendDescribePrepared(PGconn *conn, const char *stmt)
Definition: fe-exec.c:2491
PGresult * PQmakeEmptyPGresult(PGconn *conn, ExecStatusType status)
Definition: fe-exec.c:159
Oid lo_create(PGconn *conn, Oid lobjId)
Definition: fe-lobj.c:474
PGresult * PQexec(PGconn *conn, const char *query)
Definition: fe-exec.c:2262
unsigned char * PQescapeByteaConn(PGconn *conn, const unsigned char *from, size_t from_length, size_t *to_length)
Definition: fe-exec.c:4453
PostgresPollingStatusType PQresetPoll(PGconn *conn)
Definition: fe-connect.c:4959
int PQsslInUse(PGconn *conn)
Definition: fe-secure.c:103
int PQconnectionUsedGSSAPI(const PGconn *conn)
Definition: fe-connect.c:7289
size_t PQescapeString(char *to, const char *from, size_t length)
Definition: fe-exec.c:4167
int PQconsumeInput(PGconn *conn)
Definition: fe-exec.c:1984
char * PQerrorMessage(const PGconn *conn)
Definition: fe-connect.c:7212
int PQcancel(PGcancel *cancel, char *errbuf, int errbufsize)
Definition: fe-cancel.c:463
char * PQgetvalue(const PGresult *res, int tup_num, int field_num)
Definition: fe-exec.c:3876
struct pgNotify PGnotify
ConnStatusType PQstatus(const PGconn *conn)
Definition: fe-connect.c:7149
Oid PQftable(const PGresult *res, int field_num)
Definition: fe-exec.c:3686
int PQfnumber(const PGresult *res, const char *field_name)
Definition: fe-exec.c:3589
char * PQcmdStatus(PGresult *res)
Definition: fe-exec.c:3752
int PQsetnonblocking(PGconn *conn, int arg)
Definition: fe-exec.c:3944
int PQclientEncoding(const PGconn *conn)
Definition: fe-connect.c:7300
const char *const * PQsslAttributeNames(PGconn *conn)
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:1920
void PQfinish(PGconn *conn)
Definition: fe-connect.c:4893
PGPing PQping(const char *conninfo)
Definition: fe-connect.c:761
int PQsendPrepare(PGconn *conn, const char *stmtName, const char *query, int nParams, const Oid *paramTypes)
Definition: fe-exec.c:1536
PGconn * PQconnectdb(const char *conninfo)
Definition: fe-connect.c:745
int PQfmod(const PGresult *res, int field_num)
Definition: fe-exec.c:3741
PGContextVisibility PQsetErrorContextVisibility(PGconn *conn, PGContextVisibility show_context)
Definition: fe-connect.c:7362
PGpipelineStatus
Definition: libpq-fe.h:181
@ PQ_PIPELINE_OFF
Definition: libpq-fe.h:182
@ PQ_PIPELINE_ABORTED
Definition: libpq-fe.h:184
@ PQ_PIPELINE_ON
Definition: libpq-fe.h:183
int PQdsplen(const char *s, int encoding)
Definition: fe-misc.c:1244
int PQgetisnull(const PGresult *res, int tup_num, int field_num)
Definition: fe-exec.c:3901
char * PQuser(const PGconn *conn)
Definition: fe-connect.c:7056
int PQftablecol(const PGresult *res, int field_num)
Definition: fe-exec.c:3697
int PQsetChunkedRowsMode(PGconn *conn, int chunkSize)
Definition: fe-exec.c:1965
char * PQcancelErrorMessage(const PGcancelConn *cancelConn)
Definition: fe-cancel.c:306
void * PQgetssl(PGconn *conn)
int PQsetvalue(PGresult *res, int tup_num, int field_num, char *value, int len)
Definition: fe-exec.c:452
void * PQsslStruct(PGconn *conn, const char *struct_name)
char * PQpass(const PGconn *conn)
Definition: fe-connect.c:7064
int PQsendQuery(PGconn *conn, const char *query)
Definition: fe-exec.c:1416
int PQpipelineSync(PGconn *conn)
Definition: fe-exec.c:3272
char * PQresStatus(ExecStatusType status)
Definition: fe-exec.c:3419
PostgresPollingStatusType PQcancelPoll(PGcancelConn *cancelConn)
Definition: fe-cancel.c:207
PQnoticeReceiver PQsetNoticeReceiver(PGconn *conn, PQnoticeReceiver proc, void *arg)
Definition: fe-connect.c:7374
int PQsendDescribePortal(PGconn *conn, const char *portal)
Definition: fe-exec.c:2504
void PQcancelFinish(PGcancelConn *cancelConn)
Definition: fe-cancel.c:334
PGresult * PQclosePrepared(PGconn *conn, const char *stmt)
Definition: fe-exec.c:2521
void PQsetTraceFlags(PGconn *conn, int flags)
Definition: fe-trace.c:64
size_t PQresultMemorySize(const PGresult *res)
Definition: fe-exec.c:663
int PQbackendPID(const PGconn *conn)
Definition: fe-connect.c:7246
int PQisBusy(PGconn *conn)
Definition: fe-exec.c:2031
pg_usec_time_t PQgetCurrentTimeUSec(void)
Definition: fe-misc.c:1200
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:1633
PGVerbosity
Definition: libpq-fe.h:150
@ PQERRORS_VERBOSE
Definition: libpq-fe.h:153
@ PQERRORS_DEFAULT
Definition: libpq-fe.h:152
@ PQERRORS_TERSE
Definition: libpq-fe.h:151
@ PQERRORS_SQLSTATE
Definition: libpq-fe.h:154
void * PQgetgssctx(PGconn *conn)
int PQsendFlushRequest(PGconn *conn)
Definition: fe-exec.c:3371
int PQrequestCancel(PGconn *conn)
Definition: fe-cancel.c:661
char * PQencryptPasswordConn(PGconn *conn, const char *passwd, const char *user, const char *algorithm)
Definition: fe-auth.c:1317
void PQfreeCancel(PGcancel *cancel)
Definition: fe-cancel.c:417
char * PQoidStatus(const PGresult *res)
Definition: fe-exec.c:3765
char * PQresultErrorField(const PGresult *res, int fieldcode)
Definition: fe-exec.c:3466
char * PQport(const PGconn *conn)
Definition: fe-connect.c:7117
int PQcancelSocket(const PGcancelConn *cancelConn)
Definition: fe-cancel.c:294
PGpipelineStatus PQpipelineStatus(const PGconn *conn)
Definition: fe-connect.c:7254
int lo_unlink(PGconn *conn, Oid lobjId)
Definition: fe-lobj.c:589
int PQisnonblocking(const PGconn *conn)
Definition: fe-exec.c:3983
void PQuntrace(PGconn *conn)
Definition: fe-trace.c:49
PGresult * PQcopyResult(const PGresult *src, int flags)
Definition: fe-exec.c:318
PGVerbosity PQsetErrorVerbosity(PGconn *conn, PGVerbosity verbosity)
Definition: fe-connect.c:7350
PQnoticeProcessor PQsetNoticeProcessor(PGconn *conn, PQnoticeProcessor proc, void *arg)
Definition: fe-connect.c:7391
void * PQresultAlloc(PGresult *res, size_t nBytes)
Definition: fe-exec.c:543
Oid lo_import(PGconn *conn, const char *filename)
Definition: fe-lobj.c:626
Oid PQoidValue(const PGresult *res)
Definition: fe-exec.c:3793
int PQmblenBounded(const char *s, int encoding)
Definition: fe-misc.c:1234
const char * PQsslAttribute(PGconn *conn, const char *attribute_name)
const char * pg_encoding_to_char(int encoding)
Definition: encnames.c:587
int lo_export(PGconn *conn, Oid lobjId, const char *filename)
Definition: fe-lobj.c:748
char * PQresultVerboseErrorMessage(const PGresult *res, PGVerbosity verbosity, PGContextVisibility show_context)
Definition: fe-exec.c:3435
int PQcancelStart(PGcancelConn *cancelConn)
Definition: fe-cancel.c:185
int PQnfields(const PGresult *res)
Definition: fe-exec.c:3489
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:708
int PQsocket(const PGconn *conn)
Definition: fe-connect.c:7238
char * PQoptions(const PGconn *conn)
Definition: fe-connect.c:7141
PGresult * PQgetResult(PGconn *conn)
Definition: fe-exec.c:2062
int PQfsize(const PGresult *res, int field_num)
Definition: fe-exec.c:3730
int lo_truncate64(PGconn *conn, int fd, pg_int64 len)
Definition: fe-lobj.c:195
int PQsetClientEncoding(PGconn *conn, const char *encoding)
Definition: fe-connect.c:7308
struct pgresAttDesc PGresAttDesc
pgthreadlock_t PQregisterThreadLock(pgthreadlock_t newhandler)
Definition: fe-connect.c:7836
int PQgetCopyData(PGconn *conn, char **buffer, int async)
Definition: fe-exec.c:2816
void * arg
static PgChecksumMode mode
Definition: pg_checksums.c:56
const void size_t len
static void do_init(void)
Definition: pg_ctl.c:902
int32 encoding
Definition: pg_database.h:41
static char * filename
Definition: pg_dumpall.c:119
static char * user
Definition: pg_regress.c:120
static char * buf
Definition: pg_test_fsync.c:73
static int64 end_time
Definition: pgbench.c:175
static const char * pghost
Definition: pgbench.c:294
static const char * pgport
Definition: pgbench.c:295
static const char * dbName
Definition: pgbench.c:297
PG_INT64_TYPE pg_int64
Definition: postgres_ext.h:47
unsigned int Oid
Definition: postgres_ext.h:31
static int fd(const char *x, int i)
Definition: preproc-init.c:105
static pg_noinline void Size size
Definition: slab.c:607
static void error(void)
Definition: sql-dyntest.c:147
PGconn * conn
Definition: streamutil.c:55
int isint
Definition: libpq-fe.h:281
int * ptr
Definition: libpq-fe.h:284
int integer
Definition: libpq-fe.h:285
pqbool align
Definition: libpq-fe.h:238
pqbool pager
Definition: libpq-fe.h:242
pqbool standard
Definition: libpq-fe.h:239
pqbool html3
Definition: libpq-fe.h:240
char * caption
Definition: libpq-fe.h:245
pqbool header
Definition: libpq-fe.h:237
pqbool expanded
Definition: libpq-fe.h:241
char * fieldSep
Definition: libpq-fe.h:243
char ** fieldName
Definition: libpq-fe.h:246
char * tableOpt
Definition: libpq-fe.h:244
struct pgNotify * next
Definition: libpq-fe.h:222
int be_pid
Definition: libpq-fe.h:219
char * relname
Definition: libpq-fe.h:218
char * extra
Definition: libpq-fe.h:220
char * name
Definition: libpq-fe.h:295
int columnid
Definition: libpq-fe.h:297
int atttypmod
Definition: libpq-fe.h:301
const char * name