PostgreSQL Source Code
git master
|
#include "postgres_fe.h"
#include <signal.h>
#include <time.h>
#include <unistd.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, time_t end_time) |
static int | pqSocketPoll (int sock, int forRead, int forWrite, 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 (char *s, size_t len, PGconn *conn) |
int | pqSkipnchar (size_t len, PGconn *conn) |
int | pqPutnchar (const char *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) |
int | pqPutMsgStart (char msg_type, bool force_len, 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, time_t finish_time) |
int | pqReadReady (PGconn *conn) |
int | pqWriteReady (PGconn *conn) |
int | PQmblen (const char *s, int encoding) |
int | PQdsplen (const char *s, int encoding) |
int | PQenv2encoding (void) |
int pqCheckInBufferSpace | ( | size_t | bytes_needed, |
PGconn * | conn | ||
) |
Definition at line 394 of file fe-misc.c.
References appendPQExpBufferStr(), 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 330 of file fe-misc.c.
References appendPQExpBufferStr(), 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 1241 of file fe-misc.c.
References pg_encoding_dsplen().
Referenced by get_prompt(), pg_wcsformat(), pg_wcssize(), pg_wcswidth(), and strlen_max_width().
int PQenv2encoding | ( | void | ) |
Definition at line 1250 of file fe-misc.c.
References dgettext, dngettext, encoding, libpq_gettext, libpq_ngettext, pg_char_to_encoding(), PG_SQL_ASCII, PG_TEXTDOMAIN, and generate_unaccent_rules::str.
Referenced by main().
int pqFlush | ( | PGconn * | conn | ) |
Definition at line 1012 of file fe-misc.c.
References pg_conn::outCount, pg_conn::Pfdebug, and pqSendSome().
Referenced by pg_SASL_init(), PQconnectPoll(), PQconsumeInput(), pqEndcopy2(), pqEndcopy3(), PQflush(), pqFunctionCall2(), pqFunctionCall3(), PQgetResult(), pqPacketSend(), PQputCopyData(), PQputCopyEnd(), PQsendDescribe(), PQsendPrepare(), PQsendQueryGuts(), PQsendQueryInternal(), PQsetnonblocking(), and sendTerminateConn().
int pqGetc | ( | char * | result, |
PGconn * | conn | ||
) |
Definition at line 80 of file fe-misc.c.
References fprintf, pg_conn::inBuffer, pg_conn::inCursor, pg_conn::inEnd, and pg_conn::Pfdebug.
Referenced by getCopyDataMessage(), getCopyStart(), getReadyForQuery(), PQconnectPoll(), pqFunctionCall2(), pqFunctionCall3(), pqGetErrorNotice3(), pqParseInput2(), and pqParseInput3().
int pqGetInt | ( | int * | result, |
size_t | bytes, | ||
PGconn * | conn | ||
) |
Definition at line 253 of file fe-misc.c.
References fprintf, pg_conn::inBuffer, pg_conn::inCursor, pg_conn::inEnd, pg_conn::noticeHooks, pg_conn::Pfdebug, pg_ntoh16, pg_ntoh32, and pqInternalNotice().
Referenced by getAnotherTuple(), getCopyDataMessage(), getCopyStart(), getNotify(), getParamDescriptions(), getRowDescriptions(), PQconnectPoll(), pqFunctionCall2(), pqFunctionCall3(), pqParseInput2(), and pqParseInput3().
int pqGetnchar | ( | char * | s, |
size_t | len, | ||
PGconn * | conn | ||
) |
Definition at line 181 of file fe-misc.c.
References fprintf, pg_conn::inBuffer, pg_conn::inCursor, pg_conn::inEnd, and pg_conn::Pfdebug.
Referenced by getAnotherTuple(), pg_password_sendauth(), pg_SASL_continue(), pqFunctionCall2(), and pqFunctionCall3().
int pqGets | ( | PQExpBuffer | buf, |
PGconn * | conn | ||
) |
Definition at line 149 of file fe-misc.c.
References pqGets_internal().
Referenced by getNotify(), getParameterStatus(), getRowDescriptions(), pg_SASL_init(), pqGetErrorNotice2(), pqGetErrorNotice3(), pqParseInput2(), and pqParseInput3().
int pqGets_append | ( | PQExpBuffer | buf, |
PGconn * | conn | ||
) |
Definition at line 155 of file fe-misc.c.
References pqGets_internal().
Referenced by PQconnectPoll().
|
static |
Definition at line 118 of file fe-misc.c.
References appendBinaryPQExpBuffer(), PQExpBufferData::data, fprintf, pg_conn::inBuffer, pg_conn::inCursor, pg_conn::inEnd, pg_conn::Pfdebug, and resetPQExpBuffer().
Referenced by pqGets(), and pqGets_append().
int PQlibVersion | ( | void | ) |
int PQmblen | ( | const char * | s, |
int | encoding | ||
) |
Definition at line 1231 of file fe-misc.c.
References pg_encoding_mblen().
Referenced by appendStringLiteral(), command_no_begin(), do_field(), get_prompt(), is_select_command(), patternToSQLRegex(), pg_wcsformat(), pg_wcssize(), pg_wcswidth(), quote_if_needed(), skip_white_space(), splitTableColumnsSpec(), strip_quotes(), strlen_max_width(), and strtokx().
int pqPutc | ( | char | c, |
PGconn * | conn | ||
) |
Definition at line 98 of file fe-misc.c.
References fprintf, pg_conn::Pfdebug, and pqPutMsgBytes().
Referenced by PQsendDescribe(), and PQsendQueryGuts().
int pqPutInt | ( | int | value, |
size_t | bytes, | ||
PGconn * | conn | ||
) |
Definition at line 293 of file fe-misc.c.
References fprintf, pg_conn::noticeHooks, pg_conn::Pfdebug, pg_hton16, pg_hton32, pqInternalNotice(), and pqPutMsgBytes().
Referenced by pg_SASL_init(), pqFunctionCall2(), pqFunctionCall3(), PQsendPrepare(), and PQsendQueryGuts().
|
static |
Definition at line 550 of file fe-misc.c.
References pg_conn::outBuffer, pg_conn::outMsgEnd, and pqCheckOutBufferSpace().
Referenced by pqPutc(), pqPutInt(), pqPutnchar(), and pqPuts().
int pqPutMsgEnd | ( | PGconn * | conn | ) |
Definition at line 573 of file fe-misc.c.
References fprintf, pg_conn::outBuffer, pg_conn::outCount, pg_conn::outMsgEnd, pg_conn::outMsgStart, pg_conn::Pfdebug, pg_hton32, and pqSendSome().
Referenced by pg_SASL_init(), pqEndcopy3(), pqFunctionCall2(), pqFunctionCall3(), pqPacketSend(), PQputCopyData(), PQputCopyEnd(), PQsendDescribe(), PQsendPrepare(), PQsendQueryGuts(), PQsendQueryInternal(), and sendTerminateConn().
Definition at line 505 of file fe-misc.c.
References fprintf, pg_conn::outBuffer, pg_conn::outCount, pg_conn::outMsgEnd, pg_conn::outMsgStart, pg_conn::Pfdebug, PG_PROTOCOL_MAJOR, pqCheckOutBufferSpace(), and pg_conn::pversion.
Referenced by pg_SASL_init(), pqEndcopy3(), pqFunctionCall2(), pqFunctionCall3(), pqPacketSend(), PQputCopyData(), PQputCopyEnd(), PQsendDescribe(), PQsendPrepare(), PQsendQueryGuts(), PQsendQueryInternal(), and sendTerminateConn().
int pqPutnchar | ( | const char * | s, |
size_t | len, | ||
PGconn * | conn | ||
) |
Definition at line 232 of file fe-misc.c.
References fprintf, pg_conn::Pfdebug, and pqPutMsgBytes().
Referenced by pg_SASL_init(), pqFunctionCall2(), pqFunctionCall3(), pqPacketSend(), PQputCopyData(), PQputCopyEnd(), and PQsendQueryGuts().
int pqPuts | ( | const char * | s, |
PGconn * | conn | ||
) |
Definition at line 165 of file fe-misc.c.
References fprintf, pg_conn::Pfdebug, and pqPutMsgBytes().
Referenced by pg_SASL_init(), pqFunctionCall2(), PQputCopyEnd(), PQsendDescribe(), PQsendPrepare(), PQsendQueryGuts(), and PQsendQueryInternal().
int pqReadData | ( | PGconn * | conn | ) |
Definition at line 615 of file fe-misc.c.
References ALL_CONNECTION_FAILURE_ERRNOS, appendPQExpBufferStr(), CONNECTION_BAD, EAGAIN, EINTR, pg_conn::errorMessage, EWOULDBLOCK, pg_conn::inBuffer, pg_conn::inBufSize, pg_conn::inCursor, pg_conn::inEnd, pg_conn::inStart, libpq_gettext, PGINVALID_SOCKET, pqCheckInBufferSpace(), pqDropConnection(), pqReadReady(), pqsecure_read(), pg_conn::sock, SOCK_ERRNO, pg_conn::ssl_in_use, and pg_conn::status.
Referenced by PQconnectPoll(), PQconsumeInput(), pqFunctionCall2(), pqFunctionCall3(), pqGetCopyData2(), pqGetCopyData3(), pqGetline2(), pqGetline3(), PQgetResult(), pqSendSome(), and pqSetenvPoll().
int pqReadReady | ( | PGconn * | conn | ) |
Definition at line 1072 of file fe-misc.c.
References pqSocketCheck().
Referenced by gss_read(), and pqReadData().
|
static |
Definition at line 835 of file fe-misc.c.
References PQExpBufferData::data, EAGAIN, EINTR, pg_conn::errorMessage, EWOULDBLOCK, PQExpBufferData::len, libpq_gettext, Min, pg_conn::outBuffer, pg_conn::outCount, PGINVALID_SOCKET, PQExpBufferBroken, 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 210 of file fe-misc.c.
References fprintf, pg_conn::inBuffer, pg_conn::inCursor, pg_conn::inEnd, and pg_conn::Pfdebug.
Referenced by getAnotherTuple().
|
static |
Definition at line 1096 of file fe-misc.c.
References appendPQExpBuffer(), appendPQExpBufferStr(), EINTR, pg_conn::errorMessage, libpq_gettext, 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().
|
static |
int pqWait | ( | int | forRead, |
int | forWrite, | ||
PGconn * | conn | ||
) |
Definition at line 1035 of file fe-misc.c.
References pqWaitTimed().
Referenced by pqFunctionCall2(), pqFunctionCall3(), pqGetCopyData2(), pqGetCopyData3(), pqGetline2(), pqGetline3(), PQgetResult(), and pqSendSome().
int pqWaitTimed | ( | int | forRead, |
int | forWrite, | ||
PGconn * | conn, | ||
time_t | finish_time | ||
) |
Definition at line 1048 of file fe-misc.c.
References appendPQExpBufferStr(), pg_conn::errorMessage, libpq_gettext, and pqSocketCheck().
Referenced by connectDBComplete(), and pqWait().
int pqWriteReady | ( | PGconn * | conn | ) |
Definition at line 1082 of file fe-misc.c.
References pqSocketCheck().