|
| 1 | +/*------------------------------------------------------------------------- |
| 2 | + * |
| 3 | + * libpq-int.h-- |
| 4 | + * This file contains internal definitions meant to be used only by |
| 5 | + * the frontend libpq library, not by applications that call it. |
| 6 | + * |
| 7 | + * Copyright (c) 1994, Regents of the University of California |
| 8 | + * |
| 9 | + * $Id: libpq-int.h,v 1.1 1998/08/17 03:52:36 scrappy Exp $ |
| 10 | + * |
| 11 | + *------------------------------------------------------------------------- |
| 12 | + */ |
| 13 | + |
| 14 | +#ifndef LIBPQ_INT_H |
| 15 | +#define LIBPQ_INT_H |
| 16 | + |
| 17 | +/* We assume libpq-fe.h has already been included. */ |
| 18 | + |
| 19 | +/* ---------------- |
| 20 | + * include stuff common to fe and be |
| 21 | + * ---------------- |
| 22 | + */ |
| 23 | +#include "libpq/pqcomm.h" |
| 24 | + |
| 25 | +/* libpq supports this version of the frontend/backend protocol. |
| 26 | + * |
| 27 | + * NB: we used to use PG_PROTOCOL_LATEST from the backend pqcomm.h file, |
| 28 | + * but that's not really the right thing: just recompiling libpq |
| 29 | + * against a more recent backend isn't going to magically update it |
| 30 | + * for most sorts of protocol changes. So, when you change libpq |
| 31 | + * to support a different protocol revision, you have to change this |
| 32 | + * constant too. PG_PROTOCOL_EARLIEST and PG_PROTOCOL_LATEST in |
| 33 | + * pqcomm.h describe what the backend knows, not what libpq knows. |
| 34 | + */ |
| 35 | + |
| 36 | +#define PG_PROTOCOL_LIBPQ PG_PROTOCOL(2,0) |
| 37 | + |
| 38 | +/* ---------------- |
| 39 | + * Internal functions of libpq |
| 40 | + * Functions declared here need to be visible across files of libpq, |
| 41 | + * but are not intended to be called by applications. We use the |
| 42 | + * convention "pqXXX" for internal functions, vs. the "PQxxx" names |
| 43 | + * used for application-visible routines. |
| 44 | + * ---------------- |
| 45 | + */ |
| 46 | + |
| 47 | +/* === in fe-connect.c === */ |
| 48 | + |
| 49 | + extern int pqPacketSend(PGconn *conn, const char *buf, size_t len); |
| 50 | + |
| 51 | +/* === in fe-exec.c === */ |
| 52 | + |
| 53 | + extern void pqClearAsyncResult(PGconn *conn); |
| 54 | + |
| 55 | +/* === in fe-misc.c === */ |
| 56 | + |
| 57 | + /* "Get" and "Put" routines return 0 if successful, EOF if not. |
| 58 | + * Note that for Get, EOF merely means the buffer is exhausted, |
| 59 | + * not that there is necessarily any error. |
| 60 | + */ |
| 61 | + extern int pqGetc(char *result, PGconn *conn); |
| 62 | + extern int pqGets(char *s, int maxlen, PGconn *conn); |
| 63 | + extern int pqPuts(const char *s, PGconn *conn); |
| 64 | + extern int pqGetnchar(char *s, int len, PGconn *conn); |
| 65 | + extern int pqPutnchar(const char *s, int len, PGconn *conn); |
| 66 | + extern int pqGetInt(int *result, int bytes, PGconn *conn); |
| 67 | + extern int pqPutInt(int value, int bytes, PGconn *conn); |
| 68 | + extern int pqReadData(PGconn *conn); |
| 69 | + extern int pqFlush(PGconn *conn); |
| 70 | + extern int pqWait(int forRead, int forWrite, PGconn *conn); |
| 71 | + |
| 72 | +/* max length of message to send */ |
| 73 | +#define MAX_MESSAGE_LEN 8193 |
| 74 | + |
| 75 | +/* maximum number of fields in a tuple */ |
| 76 | +#define MAX_FIELDS 512 |
| 77 | + |
| 78 | +/* bits in a byte */ |
| 79 | +#define BYTELEN 8 |
| 80 | + |
| 81 | +/* fall back options if they are not specified by arguments or defined |
| 82 | + by environment variables */ |
| 83 | +#define DefaultHost "localhost" |
| 84 | +#define DefaultTty "" |
| 85 | +#define DefaultOption "" |
| 86 | +#define DefaultAuthtype "" |
| 87 | +#define DefaultPassword "" |
| 88 | + |
| 89 | +/* supply an implementation of strerror() macro if system doesn't have it */ |
| 90 | +#ifndef strerror |
| 91 | +#if defined(sun) && defined(sparc) && !defined(__SVR4) |
| 92 | +extern char *sys_errlist[]; |
| 93 | +#define strerror(A) (sys_errlist[(A)]) |
| 94 | +#endif /* sunos4 */ |
| 95 | +#endif /* !strerror */ |
| 96 | + |
| 97 | +#endif /* LIBPQ_INT_H */ |
0 commit comments