|
PostgreSQL Source Code git master
|
#include "postgres_fe.h"#include <signal.h>#include <time.h>#include <unistd.h>#include <sys/select.h>#include <poll.h>#include "libpq-fe.h"#include "libpq-int.h"#include "mb/pg_wchar.h"#include "pg_config_paths.h"#include "port/pg_bswap.h"
Go to the source code of this file.
Functions | |
| static int | pqPutMsgBytes (const void *buf, size_t len, PGconn *conn) |
| static int | pqSendSome (PGconn *conn, int len) |
| static int | pqSocketCheck (PGconn *conn, int forRead, int forWrite, pg_usec_time_t end_time) |
| int | PQlibVersion (void) |
| int | pqGetc (char *result, PGconn *conn) |
| int | pqPutc (char c, PGconn *conn) |
| static int | pqGets_internal (PQExpBuffer buf, PGconn *conn, bool resetbuffer) |
| int | pqGets (PQExpBuffer buf, PGconn *conn) |
| int | pqGets_append (PQExpBuffer buf, PGconn *conn) |
| int | pqPuts (const char *s, PGconn *conn) |
| int | pqGetnchar (void *s, size_t len, PGconn *conn) |
| int | pqSkipnchar (size_t len, PGconn *conn) |
| int | pqPutnchar (const void *s, size_t len, PGconn *conn) |
| int | pqGetInt (int *result, size_t bytes, PGconn *conn) |
| int | pqPutInt (int value, size_t bytes, PGconn *conn) |
| int | pqCheckOutBufferSpace (size_t bytes_needed, PGconn *conn) |
| int | pqCheckInBufferSpace (size_t bytes_needed, PGconn *conn) |
| void | pqParseDone (PGconn *conn, int newInStart) |
| int | pqPutMsgStart (char msg_type, PGconn *conn) |
| int | pqPutMsgEnd (PGconn *conn) |
| int | pqReadData (PGconn *conn) |
| int | pqFlush (PGconn *conn) |
| int | pqWait (int forRead, int forWrite, PGconn *conn) |
| int | pqWaitTimed (int forRead, int forWrite, PGconn *conn, pg_usec_time_t end_time) |
| int | pqReadReady (PGconn *conn) |
| int | pqWriteReady (PGconn *conn) |
| int | PQsocketPoll (int sock, int forRead, int forWrite, pg_usec_time_t end_time) |
| pg_usec_time_t | PQgetCurrentTimeUSec (void) |
| int | PQmblen (const char *s, int encoding) |
| int | PQmblenBounded (const char *s, int encoding) |
| int | PQdsplen (const char *s, int encoding) |
| int | PQenv2encoding (void) |
| void | libpq_append_error (PQExpBuffer errorMessage, const char *fmt,...) |
| void | libpq_append_conn_error (PGconn *conn, const char *fmt,...) |
| void libpq_append_conn_error | ( | PGconn * | conn, |
| const char * | fmt, | ||
| ... | |||
| ) |
Definition at line 1404 of file fe-misc.c.
References appendPQExpBufferChar(), appendPQExpBufferVA(), generate_unaccent_rules::args, Assert(), conn, pg_conn::errorMessage, libpq_gettext, and PQExpBufferBroken.
Referenced by pqReadData(), pqSocketCheck(), and pqWaitTimed().
| void libpq_append_error | ( | PQExpBuffer | errorMessage, |
| const char * | fmt, | ||
| ... | |||
| ) |
Definition at line 1375 of file fe-misc.c.
References appendPQExpBufferChar(), appendPQExpBufferVA(), generate_unaccent_rules::args, Assert(), libpq_gettext, and PQExpBufferBroken.
Referenced by conninfo_add_defaults(), conninfo_array_parse(), conninfo_init(), conninfo_parse(), conninfo_storeval(), conninfo_uri_decode(), conninfo_uri_parse_options(), conninfo_uri_parse_params(), parseServiceFile(), parseServiceInfo(), pg_fe_getusername(), and read_attr_value().
| int pqCheckInBufferSpace | ( | size_t | bytes_needed, |
| PGconn * | conn | ||
| ) |
Definition at line 351 of file fe-misc.c.
References appendPQExpBufferStr(), conn, pg_conn::errorMessage, pg_conn::inBuffer, pg_conn::inBufSize, pg_conn::inCursor, pg_conn::inEnd, pg_conn::inStart, and realloc.
Referenced by getCopyDataMessage(), PQconnectPoll(), pqFunctionCall3(), pqParseInput3(), and pqReadData().
| int pqCheckOutBufferSpace | ( | size_t | bytes_needed, |
| PGconn * | conn | ||
| ) |
Definition at line 287 of file fe-misc.c.
References appendPQExpBufferStr(), conn, pg_conn::errorMessage, pg_conn::outBuffer, pg_conn::outBufSize, and realloc.
Referenced by PQputCopyData(), pqPutMsgBytes(), and pqPutMsgStart().
| int PQdsplen | ( | const char * | s, |
| int | encoding | ||
| ) |
Definition at line 1276 of file fe-misc.c.
References encoding, and pg_encoding_dsplen().
Referenced by get_prompt(), pg_wcsformat(), pg_wcssize(), pg_wcswidth(), and strlen_max_width().
| int PQenv2encoding | ( | void | ) |
Definition at line 1285 of file fe-misc.c.
References encoding, pg_char_to_encoding, PG_SQL_ASCII, and str.
Referenced by main().
| int pqFlush | ( | PGconn * | conn | ) |
Definition at line 994 of file fe-misc.c.
References conn, pg_conn::outCount, pg_conn::Pfdebug, and pqSendSome().
Referenced by pg_SASL_init(), PQconnectPoll(), PQconsumeInput(), pqEndcopy3(), PQexitPipelineMode(), PQflush(), pqFunctionCall3(), PQgetResult(), pqPacketSend(), pqPipelineFlush(), pqPipelineSyncInternal(), PQputCopyData(), PQputCopyEnd(), PQsendCancelRequest(), PQsendQueryInternal(), PQsetnonblocking(), and sendTerminateConn().
| int pqGetc | ( | char * | result, |
| PGconn * | conn | ||
| ) |
Definition at line 77 of file fe-misc.c.
References conn, pg_conn::inBuffer, pg_conn::inCursor, and pg_conn::inEnd.
Referenced by getCopyDataMessage(), getCopyStart(), getReadyForQuery(), PQconnectPoll(), pqFunctionCall3(), pqGetErrorNotice3(), and pqParseInput3().
| pg_usec_time_t PQgetCurrentTimeUSec | ( | void | ) |
Definition at line 1235 of file fe-misc.c.
References gettimeofday().
Referenced by pqConnectDBComplete(), PQsocketPoll(), and wait_until_connected().
| int pqGetInt | ( | int * | result, |
| size_t | bytes, | ||
| PGconn * | conn | ||
| ) |
Definition at line 216 of file fe-misc.c.
References conn, pg_conn::inBuffer, pg_conn::inCursor, pg_conn::inEnd, pg_conn::noticeHooks, pg_ntoh16, pg_ntoh32, and pqInternalNotice().
Referenced by getAnotherTuple(), getBackendKeyData(), getCopyDataMessage(), getCopyStart(), getNotify(), getParamDescriptions(), getRowDescriptions(), PQconnectPoll(), pqFunctionCall3(), pqGetNegotiateProtocolVersion3(), and pqParseInput3().
| int pqGetnchar | ( | void * | s, |
| size_t | len, | ||
| PGconn * | conn | ||
| ) |
Definition at line 165 of file fe-misc.c.
References conn, pg_conn::inBuffer, pg_conn::inCursor, pg_conn::inEnd, and len.
Referenced by getBackendKeyData(), pg_password_sendauth(), pg_SASL_continue(), and pqFunctionCall3().
| int pqGets | ( | PQExpBuffer | buf, |
| PGconn * | conn | ||
| ) |
Definition at line 136 of file fe-misc.c.
References buf, conn, and pqGets_internal().
Referenced by getNotify(), getParameterStatus(), getRowDescriptions(), pg_SASL_init(), pqGetErrorNotice3(), pqGetNegotiateProtocolVersion3(), and pqParseInput3().
| int pqGets_append | ( | PQExpBuffer | buf, |
| PGconn * | conn | ||
| ) |
Definition at line 142 of file fe-misc.c.
References buf, conn, and pqGets_internal().
Referenced by PQconnectPoll().
|
static |
Definition at line 109 of file fe-misc.c.
References appendBinaryPQExpBuffer(), buf, conn, pg_conn::inBuffer, pg_conn::inCursor, pg_conn::inEnd, and resetPQExpBuffer().
Referenced by pqGets(), and pqGets_append().
| int PQlibVersion | ( | void | ) |
| int PQmblen | ( | const char * | s, |
| int | encoding | ||
| ) |
Definition at line 1255 of file fe-misc.c.
References encoding, and pg_encoding_mblen().
Referenced by appendStringLiteral(), get_prompt(), pg_wcsformat(), pg_wcssize(), pg_wcswidth(), psqlscan_prepare_buffer(), and strlen_max_width().
| int PQmblenBounded | ( | const char * | s, |
| int | encoding | ||
| ) |
Definition at line 1266 of file fe-misc.c.
References encoding, pg_encoding_mblen(), and strnlen().
Referenced by command_no_begin(), dequote_downcase_identifier(), do_field(), patternToSQLRegex(), quote_if_needed(), reportErrorPosition(), skip_white_space(), splitTableColumnsSpec(), strip_quotes(), and strtokx().
| void pqParseDone | ( | PGconn * | conn, |
| int | newInStart | ||
| ) |
Definition at line 443 of file fe-misc.c.
References conn, pg_conn::inBuffer, pg_conn::inStart, pg_conn::Pfdebug, and pqTraceOutputMessage().
Referenced by getCopyDataMessage(), PQconnectPoll(), pqFunctionCall3(), pqGetCopyData3(), and pqParseInput3().
| int pqPutc | ( | char | c, |
| PGconn * | conn | ||
| ) |
Definition at line 92 of file fe-misc.c.
References conn, and pqPutMsgBytes().
Referenced by PQsendQueryGuts(), and PQsendTypedCommand().
| int pqPutInt | ( | int | value, |
| size_t | bytes, | ||
| PGconn * | conn | ||
| ) |
Definition at line 253 of file fe-misc.c.
References conn, pg_conn::noticeHooks, pg_hton16, pg_hton32, pqInternalNotice(), pqPutMsgBytes(), and value.
Referenced by pg_SASL_init(), pqFunctionCall3(), PQsendPrepare(), and PQsendQueryGuts().
|
static |
Definition at line 509 of file fe-misc.c.
References buf, conn, len, pg_conn::outBuffer, pg_conn::outMsgEnd, and pqCheckOutBufferSpace().
Referenced by pqPutc(), pqPutInt(), pqPutnchar(), and pqPuts().
| int pqPutMsgEnd | ( | PGconn * | conn | ) |
Definition at line 532 of file fe-misc.c.
References SockAddr::addr, Assert(), conn, pg_conn::outBuffer, pg_conn::outCount, pg_conn::outMsgEnd, pg_conn::outMsgStart, pg_conn::Pfdebug, pg_hton32, pqSendSome(), pqTraceOutputMessage(), pqTraceOutputNoTypeByteMessage(), pg_conn::raddr, and pg_conn::ssl_in_use.
Referenced by pg_SASL_init(), pqEndcopy3(), pqFunctionCall3(), pqPacketSend(), pqPipelineSyncInternal(), PQputCopyData(), PQputCopyEnd(), PQsendCancelRequest(), PQsendFlushRequest(), PQsendPrepare(), PQsendQueryGuts(), PQsendQueryInternal(), PQsendTypedCommand(), and sendTerminateConn().
| int pqPutMsgStart | ( | char | msg_type, |
| PGconn * | conn | ||
| ) |
Definition at line 473 of file fe-misc.c.
References conn, pg_conn::outBuffer, pg_conn::outCount, pg_conn::outMsgEnd, pg_conn::outMsgStart, and pqCheckOutBufferSpace().
Referenced by pg_SASL_init(), pqEndcopy3(), pqFunctionCall3(), pqPacketSend(), pqPipelineSyncInternal(), PQputCopyData(), PQputCopyEnd(), PQsendCancelRequest(), PQsendFlushRequest(), PQsendPrepare(), PQsendQueryGuts(), PQsendQueryInternal(), PQsendTypedCommand(), and sendTerminateConn().
| int pqPutnchar | ( | const void * | s, |
| size_t | len, | ||
| PGconn * | conn | ||
| ) |
Definition at line 202 of file fe-misc.c.
References conn, len, and pqPutMsgBytes().
Referenced by pg_SASL_init(), pqFunctionCall3(), pqPacketSend(), PQputCopyData(), PQsendCancelRequest(), and PQsendQueryGuts().
| int pqPuts | ( | const char * | s, |
| PGconn * | conn | ||
| ) |
Definition at line 152 of file fe-misc.c.
References conn, and pqPutMsgBytes().
Referenced by pg_SASL_init(), PQputCopyEnd(), PQsendPrepare(), PQsendQueryGuts(), PQsendQueryInternal(), and PQsendTypedCommand().
| int pqReadData | ( | PGconn * | conn | ) |
Definition at line 606 of file fe-misc.c.
References ALL_CONNECTION_FAILURE_ERRNOS, conn, CONNECTION_BAD, EAGAIN, EINTR, EWOULDBLOCK, pg_conn::inBuffer, pg_conn::inBufSize, pg_conn::inCursor, pg_conn::inEnd, pg_conn::inStart, libpq_append_conn_error(), PGINVALID_SOCKET, pqCheckInBufferSpace(), pqDropConnection(), pqReadReady(), pqsecure_read(), pg_conn::sock, SOCK_ERRNO, pg_conn::ssl_in_use, and pg_conn::status.
Referenced by PQcancelPoll(), PQconnectPoll(), PQconsumeInput(), pqFunctionCall3(), pqGetCopyData3(), pqGetline3(), PQgetResult(), and pqSendSome().
| int pqReadReady | ( | PGconn * | conn | ) |
Definition at line 1058 of file fe-misc.c.
References conn, and pqSocketCheck().
Referenced by gss_read(), and pqReadData().
|
static |
Definition at line 825 of file fe-misc.c.
References conn, EAGAIN, EINTR, EWOULDBLOCK, len, libpq_gettext, Min, pg_conn::outBuffer, pg_conn::outCount, PGINVALID_SOCKET, pqIsnonblocking, pqReadData(), pqsecure_write(), pqWait(), remaining, pg_conn::sock, SOCK_ERRNO, pg_conn::write_err_msg, and pg_conn::write_failed.
Referenced by pqFlush(), and pqPutMsgEnd().
| int pqSkipnchar | ( | size_t | len, |
| PGconn * | conn | ||
| ) |
Definition at line 187 of file fe-misc.c.
References conn, pg_conn::inCursor, pg_conn::inEnd, and len.
Referenced by getAnotherTuple().
|
static |
Definition at line 1083 of file fe-misc.c.
References pg_conn::altsock, conn, EINTR, end_time, libpq_append_conn_error(), PG_STRERROR_R_BUFLEN, PGINVALID_SOCKET, pgtls_read_pending(), PQsocketPoll(), pg_conn::sock, SOCK_ERRNO, SOCK_STRERROR, and pg_conn::ssl_in_use.
Referenced by pqReadReady(), pqWaitTimed(), and pqWriteReady().
| int PQsocketPoll | ( | int | sock, |
| int | forRead, | ||
| int | forWrite, | ||
| pg_usec_time_t | end_time | ||
| ) |
Definition at line 1141 of file fe-misc.c.
References end_time, now(), PQgetCurrentTimeUSec(), and select.
Referenced by pqSocketCheck(), timer_expired(), and wait_until_connected().
| int pqWait | ( | int | forRead, |
| int | forWrite, | ||
| PGconn * | conn | ||
| ) |
Definition at line 1019 of file fe-misc.c.
References conn, and pqWaitTimed().
Referenced by pqFunctionCall3(), pqGetCopyData3(), pqGetline3(), PQgetResult(), and pqSendSome().
| int pqWaitTimed | ( | int | forRead, |
| int | forWrite, | ||
| PGconn * | conn, | ||
| pg_usec_time_t | end_time | ||
| ) |
Definition at line 1035 of file fe-misc.c.
References conn, end_time, libpq_append_conn_error(), and pqSocketCheck().
Referenced by pqConnectDBComplete(), and pqWait().
| int pqWriteReady | ( | PGconn * | conn | ) |
Definition at line 1068 of file fe-misc.c.
References conn, and pqSocketCheck().