📄 libpq-int.h
字号:
* numbers-and-dots notation. Takes * precedence over above. */ char *pgport; /* the server's communication port */ char *pgunixsocket; /* the Unix-domain socket that the server * is listening on; if NULL, uses a * default constructed from pgport */ char *pgtty; /* tty on which the backend messages is * displayed (OBSOLETE, NOT USED) */ char *connect_timeout; /* connection timeout (numeric string) */ char *pgoptions; /* options to start the backend with */ char *dbName; /* database name */ char *pguser; /* Postgres username and password, if any */ char *pgpass; char *sslmode; /* SSL mode (require,prefer,allow,disable) */ /* Optional file to write trace info to */ FILE *Pfdebug; /* Callback procedures for notice message processing */ PGNoticeHooks noticeHooks; /* Status indicators */ ConnStatusType status; PGAsyncStatusType asyncStatus; PGTransactionStatusType xactStatus; /* note: xactStatus never changes to ACTIVE */ bool nonblocking; /* whether this connection is using * nonblock sending semantics */ bool ext_query; /* was our last query sent with extended * query protocol? */ char copy_is_binary; /* 1 = copy binary, 0 = copy text */ int copy_already_done; /* # bytes already returned in * COPY OUT */ Dllist *notifyList; /* Notify msgs not yet handed to * application */ /* Connection data */ int sock; /* Unix FD for socket, -1 if not connected */ SockAddr laddr; /* Local address */ SockAddr raddr; /* Remote address */ ProtocolVersion pversion; /* FE/BE protocol version in use */ int sversion; /* server version, e.g. 70401 for 7.4.1 */ /* Transient state needed while establishing connection */ struct addrinfo *addrlist; /* list of possible backend addresses */ struct addrinfo *addr_cur; /* the one currently being tried */ int addrlist_family; /* needed to know how to free addrlist */ PGSetenvStatusType setenv_state; /* for 2.0 protocol only */ const PQEnvironmentOption *next_eo; /* Miscellaneous stuff */ int be_pid; /* PID of backend --- needed for cancels */ int be_key; /* key of backend --- needed for cancels */ char md5Salt[4]; /* password salt received from backend */ char cryptSalt[2]; /* password salt received from backend */ pgParameterStatus *pstatus; /* ParameterStatus data */ int client_encoding; /* encoding id */ PGVerbosity verbosity; /* error/notice message verbosity */ PGlobjfuncs *lobjfuncs; /* private state for large-object access * fns */ /* Buffer for data received from backend and not yet processed */ char *inBuffer; /* currently allocated buffer */ int inBufSize; /* allocated size of buffer */ int inStart; /* offset to first unconsumed data in * buffer */ int inCursor; /* next byte to tentatively consume */ int inEnd; /* offset to first position after avail * data */ /* Buffer for data not yet sent to backend */ char *outBuffer; /* currently allocated buffer */ int outBufSize; /* allocated size of buffer */ int outCount; /* number of chars waiting in buffer */ /* State for constructing messages in outBuffer */ int outMsgStart; /* offset to msg start (length word); if * -1, msg has no length word */ int outMsgEnd; /* offset to msg end (so far) */ /* Status for asynchronous result construction */ PGresult *result; /* result being constructed */ PGresAttValue *curTuple; /* tuple currently being read */#ifdef USE_SSL bool allow_ssl_try; /* Allowed to try SSL negotiation */ bool wait_ssl_try; /* Delay SSL negotiation until after * attempting normal connection */ SSL *ssl; /* SSL status, if have SSL connection */ X509 *peer; /* X509 cert of server */ char peer_dn[256 + 1]; /* peer distinguished name */ char peer_cn[SM_USER + 1]; /* peer common name */#endif /* Buffer for current error message */ PQExpBufferData errorMessage; /* expansible string */ /* Buffer for receiving various parts of messages */ PQExpBufferData workBuffer; /* expansible string */};/* String descriptions of the ExecStatusTypes. * direct use of this array is deprecated; call PQresStatus() instead. */extern char *const pgresStatus[];/* ---------------- * Internal functions of libpq * Functions declared here need to be visible across files of libpq, * but are not intended to be called by applications. We use the * convention "pqXXX" for internal functions, vs. the "PQxxx" names * used for application-visible routines. * ---------------- *//* === in fe-connect.c === */extern int pqPacketSend(PGconn *conn, char pack_type, const void *buf, size_t buf_len);/* === in fe-exec.c === */extern void pqSetResultError(PGresult *res, const char *msg);extern void pqCatenateResultError(PGresult *res, const char *msg);extern void *pqResultAlloc(PGresult *res, size_t nBytes, bool isBinary);extern char *pqResultStrdup(PGresult *res, const char *str);extern void pqClearAsyncResult(PGconn *conn);extern void pqSaveErrorResult(PGconn *conn);extern PGresult *pqPrepareAsyncResult(PGconn *conn);extern voidpqInternalNotice(const PGNoticeHooks * hooks, const char *fmt,...)/* This lets gcc check the format string for consistency. */__attribute__((format(printf, 2, 3)));extern int pqAddTuple(PGresult *res, PGresAttValue * tup);extern void pqSaveMessageField(PGresult *res, char code, const char *value);extern void pqSaveParameterStatus(PGconn *conn, const char *name, const char *value);extern void pqHandleSendFailure(PGconn *conn);/* === in fe-protocol2.c === */extern PostgresPollingStatusType pqSetenvPoll(PGconn *conn);extern char *pqBuildStartupPacket2(PGconn *conn, int *packetlen, const PQEnvironmentOption * options);extern void pqParseInput2(PGconn *conn);extern int pqGetCopyData2(PGconn *conn, char **buffer, int async);extern int pqGetline2(PGconn *conn, char *s, int maxlen);extern int pqGetlineAsync2(PGconn *conn, char *buffer, int bufsize);extern int pqEndcopy2(PGconn *conn);extern PGresult *pqFunctionCall2(PGconn *conn, Oid fnid, int *result_buf, int *actual_result_len, int result_is_int, const PQArgBlock *args, int nargs);/* === in fe-protocol3.c === */extern char *pqBuildStartupPacket3(PGconn *conn, int *packetlen, const PQEnvironmentOption * options);extern void pqParseInput3(PGconn *conn);extern int pqGetErrorNotice3(PGconn *conn, bool isError);extern int pqGetCopyData3(PGconn *conn, char **buffer, int async);extern int pqGetline3(PGconn *conn, char *s, int maxlen);extern int pqGetlineAsync3(PGconn *conn, char *buffer, int bufsize);extern int pqEndcopy3(PGconn *conn);extern PGresult *pqFunctionCall3(PGconn *conn, Oid fnid, int *result_buf, int *actual_result_len, int result_is_int, const PQArgBlock *args, int nargs);/* === in fe-misc.c === */ /* * "Get" and "Put" routines return 0 if successful, EOF if not. Note that * for Get, EOF merely means the buffer is exhausted, not that there is * necessarily any error. */extern int pqCheckOutBufferSpace(int bytes_needed, PGconn *conn);extern int pqCheckInBufferSpace(int bytes_needed, PGconn *conn);extern int pqGetc(char *result, PGconn *conn);extern int pqPutc(char c, PGconn *conn);extern int pqGets(PQExpBuffer buf, PGconn *conn);extern int pqPuts(const char *s, PGconn *conn);extern int pqGetnchar(char *s, size_t len, PGconn *conn);extern int pqPutnchar(const char *s, size_t len, PGconn *conn);extern int pqGetInt(int *result, size_t bytes, PGconn *conn);extern int pqPutInt(int value, size_t bytes, PGconn *conn);extern int pqPutMsgStart(char msg_type, bool force_len, PGconn *conn);extern int pqPutMsgEnd(PGconn *conn);extern int pqReadData(PGconn *conn);extern int pqFlush(PGconn *conn);extern int pqWait(int forRead, int forWrite, PGconn *conn);extern int pqWaitTimed(int forRead, int forWrite, PGconn *conn, time_t finish_time);extern int pqReadReady(PGconn *conn);extern int pqWriteReady(PGconn *conn);/* === in fe-secure.c === */extern int pqsecure_initialize(PGconn *);extern void pqsecure_destroy(void);extern PostgresPollingStatusType pqsecure_open_client(PGconn *);extern void pqsecure_close(PGconn *);extern ssize_t pqsecure_read(PGconn *, void *ptr, size_t len);extern ssize_t pqsecure_write(PGconn *, const void *ptr, size_t len);/* * this is so that we can check if a connection is non-blocking internally * without the overhead of a function call */#define pqIsnonblocking(conn) ((conn)->nonblocking)#ifdef ENABLE_NLSextern char *libpq_gettext(const char *msgid)__attribute__((format_arg(1)));#else#define libpq_gettext(x) (x)#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#define SOCK_ERRNO_SET(e) WSASetLastError(e)#else#define SOCK_ERRNO errno#define SOCK_STRERROR pqStrerror#define SOCK_ERRNO_SET(e) errno=e#endif#endif /* LIBPQ_INT_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -