|
PostgreSQL Source Code git master
|
#include "postgres_fe.h"#include <ctype.h>#include <fcntl.h>#include <limits.h>#include <unistd.h>#include <netinet/tcp.h>#include "common/int.h"#include "libpq-fe.h"#include "libpq-int.h"#include "mb/pg_wchar.h"#include "port/pg_bswap.h"
Go to the source code of this file.
Macros | |
| #define | VALID_LONG_MESSAGE_TYPE(id) |
| #define | DISPLAY_SIZE 60 /* screen width limit, in screen cols */ |
| #define | MIN_RIGHT_CUT 10 /* try to keep this far away from EOL */ |
| #define | ADD_STARTUP_OPTION(optname, optval) |
| #define VALID_LONG_MESSAGE_TYPE | ( | id | ) |
Definition at line 38 of file fe-protocol3.c.
|
static |
Definition at line 2430 of file fe-protocol3.c.
References ADD_STARTUP_OPTION, pg_conn::appname, pg_conn::client_encoding_initial, conn, pg_conn::dbName, fb(), pg_conn::fbappname, pg_add_size_overflow(), pg_hton32, pg_strcasecmp(), pg_conn::pgoptions, pg_conn::pguser, pg_conn::pversion, pg_conn::replication, pg_conn::send_appname, and val.
Referenced by pqBuildStartupPacket3().
Definition at line 777 of file fe-protocol3.c.
References appendPQExpBuffer(), conn, errmsg(), pg_conn::errorMessage, fb(), i, pg_conn::inBuffer, pg_conn::inCursor, pg_conn::inStart, libpq_gettext, pg_result::numAttributes, pqClearAsyncResult(), pqGetInt(), pqRowProcessor(), pqSaveErrorResult(), pqSkipnchar(), realloc, pg_conn::result, pg_conn::rowBuf, and pg_conn::rowBufLen.
Referenced by pqParseInput3().
Definition at line 1583 of file fe-protocol3.c.
References pg_conn::be_cancel_key, pg_conn::be_cancel_key_len, pg_conn::be_pid, conn, fb(), free, handleFatalError(), pg_conn::inCursor, pg_conn::inStart, libpq_append_conn_error(), malloc, PG_PROTOCOL, pqGetInt(), pqGetnchar(), and pg_conn::pversion.
Referenced by pqParseInput3().
Definition at line 1806 of file fe-protocol3.c.
References pg_conn::asyncStatus, conn, fb(), getNotify(), getParameterStatus(), handleFatalError(), handleSyncLoss(), pg_conn::inCursor, pg_conn::inEnd, pg_conn::inStart, PGASYNC_BUSY, PGASYNC_COPY_BOTH, PGASYNC_COPY_IN, pqCheckInBufferSpace(), pqGetc(), pqGetErrorNotice3(), pqGetInt(), PqMsg_CopyData, PqMsg_CopyDone, PqMsg_NoticeResponse, PqMsg_NotificationResponse, PqMsg_ParameterStatus, and pqParseDone().
Referenced by pqGetCopyData3(), and pqGetlineAsync3().
|
static |
Definition at line 1718 of file fe-protocol3.c.
References pg_result::attDescs, pg_result::binary, conn, pg_conn::copy_is_binary, fb(), format, pgresAttDesc::format, i, MemSet, pg_result::numAttributes, PQclear, pqGetc(), pqGetInt(), PQmakeEmptyPGresult(), pqResultAlloc(), and pg_conn::result.
Referenced by pqParseInput3().
Definition at line 1647 of file fe-protocol3.c.
References conn, PQExpBufferData::data, fb(), free, handleFatalError(), libpq_append_conn_error(), malloc, pgNotify::next, pg_conn::notifyHead, pg_conn::notifyTail, pqGetInt(), pqGets(), and pg_conn::workBuffer.
Referenced by getCopyDataMessage(), pqFunctionCall3(), and pqParseInput3().
Definition at line 689 of file fe-protocol3.c.
References appendPQExpBuffer(), conn, errmsg(), pg_conn::errorMessage, fb(), i, pg_conn::inCursor, pg_conn::inStart, libpq_gettext, MemSet, pg_result::numParameters, pg_result::paramDescs, PGRES_COMMAND_OK, PQclear, pqClearAsyncResult(), pqGetInt(), PQmakeEmptyPGresult(), pqResultAlloc(), pqSaveErrorResult(), pg_conn::result, and pgresParamDesc::typid.
Referenced by pqParseInput3().
Definition at line 1552 of file fe-protocol3.c.
References conn, PQExpBufferData::data, fb(), handleFatalError(), initPQExpBuffer(), libpq_append_conn_error(), pqGets(), pqSaveParameterStatus(), termPQExpBuffer(), and pg_conn::workBuffer.
Referenced by getCopyDataMessage(), pqFunctionCall3(), and pqParseInput3().
Definition at line 1774 of file fe-protocol3.c.
References conn, fb(), pqGetc(), PQTRANS_IDLE, PQTRANS_INERROR, PQTRANS_INTRANS, PQTRANS_UNKNOWN, and pg_conn::xactStatus.
Referenced by pqFunctionCall3(), and pqParseInput3().
Definition at line 518 of file fe-protocol3.c.
References appendPQExpBuffer(), pg_conn::asyncStatus, pg_result::attDescs, pgresAttDesc::atttypmod, pg_result::binary, pg_conn::cmd_queue_head, pgresAttDesc::columnid, conn, PQExpBufferData::data, errmsg(), pg_conn::errorMessage, fb(), format, pgresAttDesc::format, i, pg_conn::inCursor, pg_conn::inStart, libpq_gettext, MemSet, pgresAttDesc::name, pg_result::numAttributes, PGASYNC_READY, PGQUERY_DESCRIBE, PGRES_COMMAND_OK, PGRES_TUPLES_OK, PQclear, pqClearAsyncResult(), pqGetInt(), pqGets(), PQmakeEmptyPGresult(), pqResultAlloc(), pqResultStrdup(), pqSaveErrorResult(), PGcmdQueueEntry::queryclass, pg_conn::result, pgresAttDesc::tableid, pgresAttDesc::typid, pgresAttDesc::typlen, and pg_conn::workBuffer.
Referenced by pqParseInput3().
Definition at line 487 of file fe-protocol3.c.
References pg_conn::asyncStatus, conn, CONNECTION_BAD, PGASYNC_READY, pqDropConnection(), pqSaveErrorResult(), and pg_conn::status.
Referenced by getBackendKeyData(), getCopyDataMessage(), getNotify(), getParameterStatus(), handleSyncLoss(), pqFunctionCall3(), and pqParseInput3().
Definition at line 503 of file fe-protocol3.c.
References conn, fb(), handleFatalError(), and libpq_append_conn_error().
Referenced by getCopyDataMessage(), pqFunctionCall3(), and pqParseInput3().
| void pqBuildErrorMessage3 | ( | PQExpBuffer | msg, |
| const PGresult * | res, | ||
| PGVerbosity | verbosity, | ||
| PGContextVisibility | show_context | ||
| ) |
Definition at line 1030 of file fe-protocol3.c.
References appendPQExpBuffer(), appendPQExpBufferChar(), appendPQExpBufferStr(), pg_result::client_encoding, pg_result::errFields, pg_result::errMsg, pg_result::errQuery, fb(), libpq_gettext, PG_DIAG_COLUMN_NAME, PG_DIAG_CONSTRAINT_NAME, PG_DIAG_CONTEXT, PG_DIAG_DATATYPE_NAME, PG_DIAG_INTERNAL_POSITION, PG_DIAG_INTERNAL_QUERY, PG_DIAG_MESSAGE_DETAIL, PG_DIAG_MESSAGE_HINT, PG_DIAG_MESSAGE_PRIMARY, PG_DIAG_SCHEMA_NAME, PG_DIAG_SEVERITY, PG_DIAG_SOURCE_FILE, PG_DIAG_SOURCE_FUNCTION, PG_DIAG_SOURCE_LINE, PG_DIAG_SQLSTATE, PG_DIAG_STATEMENT_POSITION, PG_DIAG_TABLE_NAME, PGRES_FATAL_ERROR, PQERRORS_SQLSTATE, PQERRORS_TERSE, PQERRORS_VERBOSE, PQresultErrorField, PQSHOW_CONTEXT_ALWAYS, PQSHOW_CONTEXT_ERRORS, reportErrorPosition(), pg_result::resultStatus, and val.
Referenced by pqGetErrorNotice3(), and PQresultVerboseErrorMessage().
| char * pqBuildStartupPacket3 | ( | PGconn * | conn, |
| int * | packetlen, | ||
| const PQEnvironmentOption * | options | ||
| ) |
Definition at line 2399 of file fe-protocol3.c.
References Assert, build_startup_packet(), conn, fb(), len, and malloc.
Referenced by PQconnectPoll().
Definition at line 2076 of file fe-protocol3.c.
References pg_conn::asyncStatus, pg_conn::cmd_queue_head, conn, PQExpBufferData::data, pg_conn::errorMessage, fb(), PQExpBufferData::len, libpq_append_conn_error(), pg_conn::noticeHooks, PGASYNC_BUSY, PGASYNC_COPY_BOTH, PGASYNC_COPY_IN, PGASYNC_COPY_OUT, PGQUERY_SIMPLE, PGRES_COMMAND_OK, PQclear, pqFlush(), PQgetResult, pqInternalNotice(), PQisBusy(), pqIsnonblocking, PqMsg_CopyDone, PqMsg_Sync, pqPutMsgEnd(), pqPutMsgStart(), PGcmdQueueEntry::queryclass, and pg_result::resultStatus.
Referenced by PQendcopy().
| PGresult * pqFunctionCall3 | ( | PGconn * | conn, |
| Oid | fnid, | ||
| int * | result_buf, | ||
| int * | actual_result_len, | ||
| int | result_is_int, | ||
| const PQArgBlock * | args, | ||
| int | nargs | ||
| ) |
Definition at line 2169 of file fe-protocol3.c.
References Assert, conn, fb(), getNotify(), getParameterStatus(), getReadyForQuery(), handleFatalError(), handleSyncLoss(), i, pg_conn::inCursor, pg_conn::inEnd, pg_conn::inStart, len, libpq_append_conn_error(), pgHavePendingResult, PGRES_COMMAND_OK, PGRES_FATAL_ERROR, pg_conn::pipelineStatus, PQ_PIPELINE_OFF, pqCheckInBufferSpace(), pqFlush(), pqGetc(), pqGetErrorNotice3(), pqGetInt(), pqGetnchar(), PQmakeEmptyPGresult(), PqMsg_ErrorResponse, PqMsg_FunctionCall, PqMsg_FunctionCallResponse, PqMsg_NoticeResponse, PqMsg_NotificationResponse, PqMsg_ParameterStatus, PqMsg_ReadyForQuery, pqParseDone(), pqPrepareAsyncResult(), pqPutInt(), pqPutMsgEnd(), pqPutMsgStart(), pqPutnchar(), pqReadData(), pqSaveErrorResult(), pqWait(), pg_conn::result, and VALID_LONG_MESSAGE_TYPE.
Referenced by PQfn().
Definition at line 1911 of file fe-protocol3.c.
References conn, fb(), getCopyDataMessage(), pg_conn::inBuffer, pg_conn::inCursor, libpq_append_conn_error(), malloc, pqParseDone(), pqReadData(), and pqWait().
Referenced by PQgetCopyData().
Definition at line 898 of file fe-protocol3.c.
References appendPQExpBufferStr(), pg_conn::cmd_queue_head, conn, PQExpBufferData::data, pg_result::errMsg, pg_conn::error_result, pg_conn::errorMessage, pg_result::errQuery, fb(), initPQExpBuffer(), pg_conn::last_sqlstate, libpq_append_conn_error(), libpq_gettext, pg_result::noticeHooks, PGNoticeHooks::noticeRec, PGNoticeHooks::noticeRecArg, PG_DIAG_SQLSTATE, PG_DIAG_STATEMENT_POSITION, PGRES_EMPTY_QUERY, PGRES_FATAL_ERROR, PGRES_NONFATAL_ERROR, pg_conn::pipelineStatus, PQ_PIPELINE_ABORTED, PQ_PIPELINE_OFF, pqBuildErrorMessage3(), PQclear, pqClearAsyncResult(), PQExpBufferDataBroken, pqGetc(), pqGets(), PQmakeEmptyPGresult(), pqResultStrdup(), pqSaveMessageField(), pqSetResultError(), PGcmdQueueEntry::query, resetPQExpBuffer(), pg_conn::result, pg_result::resultStatus, pg_conn::show_context, strlcpy(), termPQExpBuffer(), and pg_conn::verbosity.
Referenced by getCopyDataMessage(), PQconnectPoll(), pqFunctionCall3(), and pqParseInput3().
Definition at line 1970 of file fe-protocol3.c.
References pg_conn::asyncStatus, conn, pg_conn::copy_is_binary, fb(), libpq_append_conn_error(), PGASYNC_COPY_BOTH, PGASYNC_COPY_OUT, PGINVALID_SOCKET, PQgetlineAsync(), pqReadData(), pqWait(), and pg_conn::sock.
Referenced by PQgetline().
Definition at line 2021 of file fe-protocol3.c.
References pg_conn::asyncStatus, bufsize, conn, pg_conn::copy_already_done, fb(), getCopyDataMessage(), pg_conn::inBuffer, pg_conn::inCursor, pg_conn::inStart, PGASYNC_COPY_BOTH, and PGASYNC_COPY_OUT.
Referenced by PQgetlineAsync().
Definition at line 1443 of file fe-protocol3.c.
References pg_conn::asyncStatus, conn, PQExpBufferData::data, fb(), i, libpq_append_conn_error(), pg_conn::min_pversion, PG_PROTOCOL, PG_PROTOCOL_GREASE, PG_PROTOCOL_MAJOR, PG_PROTOCOL_MINOR, PG_PROTOCOL_RESERVED_31, PGASYNC_READY, pqGetInt(), pqGets(), pqSaveErrorResult(), pg_conn::pversion, and pg_conn::workBuffer.
Referenced by PQconnectPoll().
Definition at line 70 of file fe-protocol3.c.
References pg_conn::asyncStatus, pg_conn::cmd_queue_head, pg_result::cmdStatus, CMDSTATUS_LEN, conn, CONNECTION_BAD, pg_conn::copy_already_done, PQExpBufferData::data, pg_conn::error_result, fb(), getAnotherTuple(), getBackendKeyData(), getCopyStart(), getNotify(), getParamDescriptions(), getParameterStatus(), getReadyForQuery(), getRowDescriptions(), handleFatalError(), handleSyncLoss(), pg_conn::inCursor, pg_conn::inEnd, pg_conn::inStart, libpq_append_conn_error(), pg_conn::noticeHooks, PGASYNC_BUSY, PGASYNC_COPY_BOTH, PGASYNC_COPY_IN, PGASYNC_COPY_OUT, PGASYNC_IDLE, PGASYNC_READY, pgHavePendingResult, PGQUERY_CLOSE, PGQUERY_DESCRIBE, PGQUERY_PREPARE, PGRES_COMMAND_OK, PGRES_COPY_BOTH, PGRES_COPY_IN, PGRES_COPY_OUT, PGRES_EMPTY_QUERY, PGRES_FATAL_ERROR, PGRES_PIPELINE_SYNC, PGRES_TUPLES_CHUNK, PGRES_TUPLES_OK, pg_conn::pipelineStatus, PQ_PIPELINE_OFF, PQ_PIPELINE_ON, pqCheckInBufferSpace(), pqCommandQueueAdvance(), pqGetc(), pqGetErrorNotice3(), pqGetInt(), pqGets(), pqInternalNotice(), PQmakeEmptyPGresult(), PqMsg_BackendKeyData, PqMsg_BindComplete, PqMsg_CloseComplete, PqMsg_CommandComplete, PqMsg_CopyBothResponse, PqMsg_CopyData, PqMsg_CopyDone, PqMsg_CopyInResponse, PqMsg_CopyOutResponse, PqMsg_DataRow, PqMsg_EmptyQueryResponse, PqMsg_ErrorResponse, PqMsg_NoData, PqMsg_NoticeResponse, PqMsg_NotificationResponse, PqMsg_ParameterDescription, PqMsg_ParameterStatus, PqMsg_ParseComplete, PqMsg_ReadyForQuery, PqMsg_RowDescription, pqParseDone(), pqSaveErrorResult(), PGcmdQueueEntry::queryclass, pg_conn::result, pg_result::resultStatus, pg_conn::status, strlcpy(), VALID_LONG_MESSAGE_TYPE, and pg_conn::workBuffer.
Referenced by parseInput().
|
static |
Definition at line 1201 of file fe-protocol3.c.
References appendPQExpBuffer(), appendPQExpBufferChar(), appendPQExpBufferStr(), PQExpBufferData::data, DISPLAY_SIZE, encoding, fb(), free, i, PQExpBufferData::len, libpq_gettext, malloc, MIN_RIGHT_CUT, pg_encoding_dsplen(), pg_encoding_max_length(), and PQmblenBounded().
Referenced by pqBuildErrorMessage3().