PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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-2017, 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  * Option flags for PQcopyResult
33  */
34 #define PG_COPYRES_ATTRS 0x01
35 #define PG_COPYRES_TUPLES 0x02 /* Implies PG_COPYRES_ATTRS */
36 #define PG_COPYRES_EVENTS 0x04
37 #define PG_COPYRES_NOTICEHOOKS 0x08
38 
39 /* Application-visible enum types */
40 
41 /*
42  * Although it is okay to add to these lists, values which become unused
43  * should never be removed, nor should constants be redefined - that would
44  * break compatibility with existing code.
45  */
46 
47 typedef enum
48 {
51  /* Non-blocking mode only below here */
52 
53  /*
54  * The existence of these should never be relied upon - they should only
55  * be used for user feedback or similar purposes.
56  */
57  CONNECTION_STARTED, /* Waiting for connection to be made. */
58  CONNECTION_MADE, /* Connection OK; waiting to send. */
59  CONNECTION_AWAITING_RESPONSE, /* Waiting for a response from the
60  * postmaster. */
61  CONNECTION_AUTH_OK, /* Received authentication; waiting for
62  * backend startup. */
63  CONNECTION_SETENV, /* Negotiating environment. */
64  CONNECTION_SSL_STARTUP, /* Negotiating SSL. */
65  CONNECTION_NEEDED, /* Internal state: connect() needed */
66  CONNECTION_CHECK_WRITABLE, /* Check if we could make a writable
67  * connection. */
68  CONNECTION_CONSUME /* Wait for any pending message and consume
69  * them. */
71 
72 typedef enum
73 {
75  PGRES_POLLING_READING, /* These two indicate that one may */
76  PGRES_POLLING_WRITING, /* use select before polling again. */
78  PGRES_POLLING_ACTIVE /* unused; keep for awhile for backwards
79  * compatibility */
81 
82 typedef enum
83 {
84  PGRES_EMPTY_QUERY = 0, /* empty query string was executed */
85  PGRES_COMMAND_OK, /* a query command that doesn't return
86  * anything was executed properly by the
87  * backend */
88  PGRES_TUPLES_OK, /* a query command that returns tuples was
89  * executed properly by the backend, PGresult
90  * contains the result tuples */
91  PGRES_COPY_OUT, /* Copy Out data transfer in progress */
92  PGRES_COPY_IN, /* Copy In data transfer in progress */
93  PGRES_BAD_RESPONSE, /* an unexpected response was recv'd from the
94  * backend */
95  PGRES_NONFATAL_ERROR, /* notice or warning message */
96  PGRES_FATAL_ERROR, /* query failed */
97  PGRES_COPY_BOTH, /* Copy In/Out data transfer in progress */
98  PGRES_SINGLE_TUPLE /* single tuple from larger resultset */
100 
101 typedef enum
102 {
103  PQTRANS_IDLE, /* connection idle */
104  PQTRANS_ACTIVE, /* command in progress */
105  PQTRANS_INTRANS, /* idle, within transaction block */
106  PQTRANS_INERROR, /* idle, within failed transaction */
107  PQTRANS_UNKNOWN /* cannot determine status */
109 
110 typedef enum
111 {
112  PQERRORS_TERSE, /* single-line error messages */
113  PQERRORS_DEFAULT, /* recommended style */
114  PQERRORS_VERBOSE /* all the facts, ma'am */
115 } PGVerbosity;
116 
117 typedef enum
118 {
119  PQSHOW_CONTEXT_NEVER, /* never show CONTEXT field */
120  PQSHOW_CONTEXT_ERRORS, /* show CONTEXT for errors only (default) */
121  PQSHOW_CONTEXT_ALWAYS /* always show CONTEXT field */
123 
124 /*
125  * PGPing - The ordering of this enum should not be altered because the
126  * values are exposed externally via pg_isready.
127  */
128 
129 typedef enum
130 {
131  PQPING_OK, /* server is accepting connections */
132  PQPING_REJECT, /* server is alive but rejecting connections */
133  PQPING_NO_RESPONSE, /* could not establish connection */
134  PQPING_NO_ATTEMPT /* connection not attempted (bad params) */
135 } PGPing;
136 
137 /* PGconn encapsulates a connection to the backend.
138  * The contents of this struct are not supposed to be known to applications.
139  */
140 typedef struct pg_conn PGconn;
141 
142 /* PGresult encapsulates the result of a query (or more precisely, of a single
143  * SQL command --- a query string given to PQsendQuery can contain multiple
144  * commands and thus return multiple PGresult objects).
145  * The contents of this struct are not supposed to be known to applications.
146  */
147 typedef struct pg_result PGresult;
148 
149 /* PGcancel encapsulates the information needed to cancel a running
150  * query on an existing connection.
151  * The contents of this struct are not supposed to be known to applications.
152  */
153 typedef struct pg_cancel PGcancel;
154 
155 /* PGnotify represents the occurrence of a NOTIFY message.
156  * Ideally this would be an opaque typedef, but it's so simple that it's
157  * unlikely to change.
158  * NOTE: in Postgres 6.4 and later, the be_pid is the notifying backend's,
159  * whereas in earlier versions it was always your own backend's PID.
160  */
161 typedef struct pgNotify
162 {
163  char *relname; /* notification condition name */
164  int be_pid; /* process ID of notifying server process */
165  char *extra; /* notification parameter */
166  /* Fields below here are private to libpq; apps should not use 'em */
167  struct pgNotify *next; /* list link */
168 } PGnotify;
169 
170 /* Function types for notice-handling callbacks */
171 typedef void (*PQnoticeReceiver) (void *arg, const PGresult *res);
172 typedef void (*PQnoticeProcessor) (void *arg, const char *message);
173 
174 /* Print options for PQprint() */
175 typedef char pqbool;
176 
177 typedef struct _PQprintOpt
178 {
179  pqbool header; /* print output field headings and row count */
180  pqbool align; /* fill align the fields */
181  pqbool standard; /* old brain dead format */
182  pqbool html3; /* output html tables */
183  pqbool expanded; /* expand tables */
184  pqbool pager; /* use pager for output if needed */
185  char *fieldSep; /* field separator */
186  char *tableOpt; /* insert to HTML <table ...> */
187  char *caption; /* HTML <caption> */
188  char **fieldName; /* null terminated array of replacement field
189  * names */
190 } PQprintOpt;
191 
192 /* ----------------
193  * Structure for the conninfo parameter definitions returned by PQconndefaults
194  * or PQconninfoParse.
195  *
196  * All fields except "val" point at static strings which must not be altered.
197  * "val" is either NULL or a malloc'd current-value string. PQconninfoFree()
198  * will release both the val strings and the PQconninfoOption array itself.
199  * ----------------
200  */
201 typedef struct _PQconninfoOption
202 {
203  char *keyword; /* The keyword of the option */
204  char *envvar; /* Fallback environment variable name */
205  char *compiled; /* Fallback compiled in default value */
206  char *val; /* Option's current value, or NULL */
207  char *label; /* Label for field in connect dialog */
208  char *dispchar; /* Indicates how to display this field in a
209  * connect dialog. Values are: "" Display
210  * entered value as is "*" Password field -
211  * hide value "D" Debug option - don't show
212  * by default */
213  int dispsize; /* Field size in characters for dialog */
215 
216 /* ----------------
217  * PQArgBlock -- structure for PQfn() arguments
218  * ----------------
219  */
220 typedef struct
221 {
222  int len;
223  int isint;
224  union
225  {
226  int *ptr; /* can't use void (dec compiler barfs) */
227  int integer;
228  } u;
229 } PQArgBlock;
230 
231 /* ----------------
232  * PGresAttDesc -- Data about a single attribute (column) of a query result
233  * ----------------
234  */
235 typedef struct pgresAttDesc
236 {
237  char *name; /* column name */
238  Oid tableid; /* source table, if known */
239  int columnid; /* source column, if known */
240  int format; /* format code for value (text/binary) */
241  Oid typid; /* type id */
242  int typlen; /* type size */
243  int atttypmod; /* type-specific modifier info */
244 } PGresAttDesc;
245 
246 /* ----------------
247  * Exported functions of libpq
248  * ----------------
249  */
250 
251 /* === in fe-connect.c === */
252 
253 /* make a new client connection to the backend */
254 /* Asynchronous (non-blocking) */
255 extern PGconn *PQconnectStart(const char *conninfo);
256 extern PGconn *PQconnectStartParams(const char *const *keywords,
257  const char *const *values, int expand_dbname);
259 
260 /* Synchronous (blocking) */
261 extern PGconn *PQconnectdb(const char *conninfo);
262 extern PGconn *PQconnectdbParams(const char *const *keywords,
263  const char *const *values, int expand_dbname);
264 extern PGconn *PQsetdbLogin(const char *pghost, const char *pgport,
265  const char *pgoptions, const char *pgtty,
266  const char *dbName,
267  const char *login, const char *pwd);
268 
269 #define PQsetdb(M_PGHOST,M_PGPORT,M_PGOPT,M_PGTTY,M_DBNAME) \
270  PQsetdbLogin(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME, NULL, NULL)
271 
272 /* close the current connection and free the PGconn data structure */
273 extern void PQfinish(PGconn *conn);
274 
275 /* get info about connection options known to PQconnectdb */
276 extern PQconninfoOption *PQconndefaults(void);
277 
278 /* parse connection options in same way as PQconnectdb */
279 extern PQconninfoOption *PQconninfoParse(const char *conninfo, char **errmsg);
280 
281 /* return the connection options used by a live connection */
283 
284 /* free the data structure returned by PQconndefaults() or PQconninfoParse() */
285 extern void PQconninfoFree(PQconninfoOption *connOptions);
286 
287 /*
288  * close the current connection and restablish a new one with the same
289  * parameters
290  */
291 /* Asynchronous (non-blocking) */
292 extern int PQresetStart(PGconn *conn);
294 
295 /* Synchronous (blocking) */
296 extern void PQreset(PGconn *conn);
297 
298 /* request a cancel structure */
299 extern PGcancel *PQgetCancel(PGconn *conn);
300 
301 /* free a cancel structure */
302 extern void PQfreeCancel(PGcancel *cancel);
303 
304 /* issue a cancel request */
305 extern int PQcancel(PGcancel *cancel, char *errbuf, int errbufsize);
306 
307 /* backwards compatible version of PQcancel; not thread-safe */
308 extern int PQrequestCancel(PGconn *conn);
309 
310 /* Accessor functions for PGconn objects */
311 extern char *PQdb(const PGconn *conn);
312 extern char *PQuser(const PGconn *conn);
313 extern char *PQpass(const PGconn *conn);
314 extern char *PQhost(const PGconn *conn);
315 extern char *PQport(const PGconn *conn);
316 extern char *PQtty(const PGconn *conn);
317 extern char *PQoptions(const PGconn *conn);
318 extern ConnStatusType PQstatus(const PGconn *conn);
320 extern const char *PQparameterStatus(const PGconn *conn,
321  const char *paramName);
322 extern int PQprotocolVersion(const PGconn *conn);
323 extern int PQserverVersion(const PGconn *conn);
324 extern char *PQerrorMessage(const PGconn *conn);
325 extern int PQsocket(const PGconn *conn);
326 extern int PQbackendPID(const PGconn *conn);
327 extern int PQconnectionNeedsPassword(const PGconn *conn);
328 extern int PQconnectionUsedPassword(const PGconn *conn);
329 extern int PQclientEncoding(const PGconn *conn);
330 extern int PQsetClientEncoding(PGconn *conn, const char *encoding);
331 
332 /* SSL information functions */
333 extern int PQsslInUse(PGconn *conn);
334 extern void *PQsslStruct(PGconn *conn, const char *struct_name);
335 extern const char *PQsslAttribute(PGconn *conn, const char *attribute_name);
336 extern const char *const *PQsslAttributeNames(PGconn *conn);
337 
338 /* Get the OpenSSL structure associated with a connection. Returns NULL for
339  * unencrypted connections or if any other TLS library is in use. */
340 extern void *PQgetssl(PGconn *conn);
341 
342 /* Tell libpq whether it needs to initialize OpenSSL */
343 extern void PQinitSSL(int do_init);
344 
345 /* More detailed way to tell libpq whether it needs to initialize OpenSSL */
346 extern void PQinitOpenSSL(int do_ssl, int do_crypto);
347 
348 /* Set verbosity for PQerrorMessage and PQresultErrorMessage */
350 
351 /* Set CONTEXT visibility for PQerrorMessage and PQresultErrorMessage */
353  PGContextVisibility show_context);
354 
355 /* Enable/disable tracing */
356 extern void PQtrace(PGconn *conn, FILE *debug_port);
357 extern void PQuntrace(PGconn *conn);
358 
359 /* Override default notice handling routines */
361  PQnoticeReceiver proc,
362  void *arg);
364  PQnoticeProcessor proc,
365  void *arg);
366 
367 /*
368  * Used to set callback that prevents concurrent access to
369  * non-thread safe functions that libpq needs.
370  * The default implementation uses a libpq internal mutex.
371  * Only required for multithreaded apps that use kerberos
372  * both within their app and for postgresql connections.
373  */
374 typedef void (*pgthreadlock_t) (int acquire);
375 
377 
378 /* === in fe-exec.c === */
379 
380 /* Simple synchronous query */
381 extern PGresult *PQexec(PGconn *conn, const char *query);
383  const char *command,
384  int nParams,
385  const Oid *paramTypes,
386  const char *const *paramValues,
387  const int *paramLengths,
388  const int *paramFormats,
389  int resultFormat);
390 extern PGresult *PQprepare(PGconn *conn, const char *stmtName,
391  const char *query, int nParams,
392  const Oid *paramTypes);
394  const char *stmtName,
395  int nParams,
396  const char *const *paramValues,
397  const int *paramLengths,
398  const int *paramFormats,
399  int resultFormat);
400 
401 /* Interface for multiple-result or asynchronous queries */
402 extern int PQsendQuery(PGconn *conn, const char *query);
403 extern int PQsendQueryParams(PGconn *conn,
404  const char *command,
405  int nParams,
406  const Oid *paramTypes,
407  const char *const *paramValues,
408  const int *paramLengths,
409  const int *paramFormats,
410  int resultFormat);
411 extern int PQsendPrepare(PGconn *conn, const char *stmtName,
412  const char *query, int nParams,
413  const Oid *paramTypes);
414 extern int PQsendQueryPrepared(PGconn *conn,
415  const char *stmtName,
416  int nParams,
417  const char *const *paramValues,
418  const int *paramLengths,
419  const int *paramFormats,
420  int resultFormat);
421 extern int PQsetSingleRowMode(PGconn *conn);
422 extern PGresult *PQgetResult(PGconn *conn);
423 
424 /* Routines for managing an asynchronous query */
425 extern int PQisBusy(PGconn *conn);
426 extern int PQconsumeInput(PGconn *conn);
427 
428 /* LISTEN/NOTIFY support */
429 extern PGnotify *PQnotifies(PGconn *conn);
430 
431 /* Routines for copy in/out */
432 extern int PQputCopyData(PGconn *conn, const char *buffer, int nbytes);
433 extern int PQputCopyEnd(PGconn *conn, const char *errormsg);
434 extern int PQgetCopyData(PGconn *conn, char **buffer, int async);
435 
436 /* Deprecated routines for copy in/out */
437 extern int PQgetline(PGconn *conn, char *string, int length);
438 extern int PQputline(PGconn *conn, const char *string);
439 extern int PQgetlineAsync(PGconn *conn, char *buffer, int bufsize);
440 extern int PQputnbytes(PGconn *conn, const char *buffer, int nbytes);
441 extern int PQendcopy(PGconn *conn);
442 
443 /* Set blocking/nonblocking connection to the backend */
444 extern int PQsetnonblocking(PGconn *conn, int arg);
445 extern int PQisnonblocking(const PGconn *conn);
446 extern int PQisthreadsafe(void);
447 extern PGPing PQping(const char *conninfo);
448 extern PGPing PQpingParams(const char *const *keywords,
449  const char *const *values, int expand_dbname);
450 
451 /* Force the write buffer to be written (or at least try) */
452 extern int PQflush(PGconn *conn);
453 
454 /*
455  * "Fast path" interface --- not really recommended for application
456  * use
457  */
458 extern PGresult *PQfn(PGconn *conn,
459  int fnid,
460  int *result_buf,
461  int *result_len,
462  int result_is_int,
463  const PQArgBlock *args,
464  int nargs);
465 
466 /* Accessor functions for PGresult objects */
467 extern ExecStatusType PQresultStatus(const PGresult *res);
468 extern char *PQresStatus(ExecStatusType status);
469 extern char *PQresultErrorMessage(const PGresult *res);
470 extern char *PQresultVerboseErrorMessage(const PGresult *res,
471  PGVerbosity verbosity,
472  PGContextVisibility show_context);
473 extern char *PQresultErrorField(const PGresult *res, int fieldcode);
474 extern int PQntuples(const PGresult *res);
475 extern int PQnfields(const PGresult *res);
476 extern int PQbinaryTuples(const PGresult *res);
477 extern char *PQfname(const PGresult *res, int field_num);
478 extern int PQfnumber(const PGresult *res, const char *field_name);
479 extern Oid PQftable(const PGresult *res, int field_num);
480 extern int PQftablecol(const PGresult *res, int field_num);
481 extern int PQfformat(const PGresult *res, int field_num);
482 extern Oid PQftype(const PGresult *res, int field_num);
483 extern int PQfsize(const PGresult *res, int field_num);
484 extern int PQfmod(const PGresult *res, int field_num);
485 extern char *PQcmdStatus(PGresult *res);
486 extern char *PQoidStatus(const PGresult *res); /* old and ugly */
487 extern Oid PQoidValue(const PGresult *res); /* new and improved */
488 extern char *PQcmdTuples(PGresult *res);
489 extern char *PQgetvalue(const PGresult *res, int tup_num, int field_num);
490 extern int PQgetlength(const PGresult *res, int tup_num, int field_num);
491 extern int PQgetisnull(const PGresult *res, int tup_num, int field_num);
492 extern int PQnparams(const PGresult *res);
493 extern Oid PQparamtype(const PGresult *res, int param_num);
494 
495 /* Describe prepared statements and portals */
496 extern PGresult *PQdescribePrepared(PGconn *conn, const char *stmt);
497 extern PGresult *PQdescribePortal(PGconn *conn, const char *portal);
498 extern int PQsendDescribePrepared(PGconn *conn, const char *stmt);
499 extern int PQsendDescribePortal(PGconn *conn, const char *portal);
500 
501 /* Delete a PGresult */
502 extern void PQclear(PGresult *res);
503 
504 /* For freeing other alloc'd results, such as PGnotify structs */
505 extern void PQfreemem(void *ptr);
506 
507 /* Exists for backward compatibility. bjm 2003-03-24 */
508 #define PQfreeNotify(ptr) PQfreemem(ptr)
509 
510 /* Error when no password was given. */
511 /* Note: depending on this is deprecated; use PQconnectionNeedsPassword(). */
512 #define PQnoPasswordSupplied "fe_sendauth: no password supplied\n"
513 
514 /* Create and manipulate PGresults */
516 extern PGresult *PQcopyResult(const PGresult *src, int flags);
517 extern int PQsetResultAttrs(PGresult *res, int numAttributes, PGresAttDesc *attDescs);
518 extern void *PQresultAlloc(PGresult *res, size_t nBytes);
519 extern int PQsetvalue(PGresult *res, int tup_num, int field_num, char *value, int len);
520 
521 /* Quoting strings before inclusion in queries. */
522 extern size_t PQescapeStringConn(PGconn *conn,
523  char *to, const char *from, size_t length,
524  int *error);
525 extern char *PQescapeLiteral(PGconn *conn, const char *str, size_t len);
526 extern char *PQescapeIdentifier(PGconn *conn, const char *str, size_t len);
527 extern unsigned char *PQescapeByteaConn(PGconn *conn,
528  const unsigned char *from, size_t from_length,
529  size_t *to_length);
530 extern unsigned char *PQunescapeBytea(const unsigned char *strtext,
531  size_t *retbuflen);
532 
533 /* These forms are deprecated! */
534 extern size_t PQescapeString(char *to, const char *from, size_t length);
535 extern unsigned char *PQescapeBytea(const unsigned char *from, size_t from_length,
536  size_t *to_length);
537 
538 
539 
540 /* === in fe-print.c === */
541 
542 extern void PQprint(FILE *fout, /* output stream */
543  const PGresult *res,
544  const PQprintOpt *ps); /* option structure */
545 
546 /*
547  * really old printing routines
548  */
549 extern void PQdisplayTuples(const PGresult *res,
550  FILE *fp, /* where to send the output */
551  int fillAlign, /* pad the fields with spaces */
552  const char *fieldSep, /* field separator */
553  int printHeader, /* display headers? */
554  int quiet);
555 
556 extern void PQprintTuples(const PGresult *res,
557  FILE *fout, /* output stream */
558  int printAttName, /* print attribute names */
559  int terseOutput, /* delimiter bars */
560  int width); /* width of column, if 0, use variable width */
561 
562 
563 /* === in fe-lobj.c === */
564 
565 /* Large-object access routines */
566 extern int lo_open(PGconn *conn, Oid lobjId, int mode);
567 extern int lo_close(PGconn *conn, int fd);
568 extern int lo_read(PGconn *conn, int fd, char *buf, size_t len);
569 extern int lo_write(PGconn *conn, int fd, const char *buf, size_t len);
570 extern int lo_lseek(PGconn *conn, int fd, int offset, int whence);
571 extern pg_int64 lo_lseek64(PGconn *conn, int fd, pg_int64 offset, int whence);
572 extern Oid lo_creat(PGconn *conn, int mode);
573 extern Oid lo_create(PGconn *conn, Oid lobjId);
574 extern int lo_tell(PGconn *conn, int fd);
575 extern pg_int64 lo_tell64(PGconn *conn, int fd);
576 extern int lo_truncate(PGconn *conn, int fd, size_t len);
577 extern int lo_truncate64(PGconn *conn, int fd, pg_int64 len);
578 extern int lo_unlink(PGconn *conn, Oid lobjId);
579 extern Oid lo_import(PGconn *conn, const char *filename);
580 extern Oid lo_import_with_oid(PGconn *conn, const char *filename, Oid lobjId);
581 extern int lo_export(PGconn *conn, Oid lobjId, const char *filename);
582 
583 /* === in fe-misc.c === */
584 
585 /* Get the version of the libpq library in use */
586 extern int PQlibVersion(void);
587 
588 /* Determine length of multibyte encoded char at *s */
589 extern int PQmblen(const char *s, int encoding);
590 
591 /* Determine display length of multibyte encoded char at *s */
592 extern int PQdsplen(const char *s, int encoding);
593 
594 /* Get encoding id from environment variable PGCLIENTENCODING */
595 extern int PQenv2encoding(void);
596 
597 /* === in fe-auth.c === */
598 
599 extern char *PQencryptPassword(const char *passwd, const char *user);
600 extern char *PQencryptPasswordConn(PGconn *conn, const char *passwd, const char *user, const char *algorithm);
601 
602 /* === in encnames.c === */
603 
604 extern int pg_char_to_encoding(const char *name);
605 extern const char *pg_encoding_to_char(int encoding);
606 extern int pg_valid_server_encoding_id(int encoding);
607 
608 #ifdef __cplusplus
609 }
610 #endif
611 
612 #endif /* LIBPQ_FE_H */
int PQclientEncoding(const PGconn *conn)
Definition: fe-connect.c:6157
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:1911
void PQtrace(PGconn *conn, FILE *debug_port)
Definition: fe-connect.c:6235
int PQsocket(const PGconn *conn)
Definition: fe-connect.c:6115
void PQinitSSL(int do_init)
Definition: fe-secure.c:137
Oid PQftable(const PGresult *res, int field_num)
Definition: fe-exec.c:2929
char * PQport(const PGconn *conn)
Definition: fe-connect.c:6018
char * extra
Definition: libpq-fe.h:165
void * PQgetssl(PGconn *conn)
ConnStatusType
Definition: libpq-fe.h:47
int length(const List *list)
Definition: list.c:1271
int PQnfields(const PGresult *res)
Definition: fe-exec.c:2732
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:1234
size_t PQescapeString(char *to, const char *from, size_t length)
Definition: fe-exec.c:3383
PQconninfoOption * PQconninfoParse(const char *conninfo, char **errmsg)
Definition: fe-connect.c:4717
int lo_tell(PGconn *conn, int fd)
Definition: fe-lobj.c:548
void(* PQnoticeProcessor)(void *arg, const char *message)
Definition: libpq-fe.h:172
void * PQsslStruct(PGconn *conn, const char *struct_name)
int lo_export(PGconn *conn, Oid lobjId, const char *filename)
Definition: fe-lobj.c:784
PGPing PQping(const char *conninfo)
Definition: fe-connect.c:601
void PQuntrace(PGconn *conn)
Definition: fe-connect.c:6244
int PQgetCopyData(PGconn *conn, char **buffer, int async)
Definition: fe-exec.c:2428
static void error(void)
Definition: sql-dyntest.c:147
int PQfmod(const PGresult *res, int field_num)
Definition: fe-exec.c:2984
int PQisnonblocking(const PGconn *conn)
Definition: fe-exec.c:3219
int PQmblen(const char *s, int encoding)
Definition: fe-misc.c:1180
char * PQpass(const PGconn *conn)
Definition: fe-connect.c:5981
char * PQescapeIdentifier(PGconn *conn, const char *str, size_t len)
Definition: fe-exec.c:3525
PGresult * PQcopyResult(const PGresult *src, int flags)
Definition: fe-exec.c:293
int PQgetlineAsync(PGconn *conn, char *buffer, int bufsize)
Definition: fe-exec.c:2520
char * PQuser(const PGconn *conn)
Definition: fe-connect.c:5973
int pg_valid_server_encoding_id(int encoding)
Definition: encnames.c:515
int PQputCopyData(PGconn *conn, const char *buffer, int nbytes)
Definition: fe-exec.c:2272
void PQreset(PGconn *conn)
Definition: fe-connect.c:3644
int PQresetStart(PGconn *conn)
Definition: fe-connect.c:3685
pg_int64 lo_tell64(PGconn *conn, int fd)
Definition: fe-lobj.c:584
int PQbinaryTuples(const PGresult *res)
Definition: fe-exec.c:2740
PGconn * PQconnectStartParams(const char *const *keywords, const char *const *values, int expand_dbname)
Definition: fe-connect.c:632
int lo_read(PGconn *conn, int fd, char *buf, size_t len)
Definition: fe-lobj.c:258
void PQfreeCancel(PGcancel *cancel)
Definition: fe-connect.c:3774
char * PQdb(const PGconn *conn)
Definition: fe-connect.c:5965
int PQntuples(const PGresult *res)
Definition: fe-exec.c:2724
int PQisthreadsafe(void)
Definition: fe-exec.c:3226
PGcancel * PQgetCancel(PGconn *conn)
Definition: fe-connect.c:3751
unsigned char * PQescapeByteaConn(PGconn *conn, const unsigned char *from, size_t from_length, size_t *to_length)
Definition: fe-exec.c:3669
int PQsetvalue(PGresult *res, int tup_num, int field_num, char *value, int len)
Definition: fe-exec.c:424
int PQfformat(const PGresult *res, int field_num)
Definition: fe-exec.c:2951
char * PQgetvalue(const PGresult *res, int tup_num, int field_num)
Definition: fe-exec.c:3118
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:2607
char * PQcmdTuples(PGresult *res)
Definition: fe-exec.c:3065
int PQconnectionUsedPassword(const PGconn *conn)
Definition: fe-connect.c:6146
ExecStatusType
Definition: libpq-fe.h:82
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:1958
ExecStatusType PQresultStatus(const PGresult *res)
Definition: fe-exec.c:2647
void(* pgthreadlock_t)(int acquire)
Definition: libpq-fe.h:374
PQnoticeProcessor PQsetNoticeProcessor(PGconn *conn, PQnoticeProcessor proc, void *arg)
Definition: fe-connect.c:6273
pgthreadlock_t PQregisterThreadLock(pgthreadlock_t newhandler)
Definition: fe-connect.c:6580
void PQinitOpenSSL(int do_ssl, int do_crypto)
Definition: fe-secure.c:149
char * PQtty(const PGconn *conn)
Definition: fe-connect.c:6028
void PQfinish(PGconn *conn)
Definition: fe-connect.c:3630
unsigned int Oid
Definition: postgres_ext.h:31
int PQlibVersion(void)
Definition: fe-misc.c:67
pqbool standard
Definition: libpq-fe.h:181
const char *const * PQsslAttributeNames(PGconn *conn)
static int fd(const char *x, int i)
Definition: preproc-init.c:105
int columnid
Definition: libpq-fe.h:239
char * fieldSep
Definition: libpq-fe.h:185
PG_INT64_TYPE pg_int64
Definition: postgres_ext.h:47
Oid lo_create(PGconn *conn, Oid lobjId)
Definition: fe-lobj.c:504
PGTransactionStatusType PQtransactionStatus(const PGconn *conn)
Definition: fe-connect.c:6052
Oid lo_creat(PGconn *conn, int mode)
Definition: fe-lobj.c:465
PQconninfoOption * PQconndefaults(void)
Definition: fe-connect.c:1224
char * PQoptions(const PGconn *conn)
Definition: fe-connect.c:6036
PGconn * PQconnectStart(const char *conninfo)
Definition: fe-connect.c:711
void PQconninfoFree(PQconninfoOption *connOptions)
Definition: fe-connect.c:5947
int PQsetnonblocking(PGconn *conn, int arg)
Definition: fe-exec.c:3186
const char * pg_encoding_to_char(int encoding)
Definition: encnames.c:607
int PQnparams(const PGresult *res)
Definition: fe-exec.c:3157
int PQgetline(PGconn *conn, char *string, int length)
Definition: fe-exec.c:2470
int lo_close(PGconn *conn, int fd)
Definition: fe-lobj.c:99
int PQprotocolVersion(const PGconn *conn)
Definition: fe-connect.c:6077
PGconn * PQconnectdbParams(const char *const *keywords, const char *const *values, int expand_dbname)
Definition: fe-connect.c:529
int lo_lseek(PGconn *conn, int fd, int offset, int whence)
Definition: fe-lobj.c:365
void(* PQnoticeReceiver)(void *arg, const PGresult *res)
Definition: libpq-fe.h:171
int PQputCopyEnd(PGconn *conn, const char *errormsg)
Definition: fe-exec.c:2339
int PQsslInUse(PGconn *conn)
PGconn * conn
Definition: streamutil.c:46
int be_pid
Definition: libpq-fe.h:164
static struct @121 value
void PQprint(FILE *fout, const PGresult *res, const PQprintOpt *ps)
Definition: fe-print.c:68
int PQsendDescribePortal(PGconn *conn, const char *portal)
Definition: fe-exec.c:2163
int PQftablecol(const PGresult *res, int field_num)
Definition: fe-exec.c:2940
int lo_open(PGconn *conn, Oid lobjId, int mode)
Definition: fe-lobj.c:57
char * PQresultErrorField(const PGresult *res, int fieldcode)
Definition: fe-exec.c:2709
char * PQresultVerboseErrorMessage(const PGresult *res, PGVerbosity verbosity, PGContextVisibility show_context)
Definition: fe-exec.c:2671
static char * buf
Definition: pg_test_fsync.c:67
char * PQencryptPassword(const char *passwd, const char *user)
Definition: fe-auth.c:1098
int PQputline(PGconn *conn, const char *string)
Definition: fe-exec.c:2540
PGVerbosity PQsetErrorVerbosity(PGconn *conn, PGVerbosity verbosity)
Definition: fe-connect.c:6211
pqbool align
Definition: libpq-fe.h:180
char * relname
Definition: libpq-fe.h:163
PGresult * PQexec(PGconn *conn, const char *query)
Definition: fe-exec.c:1897
int PQgetlength(const PGresult *res, int tup_num, int field_num)
Definition: fe-exec.c:3129
char * PQescapeLiteral(PGconn *conn, const char *str, size_t len)
Definition: fe-exec.c:3519
int PQsendDescribePrepared(PGconn *conn, const char *stmt)
Definition: fe-exec.c:2150
int PQrequestCancel(PGconn *conn)
Definition: fe-connect.c:3931
const char * PQparameterStatus(const PGconn *conn, const char *paramName)
Definition: fe-connect.c:6062
int PQsendPrepare(PGconn *conn, const char *stmtName, const char *query, int nParams, const Oid *paramTypes)
Definition: fe-exec.c:1279
PQnoticeReceiver PQsetNoticeReceiver(PGconn *conn, PQnoticeReceiver proc, void *arg)
Definition: fe-connect.c:6256
char * PQhost(const PGconn *conn)
Definition: fe-connect.c:5998
int PQfnumber(const PGresult *res, const char *field_name)
Definition: fe-exec.c:2832
char * PQerrorMessage(const PGconn *conn)
Definition: fe-connect.c:6097
char * PQcmdStatus(PGresult *res)
Definition: fe-exec.c:2995
int PQsetSingleRowMode(PGconn *conn)
Definition: fe-exec.c:1655
char * caption
Definition: libpq-fe.h:187
char * pghost
Definition: pgbench.c:180
PGPing PQpingParams(const char *const *keywords, const char *const *values, int expand_dbname)
Definition: fe-connect.c:548
char * PQresStatus(ExecStatusType status)
Definition: fe-exec.c:2655
pqbool pager
Definition: libpq-fe.h:184
Oid lo_import_with_oid(PGconn *conn, const char *filename, Oid lobjId)
Definition: fe-lobj.c:683
void PQprintTuples(const PGresult *res, FILE *fout, int printAttName, int terseOutput, int width)
Definition: fe-print.c:676
int PQconsumeInput(PGconn *conn)
Definition: fe-exec.c:1682
char * PQresultErrorMessage(const PGresult *res)
Definition: fe-exec.c:2663
Oid PQftype(const PGresult *res, int field_num)
Definition: fe-exec.c:2962
PGContextVisibility
Definition: libpq-fe.h:117
int PQconnectionNeedsPassword(const PGconn *conn)
Definition: fe-connect.c:6131
struct pgNotify * next
Definition: libpq-fe.h:167
void * PQresultAlloc(PGresult *res, size_t nBytes)
Definition: fe-exec.c:511
PGVerbosity
Definition: libpq-fe.h:110
PostgresPollingStatusType PQresetPoll(PGconn *conn)
Definition: fe-connect.c:3704
int atttypmod
Definition: libpq-fe.h:243
unsigned char * PQunescapeBytea(const unsigned char *strtext, size_t *retbuflen)
Definition: fe-exec.c:3706
const char * PQsslAttribute(PGconn *conn, const char *attribute_name)
static char * encoding
Definition: initdb.c:123
struct pgresAttDesc PGresAttDesc
PGTransactionStatusType
Definition: libpq-fe.h:101
unsigned char * PQescapeBytea(const unsigned char *from, size_t from_length, size_t *to_length)
Definition: fe-exec.c:3681
PostgresPollingStatusType PQconnectPoll(PGconn *conn)
Definition: fe-connect.c:1997
Oid lo_import(PGconn *conn, const char *filename)
Definition: fe-lobj.c:668
struct _PQconninfoOption PQconninfoOption
int PQisBusy(PGconn *conn)
Definition: fe-exec.c:1732
int PQendcopy(PGconn *conn)
Definition: fe-exec.c:2573
WalTimeSample buffer[LAG_TRACKER_BUFFER_SIZE]
Definition: walsender.c:214
char ** fieldName
Definition: libpq-fe.h:188
pqbool expanded
Definition: libpq-fe.h:183
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:1262
int lo_unlink(PGconn *conn, Oid lobjId)
Definition: fe-lobj.c:628
int lo_truncate(PGconn *conn, int fd, size_t len)
Definition: fe-lobj.c:137
int PQgetisnull(const PGresult *res, int tup_num, int field_num)
Definition: fe-exec.c:3143
int lo_write(PGconn *conn, int fd, const char *buf, size_t len)
Definition: fe-lobj.c:312
static void do_init(void)
Definition: pg_ctl.c:758
PGresult * PQprepare(PGconn *conn, const char *stmtName, const char *query, int nParams, const Oid *paramTypes)
Definition: fe-exec.c:1941
PGresult * PQgetResult(PGconn *conn)
Definition: fe-exec.c:1753
int PQsetClientEncoding(PGconn *conn, const char *encoding)
Definition: fe-connect.c:6165
PGconn * PQconnectdb(const char *conninfo)
Definition: fe-connect.c:585
void PQfreemem(void *ptr)
Definition: fe-exec.c:3251
const char * name
Definition: encode.c:521
ConnStatusType PQstatus(const PGconn *conn)
Definition: fe-connect.c:6044
int PQcancel(PGcancel *cancel, char *errbuf, int errbufsize)
Definition: fe-connect.c:3906
int PQfsize(const PGresult *res, int field_num)
Definition: fe-exec.c:2973
pqbool html3
Definition: libpq-fe.h:182
char * PQfname(const PGresult *res, int field_num)
Definition: fe-exec.c:2810
char * tableOpt
Definition: libpq-fe.h:186
static Datum values[MAXATTR]
Definition: bootstrap.c:164
PostgresPollingStatusType
Definition: libpq-fe.h:72
void PQclear(PGresult *res)
Definition: fe-exec.c:671
static char * filename
Definition: pg_dumpall.c:90
char * PQoidStatus(const PGresult *res)
Definition: fe-exec.c:3008
static char * user
Definition: pg_regress.c:93
Oid PQoidValue(const PGresult *res)
Definition: fe-exec.c:3036
char * dbName
Definition: pgbench.c:183
int errmsg(const char *fmt,...)
Definition: elog.c:797
PQconninfoOption * PQconninfo(PGconn *conn)
Definition: fe-connect.c:5906
pqbool header
Definition: libpq-fe.h:179
int lo_truncate64(PGconn *conn, int fd, pg_int64 len)
Definition: fe-lobj.c:205
int PQdsplen(const char *s, int encoding)
Definition: fe-misc.c:1190
PGContextVisibility PQsetErrorContextVisibility(PGconn *conn, PGContextVisibility show_context)
Definition: fe-connect.c:6223
char * name
Definition: libpq-fe.h:237
PGresult * PQmakeEmptyPGresult(PGconn *conn, ExecStatusType status)
Definition: fe-exec.c:142
void * arg
char * PQencryptPasswordConn(PGconn *conn, const char *passwd, const char *user, const char *algorithm)
Definition: fe-auth.c:1140
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:1376
int PQsetResultAttrs(PGresult *res, int numAttributes, PGresAttDesc *attDescs)
Definition: fe-exec.c:228
size_t PQescapeStringConn(PGconn *conn, char *to, const char *from, size_t length, int *error)
Definition: fe-exec.c:3365
PGPing
Definition: libpq-fe.h:129
int PQputnbytes(PGconn *conn, const char *buffer, int nbytes)
Definition: fe-exec.c:2550
int isint
Definition: libpq-fe.h:223
void PQdisplayTuples(const PGresult *res, FILE *fp, int fillAlign, const char *fieldSep, int printHeader, int quiet)
Definition: fe-print.c:578
int PQserverVersion(const PGconn *conn)
Definition: fe-connect.c:6087
int PQenv2encoding(void)
Definition: fe-misc.c:1199
static void static void status(const char *fmt,...) pg_attribute_printf(1
Definition: pg_regress.c:225
int PQbackendPID(const PGconn *conn)
Definition: fe-connect.c:6123
int PQflush(PGconn *conn)
Definition: fe-exec.c:3238
struct pgNotify PGnotify
char pqbool
Definition: libpq-fe.h:175
struct _PQprintOpt PQprintOpt
Oid PQparamtype(const PGresult *res, int param_num)
Definition: fe-exec.c:3168
PGresult * PQdescribePortal(PGconn *conn, const char *portal)
Definition: fe-exec.c:2133
char * pgport
Definition: pgbench.c:181
int pg_char_to_encoding(const char *name)
Definition: encnames.c:551
int * ptr
Definition: libpq-fe.h:226
char * login
Definition: pgbench.c:182
int integer
Definition: libpq-fe.h:227
pg_int64 lo_lseek64(PGconn *conn, int fd, pg_int64 offset, int whence)
Definition: fe-lobj.c:409
int PQsendQuery(PGconn *conn, const char *query)
Definition: fe-exec.c:1183
PGnotify * PQnotifies(PGconn *conn)
Definition: fe-exec.c:2244
PGresult * PQdescribePrepared(PGconn *conn, const char *stmt)
Definition: fe-exec.c:2114