|
|
| version 1.2, 2007/01/26 10:08:55 | version 1.3, 2007/10/25 17:05:43 |
|---|---|
| Line 4 | Line 4 |
| * This file contains definitions for structures and | * This file contains definitions for structures and |
| * externs for functions used by frontend postgres applications. | * externs for functions used by frontend postgres applications. |
| * | * |
| * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group | * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group |
| * Portions Copyright (c) 1994, Regents of the University of California | * Portions Copyright (c) 1994, Regents of the University of California |
| * | * |
| * $Id$ | * $PostgreSQL: pgsql/src/interfaces/libpq/libpq-fe.h,v 1.134 2006/10/04 00:30:13 momjian Exp $ |
| * | * |
| *------------------------------------------------------------------------- | *------------------------------------------------------------------------- |
| */ | */ |
| Line 28 extern "C" | Line 28 extern "C" |
| */ | */ |
| #include "postgres_ext.h" | #include "postgres_ext.h" |
| /* SSL type is needed here only to declare PQgetssl() */ | |
| #ifdef USE_SSL | |
| #include <openssl/ssl.h> | |
| #endif | |
| /* Application-visible enum types */ | /* Application-visible enum types */ |
| typedef enum | typedef enum |
| { | { |
| /* | /* |
| * Although it is okay to add to this list, values which become unused | * Although it is okay to add to this list, values which become unused |
| * should never be removed, nor should constants be redefined - that | * should never be removed, nor should constants be redefined - that would |
| * would break compatibility with existing code. | * break compatibility with existing code. |
| */ | */ |
| CONNECTION_OK, | CONNECTION_OK, |
| CONNECTION_BAD, | CONNECTION_BAD, |
| /* Non-blocking mode only below here */ | /* Non-blocking mode only below here */ |
| /* | /* |
| * The existence of these should never be relied upon - they should | * The existence of these should never be relied upon - they should only |
| * only be used for user feedback or similar purposes. | * be used for user feedback or similar purposes. |
| */ | */ |
| CONNECTION_STARTED, /* Waiting for connection to be made. */ | CONNECTION_STARTED, /* Waiting for connection to be made. */ |
| CONNECTION_MADE, /* Connection OK; waiting to send. */ | CONNECTION_MADE, /* Connection OK; waiting to send. */ |
| Line 78 typedef enum | Line 73 typedef enum |
| * anything was executed properly by the | * anything was executed properly by the |
| * backend */ | * backend */ |
| PGRES_TUPLES_OK, /* a query command that returns tuples was | PGRES_TUPLES_OK, /* a query command that returns tuples was |
| * executed properly by the backend, | * executed properly by the backend, PGresult |
| * PGresult contains the result tuples */ | * contains the result tuples */ |
| PGRES_COPY_OUT, /* Copy Out data transfer in progress */ | PGRES_COPY_OUT, /* Copy Out data transfer in progress */ |
| PGRES_COPY_IN, /* Copy In data transfer in progress */ | PGRES_COPY_IN, /* Copy In data transfer in progress */ |
| PGRES_BAD_RESPONSE, /* an unexpected response was recv'd from | PGRES_BAD_RESPONSE, /* an unexpected response was recv'd from the |
| * the backend */ | * backend */ |
| PGRES_NONFATAL_ERROR, /* notice or warning message */ | PGRES_NONFATAL_ERROR, /* notice or warning message */ |
| PGRES_FATAL_ERROR /* query failed */ | PGRES_FATAL_ERROR /* query failed */ |
| } ExecStatusType; | } ExecStatusType; |
| Line 131 typedef struct pg_cancel PGcancel; | Line 126 typedef struct pg_cancel PGcancel; |
| typedef struct pgNotify | typedef struct pgNotify |
| { | { |
| char *relname; /* notification condition name */ | char *relname; /* notification condition name */ |
| int be_pid; /* process ID of server process */ | int be_pid; /* process ID of notifying server process */ |
| char *extra; /* notification parameter */ | char *extra; /* notification parameter */ |
| /* Fields below here are private to libpq; apps should not use 'em */ | /* Fields below here are private to libpq; apps should not use 'em */ |
| struct pgNotify *next; /* list link */ | struct pgNotify *next; /* list link */ |
| Line 146 typedef char pqbool; | Line 141 typedef char pqbool; |
| typedef struct _PQprintOpt | typedef struct _PQprintOpt |
| { | { |
| pqbool header; /* print output field headings and row | pqbool header; /* print output field headings and row count */ |
| * count */ | |
| pqbool align; /* fill align the fields */ | pqbool align; /* fill align the fields */ |
| pqbool standard; /* old brain dead format */ | pqbool standard; /* old brain dead format */ |
| pqbool html3; /* output html tables */ | pqbool html3; /* output html tables */ |
| Line 156 typedef struct _PQprintOpt | Line 150 typedef struct _PQprintOpt |
| char *fieldSep; /* field separator */ | char *fieldSep; /* field separator */ |
| char *tableOpt; /* insert to HTML <table ...> */ | char *tableOpt; /* insert to HTML <table ...> */ |
| char *caption; /* HTML <caption> */ | char *caption; /* HTML <caption> */ |
| char **fieldName; /* null terminated array of repalcement | char **fieldName; /* null terminated array of replacement field |
| * field names */ | * names */ |
| } PQprintOpt; | } PQprintOpt; |
| /* ---------------- | /* ---------------- |
| Line 175 typedef struct _PQconninfoOption | Line 169 typedef struct _PQconninfoOption |
| char *compiled; /* Fallback compiled in default value */ | char *compiled; /* Fallback compiled in default value */ |
| char *val; /* Option's current value, or NULL */ | char *val; /* Option's current value, or NULL */ |
| char *label; /* Label for field in connect dialog */ | char *label; /* Label for field in connect dialog */ |
| char *dispchar; /* Character to display for this field in | char *dispchar; /* Character to display for this field in a |
| * a connect dialog. Values are: "" | * connect dialog. Values are: "" Display |
| * Display entered value as is "*" | * entered value as is "*" Password field - |
| * Password field - hide value "D" Debug | * hide value "D" Debug option - don't show |
| * option - don't show by default */ | * by default */ |
| int dispsize; /* Field size in characters for dialog */ | int dispsize; /* Field size in characters for dialog */ |
| } PQconninfoOption; | } PQconninfoOption; |
| Line 272 extern int PQbackendPID(const PGconn *co | Line 266 extern int PQbackendPID(const PGconn *co |
| extern int PQclientEncoding(const PGconn *conn); | extern int PQclientEncoding(const PGconn *conn); |
| extern int PQsetClientEncoding(PGconn *conn, const char *encoding); | extern int PQsetClientEncoding(PGconn *conn, const char *encoding); |
| #ifdef USE_SSL | /* Get the OpenSSL structure associated with a connection. Returns NULL for |
| /* Get the SSL structure associated with a connection */ | * unencrypted connections or if any other TLS library is in use. */ |
| extern SSL *PQgetssl(PGconn *conn); | |
| #else | |
| extern void *PQgetssl(PGconn *conn); | extern void *PQgetssl(PGconn *conn); |
| #endif | |
| /* Tell libpq whether it needs to initialize OpenSSL */ | /* Tell libpq whether it needs to initialize OpenSSL */ |
| extern void PQinitSSL(int do_init); | extern void PQinitSSL(int do_init); |
| Line 321 extern PGresult *PQexecParams(PGconn *co | Line 312 extern PGresult *PQexecParams(PGconn *co |
| const int *paramFormats, | const int *paramFormats, |
| int resultFormat); | int resultFormat); |
| extern PGresult *PQprepare(PGconn *conn, const char *stmtName, | extern PGresult *PQprepare(PGconn *conn, const char *stmtName, |
| const char *query, int nParams, | const char *query, int nParams, |
| const Oid *paramTypes); | const Oid *paramTypes); |
| extern PGresult *PQexecPrepared(PGconn *conn, | extern PGresult *PQexecPrepared(PGconn *conn, |
| const char *stmtName, | const char *stmtName, |
| int nParams, | int nParams, |
| Line 342 extern int PQsendQueryParams(PGconn *con | Line 333 extern int PQsendQueryParams(PGconn *con |
| const int *paramFormats, | const int *paramFormats, |
| int resultFormat); | int resultFormat); |
| extern int PQsendPrepare(PGconn *conn, const char *stmtName, | extern int PQsendPrepare(PGconn *conn, const char *stmtName, |
| const char *query, int nParams, | const char *query, int nParams, |
| const Oid *paramTypes); | const Oid *paramTypes); |
| extern int PQsendQueryPrepared(PGconn *conn, | extern int PQsendQueryPrepared(PGconn *conn, |
| const char *stmtName, | const char *stmtName, |
| int nParams, | int nParams, |
| Line 375 extern int PQendcopy(PGconn *conn); | Line 366 extern int PQendcopy(PGconn *conn); |
| /* Set blocking/nonblocking connection to the backend */ | /* Set blocking/nonblocking connection to the backend */ |
| extern int PQsetnonblocking(PGconn *conn, int arg); | extern int PQsetnonblocking(PGconn *conn, int arg); |
| extern int PQisnonblocking(const PGconn *conn); | extern int PQisnonblocking(const PGconn *conn); |
| extern int PQisthreadsafe(void); | |
| /* Force the write buffer to be written (or at least try) */ | /* Force the write buffer to be written (or at least try) */ |
| extern int PQflush(PGconn *conn); | extern int PQflush(PGconn *conn); |
| Line 414 extern char *PQcmdTuples(PGresult *res); | Line 406 extern char *PQcmdTuples(PGresult *res); |
| extern char *PQgetvalue(const PGresult *res, int tup_num, int field_num); | extern char *PQgetvalue(const PGresult *res, int tup_num, int field_num); |
| extern int PQgetlength(const PGresult *res, int tup_num, int field_num); | extern int PQgetlength(const PGresult *res, int tup_num, int field_num); |
| extern int PQgetisnull(const PGresult *res, int tup_num, int field_num); | extern int PQgetisnull(const PGresult *res, int tup_num, int field_num); |
| extern int PQnparams(const PGresult *res); | |
| extern Oid PQparamtype(const PGresult *res, int param_num); | |
| /* Describe prepared statements and portals */ | |
| extern PGresult *PQdescribePrepared(PGconn *conn, const char *stmt); | |
| extern PGresult *PQdescribePortal(PGconn *conn, const char *portal); | |
| extern int PQsendDescribePrepared(PGconn *conn, const char *stmt); | |
| extern int PQsendDescribePortal(PGconn *conn, const char *portal); | |
| /* Delete a PGresult */ | /* Delete a PGresult */ |
| extern void PQclear(PGresult *res); | extern void PQclear(PGresult *res); |
| Line 437 extern PGresult *PQmakeEmptyPGresult(PGc | Line 437 extern PGresult *PQmakeEmptyPGresult(PGc |
| /* Quoting strings before inclusion in queries. */ | /* Quoting strings before inclusion in queries. */ |
| extern size_t PQescapeStringConn(PGconn *conn, | extern size_t PQescapeStringConn(PGconn *conn, |
| char *to, const char *from, size_t length, | char *to, const char *from, size_t length, |
| int *error); | int *error); |
| extern unsigned char *PQescapeByteaConn(PGconn *conn, | extern unsigned char *PQescapeByteaConn(PGconn *conn, |
| const unsigned char *from, size_t from_length, | const unsigned char *from, size_t from_length, |
| size_t *to_length); | size_t *to_length); |
| extern unsigned char *PQunescapeBytea(const unsigned char *strtext, | extern unsigned char *PQunescapeBytea(const unsigned char *strtext, |
| size_t *retbuflen); | size_t *retbuflen); |
| /* These forms are deprecated! */ | /* These forms are deprecated! */ |
| extern size_t PQescapeString(char *to, const char *from, size_t length); | extern size_t PQescapeString(char *to, const char *from, size_t length); |
| extern unsigned char *PQescapeBytea(const unsigned char *from, size_t from_length, | extern unsigned char *PQescapeBytea(const unsigned char *from, size_t from_length, |
| Line 474 PQprintTuples(const PGresult *res, | Line 475 PQprintTuples(const PGresult *res, |
| FILE *fout, /* output stream */ | FILE *fout, /* output stream */ |
| int printAttName, /* print attribute names */ | int printAttName, /* print attribute names */ |
| int terseOutput, /* delimiter bars */ | int terseOutput, /* delimiter bars */ |
| int width); /* width of column, if 0, use variable | int width); /* width of column, if 0, use variable width */ |
| * width */ | |
| /* === in fe-lobj.c === */ | /* === in fe-lobj.c === */ |
| Line 484 PQprintTuples(const PGresult *res, | Line 484 PQprintTuples(const PGresult *res, |
| extern int lo_open(PGconn *conn, Oid lobjId, int mode); | extern int lo_open(PGconn *conn, Oid lobjId, int mode); |
| extern int lo_close(PGconn *conn, int fd); | extern int lo_close(PGconn *conn, int fd); |
| extern int lo_read(PGconn *conn, int fd, char *buf, size_t len); | extern int lo_read(PGconn *conn, int fd, char *buf, size_t len); |
| extern int lo_write(PGconn *conn, int fd, char *buf, size_t len); | extern int lo_write(PGconn *conn, int fd, const char *buf, size_t len); |
| extern int lo_lseek(PGconn *conn, int fd, int offset, int whence); | extern int lo_lseek(PGconn *conn, int fd, int offset, int whence); |
| extern Oid lo_creat(PGconn *conn, int mode); | extern Oid lo_creat(PGconn *conn, int mode); |
| extern Oid lo_create(PGconn *conn, Oid lobjId); | |
| extern int lo_tell(PGconn *conn, int fd); | extern int lo_tell(PGconn *conn, int fd); |
| extern int lo_unlink(PGconn *conn, Oid lobjId); | extern int lo_unlink(PGconn *conn, Oid lobjId); |
| extern Oid lo_import(PGconn *conn, const char *filename); | extern Oid lo_import(PGconn *conn, const char *filename); |
| Line 495 extern int lo_export(PGconn *conn, Oid l | Line 496 extern int lo_export(PGconn *conn, Oid l |
| /* === in fe-misc.c === */ | /* === in fe-misc.c === */ |
| /* Determine length of multibyte encoded char at *s */ | /* Determine length of multibyte encoded char at *s */ |
| extern int PQmblen(const unsigned char *s, int encoding); | extern int PQmblen(const char *s, int encoding); |
| /* Determine display length of multibyte encoded char at *s */ | /* Determine display length of multibyte encoded char at *s */ |
| extern int PQdsplen(const unsigned char *s, int encoding); | extern int PQdsplen(const char *s, int encoding); |
| /* Get encoding id from environment variable PGCLIENTENCODING */ | /* Get encoding id from environment variable PGCLIENTENCODING */ |
| extern int PQenv2encoding(void); | extern int PQenv2encoding(void); |
| /* === in fe-auth.c === */ | |
| extern char *PQencryptPassword(const char *passwd, const char *user); | |
| #ifdef __cplusplus | #ifdef __cplusplus |
| } | } |
| #endif | #endif |