38#define VALID_LONG_MESSAGE_TYPE(id) \
39 ((id) == PqMsg_CopyData || \
40 (id) == PqMsg_DataRow || \
41 (id) == PqMsg_ErrorResponse || \
42 (id) == PqMsg_FunctionCallResponse || \
43 (id) == PqMsg_NoticeResponse || \
44 (id) == PqMsg_NotificationResponse || \
45 (id) == PqMsg_RowDescription)
191 "message type 0x%02x arrived from server while idle",
571 result->
binary = (nfields > 0) ? 1 : 0;
574 for (
i = 0;
i < nfields;
i++)
600 columnid = (
int) ((
int16) columnid);
717 for (
i = 0;
i < nparams;
i++)
817 for (
i = 0;
i < nfields;
i++)
1203#define DISPLAY_SIZE 60
1204#define MIN_RIGHT_CUT 10
1306 else if (
ch ==
'\r' ||
ch ==
'\n')
1457 libpq_append_conn_error(
conn,
"received invalid protocol negotiation message: server requested downgrade to a higher-numbered version");
1463 libpq_append_conn_error(
conn,
"received invalid protocol negotiation message: server requested downgrade to pre-3.0 protocol version");
1470 libpq_append_conn_error(
conn,
"received invalid protocol negotiation message: server requested downgrade to non-existent 3.1 protocol version");
1476 libpq_append_conn_error(
conn,
"received invalid protocol negotiation message: server reported negative number of unsupported parameters");
1491 "min_protocol_version",
1505 for (
int i = 0;
i < num;
i++)
1734 for (
i = 0;
i < nfields;
i++)
1933 if (*buffer ==
NULL)
1991 if (s[status - 1] ==
'\n')
1993 s[status - 1] =
'\0';
2184 for (
i = 0;
i < nargs; ++
i)
2188 if (args[
i].
len == -1)
2436#define ADD_STARTUP_OPTION(optname, optval) \
2439 strcpy(packet + packet_len, optname); \
2440 if (pg_add_size_overflow(packet_len, strlen(optname) + 1, &packet_len)) \
2443 strcpy(packet + packet_len, optval); \
2444 if (pg_add_size_overflow(packet_len, strlen(optval) + 1, &packet_len)) \
#define Assert(condition)
#define MemSet(start, val, len)
int errmsg(const char *fmt,...)
void pqDropConnection(PGconn *conn, bool flushInput)
void * pqResultAlloc(PGresult *res, size_t nBytes, bool isBinary)
void pqSaveMessageField(PGresult *res, char code, const char *value)
PGresult * pqPrepareAsyncResult(PGconn *conn)
void pqCommandQueueAdvance(PGconn *conn, bool isReadyForQuery, bool gotSync)
void pqSetResultError(PGresult *res, PQExpBuffer errorMessage, int offset)
void pqSaveErrorResult(PGconn *conn)
int pqRowProcessor(PGconn *conn, const char **errmsgp)
int PQgetlineAsync(PGconn *conn, char *buffer, int bufsize)
PGresult * PQmakeEmptyPGresult(PGconn *conn, ExecStatusType status)
void pqInternalNotice(const PGNoticeHooks *hooks, const char *fmt,...)
void pqClearAsyncResult(PGconn *conn)
int PQisBusy(PGconn *conn)
int pqSaveParameterStatus(PGconn *conn, const char *name, const char *value)
char * pqResultStrdup(PGresult *res, const char *str)
int pqReadData(PGconn *conn)
int pqPutInt(int value, size_t bytes, PGconn *conn)
int pqFlush(PGconn *conn)
void pqParseDone(PGconn *conn, int newInStart)
int pqPutMsgStart(char msg_type, PGconn *conn)
int pqSkipnchar(size_t len, PGconn *conn)
int pqGetc(char *result, PGconn *conn)
int pqGetInt(int *result, size_t bytes, PGconn *conn)
int pqWait(int forRead, int forWrite, PGconn *conn)
int pqGets(PQExpBuffer buf, PGconn *conn)
int pqPutnchar(const void *s, size_t len, PGconn *conn)
int pqCheckInBufferSpace(size_t bytes_needed, PGconn *conn)
int pqGetnchar(void *s, size_t len, PGconn *conn)
int PQmblenBounded(const char *s, int encoding)
int pqPutMsgEnd(PGconn *conn)
void pqBuildErrorMessage3(PQExpBuffer msg, const PGresult *res, PGVerbosity verbosity, PGContextVisibility show_context)
void pqParseInput3(PGconn *conn)
char * pqBuildStartupPacket3(PGconn *conn, int *packetlen, const PQEnvironmentOption *options)
int pqEndcopy3(PGconn *conn)
static int getNotify(PGconn *conn)
static int getAnotherTuple(PGconn *conn, int msgLength)
static int getRowDescriptions(PGconn *conn, int msgLength)
static void reportErrorPosition(PQExpBuffer msg, const char *query, int loc, int encoding)
PGresult * pqFunctionCall3(PGconn *conn, Oid fnid, int *result_buf, int *actual_result_len, int result_is_int, const PQArgBlock *args, int nargs)
int pqGetlineAsync3(PGconn *conn, char *buffer, int bufsize)
int pqGetCopyData3(PGconn *conn, char **buffer, int async)
int pqGetNegotiateProtocolVersion3(PGconn *conn)
static int getParameterStatus(PGconn *conn)
static size_t build_startup_packet(const PGconn *conn, char *packet, const PQEnvironmentOption *options)
static void handleFatalError(PGconn *conn)
#define VALID_LONG_MESSAGE_TYPE(id)
static int getCopyStart(PGconn *conn, ExecStatusType copytype)
static void handleSyncLoss(PGconn *conn, char id, int msgLength)
static int getReadyForQuery(PGconn *conn)
#define ADD_STARTUP_OPTION(optname, optval)
static int getBackendKeyData(PGconn *conn, int msgLength)
static int getCopyDataMessage(PGconn *conn)
static int getParamDescriptions(PGconn *conn, int msgLength)
int pqGetline3(PGconn *conn, char *s, int maxlen)
int pqGetErrorNotice3(PGconn *conn, bool isError)
static bool pg_add_size_overflow(size_t a, size_t b, size_t *result)
#define PQresultErrorField
#define pqIsnonblocking(conn)
#define pgHavePendingResult(conn)
void libpq_append_conn_error(PGconn *conn, const char *fmt,...)
int pg_strcasecmp(const char *s1, const char *s2)
size_t strlcpy(char *dst, const char *src, size_t siz)
#define PG_DIAG_INTERNAL_QUERY
#define PG_DIAG_SCHEMA_NAME
#define PG_DIAG_CONSTRAINT_NAME
#define PG_DIAG_DATATYPE_NAME
#define PG_DIAG_SOURCE_LINE
#define PG_DIAG_STATEMENT_POSITION
#define PG_DIAG_SOURCE_FILE
#define PG_DIAG_MESSAGE_HINT
#define PG_DIAG_TABLE_NAME
#define PG_DIAG_MESSAGE_PRIMARY
#define PG_DIAG_COLUMN_NAME
#define PG_DIAG_MESSAGE_DETAIL
#define PG_DIAG_SOURCE_FUNCTION
#define PG_DIAG_INTERNAL_POSITION
#define PG_PROTOCOL_MAJOR(v)
#define PG_PROTOCOL_RESERVED_31
#define PG_PROTOCOL(m, n)
#define PG_PROTOCOL_MINOR(v)
void initPQExpBuffer(PQExpBuffer str)
void resetPQExpBuffer(PQExpBuffer str)
void appendPQExpBuffer(PQExpBuffer str, const char *fmt,...)
void appendPQExpBufferChar(PQExpBuffer str, char ch)
void appendPQExpBufferStr(PQExpBuffer str, const char *data)
void termPQExpBuffer(PQExpBuffer str)
#define PQExpBufferDataBroken(buf)
#define PqMsg_CloseComplete
#define PqMsg_NotificationResponse
#define PqMsg_BindComplete
#define PqMsg_ParameterDescription
#define PqMsg_FunctionCall
#define PqMsg_FunctionCallResponse
#define PqMsg_ReadyForQuery
#define PqMsg_CopyInResponse
#define PqMsg_EmptyQueryResponse
#define PqMsg_RowDescription
#define PqMsg_CopyBothResponse
#define PqMsg_ParameterStatus
#define PqMsg_BackendKeyData
#define PqMsg_CommandComplete
#define PqMsg_ErrorResponse
#define PqMsg_NoticeResponse
#define PqMsg_CopyOutResponse
#define PqMsg_ParseComplete
PQnoticeReceiver noticeRec
PGTransactionStatusType xactStatus
ProtocolVersion min_pversion
PQExpBufferData workBuffer
char * client_encoding_initial
PQExpBufferData errorMessage
PGAsyncStatusType asyncStatus
PGpipelineStatus pipelineStatus
PGNoticeHooks noticeHooks
PGcmdQueueEntry * cmd_queue_head
PGContextVisibility show_context
PGNoticeHooks noticeHooks
char cmdStatus[CMDSTATUS_LEN]
PGMessageField * errFields
PGresParamDesc * paramDescs
ExecStatusType resultStatus
int pg_encoding_dsplen(int encoding, const char *mbstr)
int pg_encoding_max_length(int encoding)