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, 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 | PQmblenBounded (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 354 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 290 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 1205 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 1214 of file fe-misc.c.
References encoding, pg_char_to_encoding(), PG_SQL_ASCII, and generate_unaccent_rules::str.
Referenced by main().
int pqFlush | ( | PGconn * | conn | ) |
Definition at line 958 of file fe-misc.c.
References conn, fflush(), pg_conn::outCount, pg_conn::Pfdebug, and pqSendSome().
Referenced by pg_SASL_init(), PQconnectPoll(), PQconsumeInput(), pqEndcopy3(), PQexitPipelineMode(), PQflush(), pqFunctionCall3(), PQgetResult(), pqPacketSend(), pqPipelineFlush(), PQputCopyData(), PQputCopyEnd(), PQsetnonblocking(), and sendTerminateConn().
int pqGetc | ( | char * | result, |
PGconn * | conn | ||
) |
Definition at line 80 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().
int pqGetInt | ( | int * | result, |
size_t | bytes, | ||
PGconn * | conn | ||
) |
Definition at line 219 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(), getCopyDataMessage(), getCopyStart(), getNotify(), getParamDescriptions(), getRowDescriptions(), PQconnectPoll(), pqFunctionCall3(), and pqParseInput3().
int pqGetnchar | ( | char * | s, |
size_t | len, | ||
PGconn * | conn | ||
) |
Definition at line 168 of file fe-misc.c.
References conn, pg_conn::inBuffer, pg_conn::inCursor, pg_conn::inEnd, and len.
Referenced by pg_password_sendauth(), pg_SASL_continue(), and pqFunctionCall3().
int pqGets | ( | PQExpBuffer | buf, |
PGconn * | conn | ||
) |
Definition at line 139 of file fe-misc.c.
References buf, conn, and pqGets_internal().
Referenced by getNotify(), getParameterStatus(), getRowDescriptions(), pg_SASL_init(), pqGetErrorNotice3(), and pqParseInput3().
int pqGets_append | ( | PQExpBuffer | buf, |
PGconn * | conn | ||
) |
Definition at line 145 of file fe-misc.c.
References buf, conn, and pqGets_internal().
Referenced by PQconnectPoll().
|
static |
Definition at line 112 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 1185 of file fe-misc.c.
References encoding, and pg_encoding_mblen().
Referenced by appendStringLiteral(), get_prompt(), pg_wcsformat(), pg_wcssize(), pg_wcswidth(), and strlen_max_width().
int PQmblenBounded | ( | const char * | s, |
int | encoding | ||
) |
Definition at line 1195 of file fe-misc.c.
References encoding, pg_encoding_mblen(), and strnlen().
Referenced by command_no_begin(), do_field(), is_select_command(), patternToSQLRegex(), quote_if_needed(), reportErrorPosition(), skip_white_space(), splitTableColumnsSpec(), strip_quotes(), and strtokx().
int pqPutc | ( | char | c, |
PGconn * | conn | ||
) |
Definition at line 95 of file fe-misc.c.
References conn, and pqPutMsgBytes().
Referenced by PQsendDescribe(), PQsendQueryGuts(), and PQsendQueryInternal().
int pqPutInt | ( | int | value, |
size_t | bytes, | ||
PGconn * | conn | ||
) |
Definition at line 256 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(), PQsendQueryGuts(), and PQsendQueryInternal().
|
static |
Definition at line 497 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 520 of file fe-misc.c.
References conn, pg_conn::outBuffer, pg_conn::outCount, pg_conn::outMsgEnd, pg_conn::outMsgStart, pg_conn::Pfdebug, pg_hton32, pqSendSome(), pqTraceOutputMessage(), and pqTraceOutputNoTypeByteMessage().
Referenced by pg_SASL_init(), pqEndcopy3(), pqFunctionCall3(), pqPacketSend(), PQpipelineSync(), PQputCopyData(), PQputCopyEnd(), PQsendDescribe(), PQsendFlushRequest(), PQsendPrepare(), PQsendQueryGuts(), PQsendQueryInternal(), and sendTerminateConn().
int pqPutMsgStart | ( | char | msg_type, |
PGconn * | conn | ||
) |
Definition at line 461 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(), PQpipelineSync(), PQputCopyData(), PQputCopyEnd(), PQsendDescribe(), PQsendFlushRequest(), PQsendPrepare(), PQsendQueryGuts(), PQsendQueryInternal(), and sendTerminateConn().
int pqPutnchar | ( | const char * | s, |
size_t | len, | ||
PGconn * | conn | ||
) |
Definition at line 205 of file fe-misc.c.
References conn, len, and pqPutMsgBytes().
Referenced by pg_SASL_init(), pqFunctionCall3(), pqPacketSend(), PQputCopyData(), and PQsendQueryGuts().
int pqPuts | ( | const char * | s, |
PGconn * | conn | ||
) |
Definition at line 155 of file fe-misc.c.
References conn, and pqPutMsgBytes().
Referenced by pg_SASL_init(), PQputCopyEnd(), PQsendDescribe(), PQsendPrepare(), PQsendQueryGuts(), and PQsendQueryInternal().
int pqReadData | ( | PGconn * | conn | ) |
Definition at line 568 of file fe-misc.c.
References ALL_CONNECTION_FAILURE_ERRNOS, appendPQExpBufferStr(), conn, 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(), pqFunctionCall3(), pqGetCopyData3(), pqGetline3(), PQgetResult(), and pqSendSome().
int pqReadReady | ( | PGconn * | conn | ) |
Definition at line 1020 of file fe-misc.c.
References conn, and pqSocketCheck().
Referenced by gss_read(), and pqReadData().
|
static |
Definition at line 789 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 190 of file fe-misc.c.
References conn, pg_conn::inCursor, pg_conn::inEnd, and len.
Referenced by getAnotherTuple().
|
static |
Definition at line 1044 of file fe-misc.c.
References appendPQExpBuffer(), appendPQExpBufferStr(), conn, EINTR, end_time, 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 983 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, | ||
time_t | finish_time | ||
) |
Definition at line 996 of file fe-misc.c.
References appendPQExpBufferStr(), conn, pg_conn::errorMessage, libpq_gettext, and pqSocketCheck().
Referenced by connectDBComplete(), and pqWait().
int pqWriteReady | ( | PGconn * | conn | ) |
Definition at line 1030 of file fe-misc.c.
References conn, and pqSocketCheck().