Commit c42d3b3c authored by Tom Lane's avatar Tom Lane

Windows portability macros SOCK_ERRNO and SOCK_STRERROR should be in

libpq-int.h, not cluttering application namespace in libpq-fe.h.
parent 9685afb0
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2001, 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: libpq-fe.h,v 1.77 2001/10/28 06:26:12 momjian Exp $ * $Id: libpq-fe.h,v 1.78 2001/11/02 20:51:27 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -22,88 +22,81 @@ extern "C" ...@@ -22,88 +22,81 @@ extern "C"
#include <stdio.h> #include <stdio.h>
#ifdef WIN32 /*
#define SOCK_ERRNO (WSAGetLastError ()) * postgres_ext.h defines the backend's externally visible types,
#define SOCK_STRERROR winsock_strerror
#else
#define SOCK_ERRNO errno
#define SOCK_STRERROR strerror
#endif
/* postgres_ext.h defines the backend's externally visible types,
* such as Oid. * such as Oid.
*/ */
#include "postgres_ext.h" #include "postgres_ext.h"
/* SSL type is needed here only to declare PQgetssl() */
#ifdef USE_SSL #ifdef USE_SSL
#include <openssl/ssl.h> #include <openssl/ssl.h>
#endif #endif
/* Application-visible enum types */ /* Application-visible enum types */
typedef enum typedef enum
{ {
/* /*
* Although you may decide to change this list in some way, values * Although you may decide to change this list in some way, values
* which become unused should never be removed, nor should * which become unused should never be removed, nor should
* constants be redefined - that would break compatibility with * constants be redefined - that would break compatibility with
* existing code. * 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 * The existence of these should never be relied upon - they
* should only be used for user feedback or similar purposes. * should only 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. */
CONNECTION_AWAITING_RESPONSE, /* Waiting for a response from the CONNECTION_AWAITING_RESPONSE, /* Waiting for a response from the
* postmaster. */ * postmaster. */
CONNECTION_AUTH_OK, /* Received authentication; waiting for CONNECTION_AUTH_OK, /* Received authentication; waiting for
* backend startup. */ * backend startup. */
CONNECTION_SETENV /* Negotiating environment. */ CONNECTION_SETENV /* Negotiating environment. */
} ConnStatusType; } ConnStatusType;
typedef enum typedef enum
{ {
PGRES_POLLING_FAILED = 0, PGRES_POLLING_FAILED = 0,
PGRES_POLLING_READING, /* These two indicate that one may */ PGRES_POLLING_READING, /* These two indicate that one may */
PGRES_POLLING_WRITING, /* use select before polling again. */ PGRES_POLLING_WRITING, /* use select before polling again. */
PGRES_POLLING_OK, PGRES_POLLING_OK,
PGRES_POLLING_ACTIVE /* Can call poll function immediately. */ PGRES_POLLING_ACTIVE /* Can call poll function immediately. */
} PostgresPollingStatusType; } PostgresPollingStatusType;
typedef enum typedef enum
{ {
PGRES_EMPTY_QUERY = 0, PGRES_EMPTY_QUERY = 0,
PGRES_COMMAND_OK, /* a query command that doesn't return PGRES_COMMAND_OK, /* a query command that doesn't return
* 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 contains the result tuples */ * PGresult 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 backend */ * the backend */
PGRES_NONFATAL_ERROR, PGRES_NONFATAL_ERROR,
PGRES_FATAL_ERROR PGRES_FATAL_ERROR
} ExecStatusType; } ExecStatusType;
/* PGconn encapsulates a connection to the backend. /* PGconn encapsulates a connection to the backend.
* The contents of this struct are not supposed to be known to applications. * The contents of this struct are not supposed to be known to applications.
*/ */
typedef struct pg_conn PGconn; typedef struct pg_conn PGconn;
/* PGresult encapsulates the result of a query (or more precisely, of a single /* PGresult encapsulates the result of a query (or more precisely, of a single
* SQL command --- a query string given to PQsendQuery can contain multiple * SQL command --- a query string given to PQsendQuery can contain multiple
* commands and thus return multiple PGresult objects). * commands and thus return multiple PGresult objects).
* The contents of this struct are not supposed to be known to applications. * The contents of this struct are not supposed to be known to applications.
*/ */
typedef struct pg_result PGresult; typedef struct pg_result PGresult;
/* PGnotify represents the occurrence of a NOTIFY message. /* PGnotify represents the occurrence of a NOTIFY message.
* Ideally this would be an opaque typedef, but it's so simple that it's * Ideally this would be an opaque typedef, but it's so simple that it's
...@@ -111,35 +104,35 @@ extern "C" ...@@ -111,35 +104,35 @@ extern "C"
* NOTE: in Postgres 6.4 and later, the be_pid is the notifying backend's, * NOTE: in Postgres 6.4 and later, the be_pid is the notifying backend's,
* whereas in earlier versions it was always your own backend's PID. * whereas in earlier versions it was always your own backend's PID.
*/ */
typedef struct pgNotify typedef struct pgNotify
{ {
char relname[NAMEDATALEN]; /* name of relation char relname[NAMEDATALEN]; /* name of relation
* containing data */ * containing data */
int be_pid; /* process id of backend */ int be_pid; /* process id of backend */
} PGnotify; } PGnotify;
/* PQnoticeProcessor is the function type for the notice-message callback. /* PQnoticeProcessor is the function type for the notice-message callback.
*/ */
typedef void (*PQnoticeProcessor) (void *arg, const char *message); typedef void (*PQnoticeProcessor) (void *arg, const char *message);
/* Print options for PQprint() */ /* Print options for PQprint() */
typedef char pqbool; 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 */
pqbool expanded; /* expand tables */ pqbool expanded; /* expand tables */
pqbool pager; /* use pager for output if needed */ pqbool pager; /* use pager for output if needed */
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 repalcement
* field names */ * field names */
} PQprintOpt; } PQprintOpt;
/* ---------------- /* ----------------
* Structure for the conninfo parameter definitions returned by PQconndefaults * Structure for the conninfo parameter definitions returned by PQconndefaults
...@@ -149,35 +142,35 @@ extern "C" ...@@ -149,35 +142,35 @@ extern "C"
* will release both the val strings and the PQconninfoOption array itself. * will release both the val strings and the PQconninfoOption array itself.
* ---------------- * ----------------
*/ */
typedef struct _PQconninfoOption typedef struct _PQconninfoOption
{ {
char *keyword; /* The keyword of the option */ char *keyword; /* The keyword of the option */
char *envvar; /* Fallback environment variable name */ char *envvar; /* Fallback environment variable name */
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 connect dialog. Values are: "" * a connect dialog. Values are: ""
* Display entered value as is "*" * Display entered value as is "*"
* Password field - hide value "D" Debug * Password field - hide value "D" Debug
* option - don't show by default */ * option - don't show by default */
int dispsize; /* Field size in characters for dialog */ int dispsize; /* Field size in characters for dialog */
} PQconninfoOption; } PQconninfoOption;
/* ---------------- /* ----------------
* PQArgBlock -- structure for PQfn() arguments * PQArgBlock -- structure for PQfn() arguments
* ---------------- * ----------------
*/ */
typedef struct typedef struct
{
int len;
int isint;
union
{ {
int len; int *ptr; /* can't use void (dec compiler barfs) */
int isint; int integer;
union } u;
{ } PQArgBlock;
int *ptr; /* can't use void (dec compiler barfs) */
int integer;
} u;
} PQArgBlock;
/* ---------------- /* ----------------
* Exported functions of libpq * Exported functions of libpq
...@@ -186,194 +179,196 @@ extern "C" ...@@ -186,194 +179,196 @@ extern "C"
/* === in fe-connect.c === */ /* === in fe-connect.c === */
/* make a new client connection to the backend */ /* make a new client connection to the backend */
/* Asynchronous (non-blocking) */ /* Asynchronous (non-blocking) */
extern PGconn *PQconnectStart(const char *conninfo); extern PGconn *PQconnectStart(const char *conninfo);
extern PostgresPollingStatusType PQconnectPoll(PGconn *conn); extern PostgresPollingStatusType PQconnectPoll(PGconn *conn);
/* Synchronous (blocking) */ /* Synchronous (blocking) */
extern PGconn *PQconnectdb(const char *conninfo); extern PGconn *PQconnectdb(const char *conninfo);
extern PGconn *PQsetdbLogin(const char *pghost, const char *pgport, extern PGconn *PQsetdbLogin(const char *pghost, const char *pgport,
const char *pgoptions, const char *pgtty, const char *pgoptions, const char *pgtty,
const char *dbName, const char *dbName,
const char *login, const char *pwd); const char *login, const char *pwd);
#define PQsetdb(M_PGHOST,M_PGPORT,M_PGOPT,M_PGTTY,M_DBNAME) \ #define PQsetdb(M_PGHOST,M_PGPORT,M_PGOPT,M_PGTTY,M_DBNAME) \
PQsetdbLogin(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME, NULL, NULL) PQsetdbLogin(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME, NULL, NULL)
/* close the current connection and free the PGconn data structure */ /* close the current connection and free the PGconn data structure */
extern void PQfinish(PGconn *conn); extern void PQfinish(PGconn *conn);
/* get info about connection options known to PQconnectdb */ /* get info about connection options known to PQconnectdb */
extern PQconninfoOption *PQconndefaults(void); extern PQconninfoOption *PQconndefaults(void);
/* free the data structure returned by PQconndefaults() */ /* free the data structure returned by PQconndefaults() */
extern void PQconninfoFree(PQconninfoOption *connOptions); extern void PQconninfoFree(PQconninfoOption *connOptions);
/* /*
* close the current connection and restablish a new one with the same * close the current connection and restablish a new one with the same
* parameters * parameters
*/ */
/* Asynchronous (non-blocking) */ /* Asynchronous (non-blocking) */
extern int PQresetStart(PGconn *conn); extern int PQresetStart(PGconn *conn);
extern PostgresPollingStatusType PQresetPoll(PGconn *conn); extern PostgresPollingStatusType PQresetPoll(PGconn *conn);
/* Synchronous (blocking) */ /* Synchronous (blocking) */
extern void PQreset(PGconn *conn); extern void PQreset(PGconn *conn);
/* issue a cancel request */ /* issue a cancel request */
extern int PQrequestCancel(PGconn *conn); extern int PQrequestCancel(PGconn *conn);
/* Accessor functions for PGconn objects */ /* Accessor functions for PGconn objects */
extern char *PQdb(const PGconn *conn); extern char *PQdb(const PGconn *conn);
extern char *PQuser(const PGconn *conn); extern char *PQuser(const PGconn *conn);
extern char *PQpass(const PGconn *conn); extern char *PQpass(const PGconn *conn);
extern char *PQhost(const PGconn *conn); extern char *PQhost(const PGconn *conn);
extern char *PQport(const PGconn *conn); extern char *PQport(const PGconn *conn);
extern char *PQtty(const PGconn *conn); extern char *PQtty(const PGconn *conn);
extern char *PQoptions(const PGconn *conn); extern char *PQoptions(const PGconn *conn);
extern ConnStatusType PQstatus(const PGconn *conn); extern ConnStatusType PQstatus(const PGconn *conn);
extern char *PQerrorMessage(const PGconn *conn); extern char *PQerrorMessage(const PGconn *conn);
extern int PQsocket(const PGconn *conn); extern int PQsocket(const PGconn *conn);
extern int PQbackendPID(const PGconn *conn); extern int PQbackendPID(const PGconn *conn);
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 #ifdef USE_SSL
/* Get the SSL structure associated with a connection */ /* Get the SSL structure associated with a connection */
extern SSL *PQgetssl(PGconn *conn); extern SSL *PQgetssl(PGconn *conn);
#endif #endif
/* Enable/disable tracing */ /* Enable/disable tracing */
extern void PQtrace(PGconn *conn, FILE *debug_port); extern void PQtrace(PGconn *conn, FILE *debug_port);
extern void PQuntrace(PGconn *conn); extern void PQuntrace(PGconn *conn);
/* Override default notice processor */ /* Override default notice processor */
extern PQnoticeProcessor PQsetNoticeProcessor(PGconn *conn, PQnoticeProcessor proc, void *arg); extern PQnoticeProcessor PQsetNoticeProcessor(PGconn *conn,
PQnoticeProcessor proc,
void *arg);
/* === in fe-exec.c === */ /* === in fe-exec.c === */
/* Quoting strings before inclusion in queries. */ /* Quoting strings before inclusion in queries. */
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(unsigned char *bintext, size_t binlen, size_t *bytealen); extern unsigned char *PQescapeBytea(unsigned char *bintext, size_t binlen,
size_t *bytealen);
/* Simple synchronous query */
extern PGresult *PQexec(PGconn *conn, const char *query); /* Simple synchronous query */
extern PGnotify *PQnotifies(PGconn *conn); extern PGresult *PQexec(PGconn *conn, const char *query);
extern void PQfreeNotify(PGnotify *notify); extern PGnotify *PQnotifies(PGconn *conn);
extern void PQfreeNotify(PGnotify *notify);
/* Interface for multiple-result or asynchronous queries */
extern int PQsendQuery(PGconn *conn, const char *query); /* Interface for multiple-result or asynchronous queries */
extern PGresult *PQgetResult(PGconn *conn); extern int PQsendQuery(PGconn *conn, const char *query);
extern PGresult *PQgetResult(PGconn *conn);
/* Routines for managing an asychronous query */
extern int PQisBusy(PGconn *conn); /* Routines for managing an asychronous query */
extern int PQconsumeInput(PGconn *conn); extern int PQisBusy(PGconn *conn);
extern int PQconsumeInput(PGconn *conn);
/* Routines for copy in/out */
extern int PQgetline(PGconn *conn, char *string, int length); /* Routines for copy in/out */
extern int PQputline(PGconn *conn, const char *string); extern int PQgetline(PGconn *conn, char *string, int length);
extern int PQgetlineAsync(PGconn *conn, char *buffer, int bufsize); extern int PQputline(PGconn *conn, const char *string);
extern int PQputnbytes(PGconn *conn, const char *buffer, int nbytes); extern int PQgetlineAsync(PGconn *conn, char *buffer, int bufsize);
extern int PQendcopy(PGconn *conn); extern int PQputnbytes(PGconn *conn, const char *buffer, int nbytes);
extern int PQendcopy(PGconn *conn);
/* Set blocking/nonblocking connection to the backend */
extern int PQsetnonblocking(PGconn *conn, int arg); /* Set blocking/nonblocking connection to the backend */
extern int PQisnonblocking(const PGconn *conn); extern int PQsetnonblocking(PGconn *conn, int arg);
extern int PQisnonblocking(const PGconn *conn);
/* Force the write buffer to be written (or at least try) */
extern int PQflush(PGconn *conn); /* Force the write buffer to be written (or at least try) */
extern int PQflush(PGconn *conn);
/*
* "Fast path" interface --- not really recommended for application /*
* use * "Fast path" interface --- not really recommended for application
*/ * use
extern PGresult *PQfn(PGconn *conn, */
int fnid, extern PGresult *PQfn(PGconn *conn,
int *result_buf, int fnid,
int *result_len, int *result_buf,
int result_is_int, int *result_len,
const PQArgBlock *args, int result_is_int,
int nargs); const PQArgBlock *args,
int nargs);
/* Accessor functions for PGresult objects */
extern ExecStatusType PQresultStatus(const PGresult *res); /* Accessor functions for PGresult objects */
extern char *PQresStatus(ExecStatusType status); extern ExecStatusType PQresultStatus(const PGresult *res);
extern char *PQresultErrorMessage(const PGresult *res); extern char *PQresStatus(ExecStatusType status);
extern int PQntuples(const PGresult *res); extern char *PQresultErrorMessage(const PGresult *res);
extern int PQnfields(const PGresult *res); extern int PQntuples(const PGresult *res);
extern int PQbinaryTuples(const PGresult *res); extern int PQnfields(const PGresult *res);
extern char *PQfname(const PGresult *res, int field_num); extern int PQbinaryTuples(const PGresult *res);
extern int PQfnumber(const PGresult *res, const char *field_name); extern char *PQfname(const PGresult *res, int field_num);
extern Oid PQftype(const PGresult *res, int field_num); extern int PQfnumber(const PGresult *res, const char *field_name);
extern int PQfsize(const PGresult *res, int field_num); extern Oid PQftype(const PGresult *res, int field_num);
extern int PQfmod(const PGresult *res, int field_num); extern int PQfsize(const PGresult *res, int field_num);
extern char *PQcmdStatus(PGresult *res); extern int PQfmod(const PGresult *res, int field_num);
extern char *PQoidStatus(const PGresult *res); /* old and ugly */ extern char *PQcmdStatus(PGresult *res);
extern Oid PQoidValue(const PGresult *res); /* new and improved */ extern char *PQoidStatus(const PGresult *res); /* old and ugly */
extern char *PQcmdTuples(PGresult *res); extern Oid PQoidValue(const PGresult *res); /* new and improved */
extern char *PQgetvalue(const PGresult *res, int tup_num, int field_num); extern char *PQcmdTuples(PGresult *res);
extern int PQgetlength(const PGresult *res, int tup_num, int field_num); extern char *PQgetvalue(const PGresult *res, int tup_num, int field_num);
extern int PQgetisnull(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);
/* Delete a PGresult */
extern void PQclear(PGresult *res); /* Delete a PGresult */
extern void PQclear(PGresult *res);
/*
* Make an empty PGresult with given status (some apps find this /*
* useful). If conn is not NULL and status indicates an error, the * Make an empty PGresult with given status (some apps find this
* conn's errorMessage is copied. * useful). If conn is not NULL and status indicates an error, the
*/ * conn's errorMessage is copied.
extern PGresult *PQmakeEmptyPGresult(PGconn *conn, ExecStatusType status); */
extern PGresult *PQmakeEmptyPGresult(PGconn *conn, ExecStatusType status);
/* === in fe-print.c === */ /* === in fe-print.c === */
extern void PQprint(FILE *fout, /* output stream */ extern void PQprint(FILE *fout, /* output stream */
const PGresult *res, const PGresult *res,
const PQprintOpt *ps); /* option structure */ const PQprintOpt *ps); /* option structure */
/* /*
* really old printing routines * really old printing routines
*/ */
extern void PQdisplayTuples(const PGresult *res, extern void PQdisplayTuples(const PGresult *res,
FILE *fp, /* where to send the FILE *fp, /* where to send the output */
* output */ int fillAlign, /* pad the fields with
int fillAlign, /* pad the fields with * spaces */
* spaces */ const char *fieldSep, /* field separator */
const char *fieldSep, /* field separator */ int printHeader, /* display headers? */
int printHeader, /* display headers? */ int quiet);
int quiet);
extern void PQprintTuples(const PGresult *res,
extern void 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
int width); /* width of column, if * 0, use variable width */
* 0, use variable width */
/* === in fe-lobj.c === */ /* === in fe-lobj.c === */
/* Large-object access routines */ /* Large-object access routines */
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, 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 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);
extern int lo_export(PGconn *conn, Oid lobjId, const char *filename); extern int lo_export(PGconn *conn, Oid lobjId, const char *filename);
/* === 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 unsigned 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);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2001, 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: libpq-int.h,v 1.42 2001/10/28 06:26:12 momjian Exp $ * $Id: libpq-int.h,v 1.43 2001/11/02 20:51:27 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -353,4 +353,16 @@ __attribute__((format_arg(1))); ...@@ -353,4 +353,16 @@ __attribute__((format_arg(1)));
#define libpq_gettext(x) (x) #define libpq_gettext(x) (x)
#endif #endif
/*
* These macros are needed to let error-handling code be portable between
* Unix and Windows. (ugh)
*/
#ifdef WIN32
#define SOCK_ERRNO (WSAGetLastError())
#define SOCK_STRERROR winsock_strerror
#else
#define SOCK_ERRNO errno
#define SOCK_STRERROR strerror
#endif
#endif /* LIBPQ_INT_H */ #endif /* LIBPQ_INT_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment