1 /*-------------------------------------------------------------------------
4 * This file contains internal definitions meant to be used only by
5 * the frontend libpq library, not by applications that call it.
7 * Copyright (c) 1994, Regents of the University of California
9 * $Id: libpq-int.h,v 1.2 1998/09/01 04:40:12 momjian Exp $
11 *-------------------------------------------------------------------------
17 /* We assume libpq-fe.h has already been included. */
20 * include stuff common to fe and be
23 #include "libpq/pqcomm.h"
25 /* libpq supports this version of the frontend/backend protocol.
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.
36 #define PG_PROTOCOL_LIBPQ PG_PROTOCOL(2,0)
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.
47 /* === in fe-connect.c === */
49 extern int pqPacketSend(PGconn *conn, const char *buf, size_t len);
51 /* === in fe-exec.c === */
53 extern void pqClearAsyncResult(PGconn *conn);
55 /* === in fe-misc.c === */
58 * "Get" and "Put" routines return 0 if successful, EOF if not. Note that
59 * for Get, EOF merely means the buffer is exhausted, not that there is
60 * necessarily any error.
62 extern int pqGetc(char *result, PGconn *conn);
63 extern int pqGets(char *s, int maxlen, PGconn *conn);
64 extern int pqPuts(const char *s, PGconn *conn);
65 extern int pqGetnchar(char *s, int len, PGconn *conn);
66 extern int pqPutnchar(const char *s, int len, PGconn *conn);
67 extern int pqGetInt(int *result, int bytes, PGconn *conn);
68 extern int pqPutInt(int value, int bytes, PGconn *conn);
69 extern int pqReadData(PGconn *conn);
70 extern int pqFlush(PGconn *conn);
71 extern int pqWait(int forRead, int forWrite, PGconn *conn);
73 /* max length of message to send */
74 #define MAX_MESSAGE_LEN 8193
76 /* maximum number of fields in a tuple */
77 #define MAX_FIELDS 512
82 /* fall back options if they are not specified by arguments or defined
83 by environment variables */
84 #define DefaultHost "localhost"
86 #define DefaultOption ""
87 #define DefaultAuthtype ""
88 #define DefaultPassword ""
90 /* supply an implementation of strerror() macro if system doesn't have it */
92 #if defined(sun) && defined(sparc) && !defined(__SVR4)
93 extern char *sys_errlist[];
95 #define strerror(A) (sys_errlist[(A)])
97 #endif /* !strerror */
99 #endif /* LIBPQ_INT_H */