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