PostgreSQL Source Code
git master
|
#include "libpq-events.h"
#include <netdb.h>
#include <sys/socket.h>
#include <time.h>
#include <pthread.h>
#include <signal.h>
#include "libpq/pqcomm.h"
#include "fe-auth-sasl.h"
#include "pqexpbuffer.h"
#include "common/pg_prng.h"
Go to the source code of this file.
Data Structures | |
union | pgresult_data |
struct | pgresParamDesc |
struct | pgresAttValue |
struct | pgMessageField |
struct | PGNoticeHooks |
struct | PGEvent |
struct | pg_result |
struct | PQEnvironmentOption |
struct | pgParameterStatus |
struct | pgLobjfuncs |
struct | pgDataValue |
struct | PGcmdQueueEntry |
struct | pg_conn_host |
struct | pg_conn |
Macros | |
#define | CMDSTATUS_LEN 64 /* should match COMPLETION_TAG_BUFSIZE */ |
#define | NULL_LEN (-1) /* pg_result len for NULL value */ |
#define | ENC_ERROR 0 |
#define | ENC_PLAINTEXT 0x01 |
#define | ENC_GSSAPI 0x02 |
#define | ENC_SSL 0x04 |
#define | AUTH_RESPONSE_GSS 'G' |
#define | AUTH_RESPONSE_PASSWORD 'P' |
#define | AUTH_RESPONSE_SASL_INITIAL 'I' |
#define | AUTH_RESPONSE_SASL 'S' |
#define | pglock_thread() pg_g_threadlock(true) |
#define | pgunlock_thread() pg_g_threadlock(false) |
#define | pqClearConnErrorState(conn) |
#define | pgHavePendingResult(conn) ((conn)->result != NULL || (conn)->error_result) |
#define | pqIsnonblocking(conn) ((conn)->nonblocking) |
#define | OUTBUFFER_THRESHOLD 65536 |
#define | libpq_gettext(x) (x) |
#define | libpq_ngettext(s, p, n) ((n) == 1 ? (s) : (p)) |
#define | SOCK_ERRNO errno |
#define | SOCK_STRERROR strerror_r |
#define | SOCK_ERRNO_SET(e) (errno = (e)) |
Typedefs | |
typedef union pgresult_data | PGresult_data |
typedef struct pgresParamDesc | PGresParamDesc |
typedef struct pgresAttValue | PGresAttValue |
typedef struct pgMessageField | PGMessageField |
typedef struct PGEvent | PGEvent |
typedef struct PQEnvironmentOption | PQEnvironmentOption |
typedef struct pgParameterStatus | pgParameterStatus |
typedef struct pgLobjfuncs | PGlobjfuncs |
typedef struct pgDataValue | PGdataValue |
typedef enum pg_conn_host_type | pg_conn_host_type |
typedef struct PGcmdQueueEntry | PGcmdQueueEntry |
typedef struct pg_conn_host | pg_conn_host |
Enumerations | |
enum | PGAsyncStatusType { PGASYNC_IDLE , PGASYNC_BUSY , PGASYNC_READY , PGASYNC_READY_MORE , PGASYNC_COPY_IN , PGASYNC_COPY_OUT , PGASYNC_COPY_BOTH , PGASYNC_PIPELINE_IDLE } |
enum | PGTargetServerType { SERVER_TYPE_ANY = 0 , SERVER_TYPE_READ_WRITE , SERVER_TYPE_READ_ONLY , SERVER_TYPE_PRIMARY , SERVER_TYPE_STANDBY , SERVER_TYPE_PREFER_STANDBY , SERVER_TYPE_PREFER_STANDBY_PASS2 } |
enum | PGLoadBalanceType { LOAD_BALANCE_DISABLE = 0 , LOAD_BALANCE_RANDOM } |
enum | PGTernaryBool { PG_BOOL_UNKNOWN = 0 , PG_BOOL_YES , PG_BOOL_NO } |
enum | pg_conn_host_type { CHT_HOST_NAME , CHT_HOST_ADDRESS , CHT_UNIX_SOCKET } |
enum | PGQueryClass { PGQUERY_SIMPLE , PGQUERY_EXTENDED , PGQUERY_PREPARE , PGQUERY_DESCRIBE , PGQUERY_SYNC , PGQUERY_CLOSE } |
Variables | |
char *const | pgresStatus [] |
pgthreadlock_t | pg_g_threadlock |
#define AUTH_RESPONSE_GSS 'G' |
Definition at line 341 of file libpq-int.h.
#define AUTH_RESPONSE_PASSWORD 'P' |
Definition at line 342 of file libpq-int.h.
#define AUTH_RESPONSE_SASL 'S' |
Definition at line 344 of file libpq-int.h.
#define AUTH_RESPONSE_SASL_INITIAL 'I' |
Definition at line 343 of file libpq-int.h.
#define CMDSTATUS_LEN 64 /* should match COMPLETION_TAG_BUFSIZE */ |
Definition at line 89 of file libpq-int.h.
#define ENC_ERROR 0 |
Definition at line 235 of file libpq-int.h.
#define ENC_GSSAPI 0x02 |
Definition at line 237 of file libpq-int.h.
#define ENC_PLAINTEXT 0x01 |
Definition at line 236 of file libpq-int.h.
#define ENC_SSL 0x04 |
Definition at line 238 of file libpq-int.h.
Definition at line 905 of file libpq-int.h.
#define libpq_ngettext | ( | s, | |
p, | |||
n | |||
) | ((n) == 1 ? (s) : (p)) |
Definition at line 906 of file libpq-int.h.
Definition at line 136 of file libpq-int.h.
#define OUTBUFFER_THRESHOLD 65536 |
Definition at line 899 of file libpq-int.h.
Definition at line 887 of file libpq-int.h.
#define pglock_thread | ( | ) | pg_g_threadlock(true) |
Definition at line 703 of file libpq-int.h.
#define pgunlock_thread | ( | ) | pg_g_threadlock(false) |
Definition at line 704 of file libpq-int.h.
#define pqClearConnErrorState | ( | conn | ) |
Definition at line 878 of file libpq-int.h.
Definition at line 894 of file libpq-int.h.
#define SOCK_ERRNO errno |
Definition at line 926 of file libpq-int.h.
Definition at line 928 of file libpq-int.h.
#define SOCK_STRERROR strerror_r |
Definition at line 927 of file libpq-int.h.
typedef struct pg_conn_host pg_conn_host |
typedef enum pg_conn_host_type pg_conn_host_type |
typedef struct PGcmdQueueEntry PGcmdQueueEntry |
typedef struct pgDataValue PGdataValue |
typedef struct pgLobjfuncs PGlobjfuncs |
typedef struct pgMessageField PGMessageField |
typedef struct pgParameterStatus pgParameterStatus |
typedef struct pgresAttValue PGresAttValue |
typedef struct pgresParamDesc PGresParamDesc |
typedef union pgresult_data PGresult_data |
Definition at line 1 of file libpq-int.h.
typedef struct PQEnvironmentOption PQEnvironmentOption |
enum pg_conn_host_type |
Enumerator | |
---|---|
CHT_HOST_NAME | |
CHT_HOST_ADDRESS | |
CHT_UNIX_SOCKET |
Definition at line 313 of file libpq-int.h.
enum PGAsyncStatusType |
Enumerator | |
---|---|
PGASYNC_IDLE | |
PGASYNC_BUSY | |
PGASYNC_READY | |
PGASYNC_READY_MORE | |
PGASYNC_COPY_IN | |
PGASYNC_COPY_OUT | |
PGASYNC_COPY_BOTH | |
PGASYNC_PIPELINE_IDLE |
Definition at line 219 of file libpq-int.h.
enum PGLoadBalanceType |
enum PGQueryClass |
Enumerator | |
---|---|
PGQUERY_SIMPLE | |
PGQUERY_EXTENDED | |
PGQUERY_PREPARE | |
PGQUERY_DESCRIBE | |
PGQUERY_SYNC | |
PGQUERY_CLOSE |
Definition at line 324 of file libpq-int.h.
enum PGTargetServerType |
Enumerator | |
---|---|
SERVER_TYPE_ANY | |
SERVER_TYPE_READ_WRITE | |
SERVER_TYPE_READ_ONLY | |
SERVER_TYPE_PRIMARY | |
SERVER_TYPE_STANDBY | |
SERVER_TYPE_PREFER_STANDBY | |
SERVER_TYPE_PREFER_STANDBY_PASS2 |
Definition at line 241 of file libpq-int.h.
enum PGTernaryBool |
void void libpq_append_conn_error | ( | PGconn * | conn, |
const char * | fmt, | ||
... | |||
) |
void libpq_append_error | ( | PQExpBuffer | errorMessage, |
const char * | fmt, | ||
... | |||
) |
void pgtls_close | ( | PGconn * | conn | ) |
Definition at line 1440 of file fe-secure-openssl.c.
References conn, pg_conn::ssl_handshake_started, and pg_conn::ssl_in_use.
Referenced by open_client_SSL(), pgtls_open_client(), and pqsecure_close().
char* pgtls_get_peer_certificate_hash | ( | PGconn * | conn, |
size_t * | len | ||
) |
Definition at line 339 of file fe-secure-openssl.c.
References conn, hash(), len, libpq_append_conn_error(), and malloc.
Referenced by build_client_final_message().
PostgresPollingStatusType pgtls_open_client | ( | PGconn * | conn | ) |
Definition at line 95 of file fe-secure-openssl.c.
References conn, initialize_SSL(), open_client_SSL(), PGRES_POLLING_FAILED, and pgtls_close().
Referenced by pqsecure_open_client().
ssize_t pgtls_read | ( | PGconn * | conn, |
void * | ptr, | ||
size_t | len | ||
) |
Definition at line 117 of file fe-secure-openssl.c.
References appendPQExpBufferStr(), conn, ECONNRESET, err(), pg_conn::errorMessage, len, libpq_append_conn_error(), PG_STRERROR_R_BUFLEN, SOCK_ERRNO, SOCK_ERRNO_SET, SOCK_STRERROR, SSLerrfree(), and SSLerrmessage().
Referenced by pqsecure_read().
int pgtls_verify_peer_name_matches_certificate_guts | ( | PGconn * | conn, |
int * | names_examined, | ||
char ** | first_name | ||
) |
Definition at line 543 of file fe-secure-openssl.c.
References Assert, conn, pg_conn::connhost, free, pg_conn_host::host, i, is_ip_address(), name, openssl_verify_peer_name_matches_certificate_ip(), openssl_verify_peer_name_matches_certificate_name(), and pg_conn::whichhost.
Referenced by pq_verify_peer_name_matches_certificate().
ssize_t pgtls_write | ( | PGconn * | conn, |
const void * | ptr, | ||
size_t | len | ||
) |
Definition at line 239 of file fe-secure-openssl.c.
References appendPQExpBufferStr(), conn, ECONNRESET, err(), pg_conn::errorMessage, len, libpq_append_conn_error(), PG_STRERROR_R_BUFLEN, SOCK_ERRNO, SOCK_ERRNO_SET, SOCK_STRERROR, SSLerrfree(), and SSLerrmessage().
Referenced by pqsecure_write().
int pq_block_sigpipe | ( | sigset_t * | osigset, |
bool * | sigpipe_pending | ||
) |
Definition at line 504 of file fe-secure.c.
References SIGPIPE, SOCK_ERRNO, and SOCK_ERRNO_SET.
Referenced by PQprint().
Definition at line 554 of file fe-secure.c.
References SIGPIPE, SOCK_ERRNO, and SOCK_ERRNO_SET.
Referenced by PQprint().
void pqBuildErrorMessage3 | ( | PQExpBuffer | msg, |
const PGresult * | res, | ||
PGVerbosity | verbosity, | ||
PGContextVisibility | show_context | ||
) |
Definition at line 1010 of file fe-protocol3.c.
References appendPQExpBuffer(), appendPQExpBufferChar(), appendPQExpBufferStr(), pg_result::client_encoding, pg_result::errFields, pg_result::errMsg, pg_result::errQuery, 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(), res, pg_result::resultStatus, and val.
Referenced by pqGetErrorNotice3(), and PQresultVerboseErrorMessage().
char* pqBuildStartupPacket3 | ( | PGconn * | conn, |
int * | packetlen, | ||
const PQEnvironmentOption * | options | ||
) |
Definition at line 2231 of file fe-protocol3.c.
References build_startup_packet(), conn, and malloc.
Referenced by PQconnectPoll().
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().
void pqClearAsyncResult | ( | PGconn * | conn | ) |
Definition at line 779 of file fe-exec.c.
References conn, pg_conn::error_result, PQclear(), pg_conn::result, and pg_conn::saved_result.
Referenced by getAnotherTuple(), getParamDescriptions(), getRowDescriptions(), pqClosePGconn(), PQconnectPoll(), pqGetErrorNotice3(), pqPipelineProcessQueue(), pqSaveErrorResult(), and PQsendQueryStart().
void pqClosePGconn | ( | PGconn * | conn | ) |
Definition at line 4847 of file fe-connect.c.
References pg_conn::asyncStatus, pg_conn::cancelRequest, conn, CONNECTION_BAD, pg_conn::nonblocking, PGASYNC_IDLE, pg_conn::pipelineStatus, PQ_PIPELINE_OFF, pqClearAsyncResult(), pqClearConnErrorState, pqDropConnection(), pqDropServerData(), PQTRANS_IDLE, release_conn_addrinfo(), sendTerminateConn(), pg_conn::status, and pg_conn::xactStatus.
Referenced by PQcancelReset(), PQfinish(), PQreset(), and PQresetStart().
Definition at line 3142 of file fe-exec.c.
References pg_conn::cmd_queue_head, pg_conn::cmd_queue_tail, conn, PGcmdQueueEntry::next, PGQUERY_SIMPLE, PGQUERY_SYNC, pqRecycleCmdQueueEntry(), and PGcmdQueueEntry::queryclass.
Referenced by PQgetResult(), and pqParseInput3().
int pqConnectDBComplete | ( | PGconn * | conn | ) |
Definition at line 2471 of file fe-connect.c.
References pg_conn::cancelRequest, conn, pg_conn::connect_timeout, CONNECTION_BAD, CONNECTION_NEEDED, end_time, flag(), PGRES_POLLING_OK, PGRES_POLLING_READING, PGRES_POLLING_WRITING, PQcancelPoll(), PQconnectPoll(), PQgetCurrentTimeUSec(), pqParseIntParam(), pqWaitTimed(), pg_conn::status, pg_conn::try_next_addr, pg_conn::whichaddr, and pg_conn::whichhost.
Referenced by internal_ping(), PQcancelBlocking(), PQconnectdb(), PQconnectdbParams(), PQreset(), and PQsetdbLogin().
int pqConnectDBStart | ( | PGconn * | conn | ) |
Definition at line 2393 of file fe-connect.c.
References appendPQExpBufferStr(), pg_conn::cancelRequest, conn, CONNECTION_BAD, CONNECTION_NEEDED, pg_conn::errorMessage, pg_conn::inCursor, pg_conn::inEnd, pg_conn::inStart, pg_conn::options_valid, pg_conn::outCount, pg_link_canary_is_frontend(), PGRES_POLLING_WRITING, PQconnectPoll(), pqDropConnection(), SERVER_TYPE_PREFER_STANDBY, SERVER_TYPE_PREFER_STANDBY_PASS2, pg_conn::status, pg_conn::target_server_type, pg_conn::try_next_addr, pg_conn::try_next_host, and pg_conn::whichhost.
Referenced by PQcancelStart(), PQconnectStart(), PQconnectStartParams(), PQreset(), PQresetStart(), and PQsetdbLogin().
Definition at line 1121 of file fe-connect.c.
References pg_conn::allowed_auth_methods, Assert, AUTH_REQ_GSS, AUTH_REQ_GSS_CONT, AUTH_REQ_MD5, AUTH_REQ_PASSWORD, AUTH_REQ_SASL, AUTH_REQ_SASL_CONT, AUTH_REQ_SASL_FIN, AUTH_REQ_SSPI, pg_conn::auth_required, calloc, pg_conn::channel_binding, CHT_HOST_ADDRESS, CHT_HOST_NAME, CHT_UNIX_SOCKET, pg_conn::client_encoding_initial, conn, CONNECTION_BAD, pg_conn::connhost, count_comma_separated_elems(), pg_conn::dbName, DEFAULT_PGSOCKET_DIR, DefaultChannelBinding, DefaultGSSMode, DefaultHost, DefaultSSLCertMode, DefaultSSLMode, DefaultSSLNegotiation, pg_conn::errorMessage, free, pg_conn::gssencmode, pg_conn_host::host, pg_conn_host::hostaddr, i, is_unixsock_path(), j, libpq_append_conn_error(), libpq_prng_init(), LOAD_BALANCE_DISABLE, pg_conn::load_balance_hosts, LOAD_BALANCE_RANDOM, pg_conn::load_balance_type, malloc, MAXPGPATH, pg_conn::nconnhost, pg_conn::options_valid, parse_comma_separated_list(), pg_conn_host::password, passwordFromFile(), pg_encoding_to_char, pg_fe_getauthname(), pg_get_encoding_from_locale(), pg_prng_uint64_range(), pg_conn::pghost, pg_conn::pghostaddr, pg_conn::pgpass, PGPASSFILE, pg_conn::pgpassfile, pg_conn::pgport, pg_conn::pguser, pg_conn_host::port, pqGetHomeDirectory(), pg_conn::prng_state, pg_conn::require_auth, SERVER_TYPE_ANY, SERVER_TYPE_PREFER_STANDBY, SERVER_TYPE_PRIMARY, SERVER_TYPE_READ_ONLY, SERVER_TYPE_READ_WRITE, SERVER_TYPE_STANDBY, snprintf, pg_conn::ssl_max_protocol_version, pg_conn::ssl_min_protocol_version, pg_conn::sslcertmode, pg_conn::sslmode, pg_conn::sslnegotiation, pg_conn::sslrootcert, sslVerifyProtocolRange(), sslVerifyProtocolVersion(), pg_conn::status, pg_conn::target_server_type, pg_conn::target_session_attrs, pg_conn_host::type, and pg_conn::whichhost.
Referenced by PQcancelCreate(), PQconnectStart(), PQconnectStartParams(), and PQsetdbLogin().
Definition at line 957 of file fe-connect.c.
References free, libpq_append_conn_error(), and PQconninfoOptions.
Referenced by PQcancelCreate().
Definition at line 472 of file fe-connect.c.
References closesocket, pg_conn::cmd_queue_head, pg_conn::cmd_queue_recycle, pg_conn::cmd_queue_tail, conn, free, pg_fe_sasl_mech::free, pg_conn::inCursor, pg_conn::inEnd, pg_conn::inStart, pg_conn::outCount, PGINVALID_SOCKET, pqFreeCommandQueue(), pqsecure_close(), pg_conn::sasl, pg_conn::sasl_state, and pg_conn::sock.
Referenced by handleSyncLoss(), pqClosePGconn(), pqConnectDBStart(), PQconnectPoll(), and pqReadData().
int pqEndcopy3 | ( | PGconn * | conn | ) |
Definition at line 1908 of file fe-protocol3.c.
References pg_conn::asyncStatus, pg_conn::cmd_queue_head, conn, PQExpBufferData::data, pg_conn::errorMessage, 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().
int pqFlush | ( | PGconn * | conn | ) |
Definition at line 968 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(), pqPipelineSyncInternal(), PQputCopyData(), PQputCopyEnd(), PQsendQueryInternal(), PQsetnonblocking(), and sendTerminateConn().
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 2001 of file fe-protocol3.c.
References generate_unaccent_rules::args, Assert, conn, getNotify(), getParameterStatus(), getReadyForQuery(), 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_FunctionCall, pqParseDone(), pqPrepareAsyncResult(), pqPutInt(), pqPutMsgEnd(), pqPutMsgStart(), pqPutnchar(), pqReadData(), pqSaveErrorResult(), pqWait(), pg_conn::result, and VALID_LONG_MESSAGE_TYPE.
Referenced by PQfn().
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().
int pqGetCopyData3 | ( | PGconn * | conn, |
char ** | buffer, | ||
int | async | ||
) |
Definition at line 1743 of file fe-protocol3.c.
References conn, getCopyDataMessage(), pg_conn::inBuffer, pg_conn::inCursor, libpq_append_conn_error(), malloc, pqParseDone(), pqReadData(), and pqWait().
Referenced by PQgetCopyData().
Definition at line 878 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, 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, res, resetPQExpBuffer(), pg_conn::result, pg_result::resultStatus, pg_conn::show_context, strlcpy(), termPQExpBuffer(), and pg_conn::verbosity.
Referenced by getCopyDataMessage(), PQconnectPoll(), pqFunctionCall3(), and pqParseInput3().
bool pqGetHomeDirectory | ( | char * | buf, |
int | bufsize | ||
) |
Definition at line 7697 of file fe-connect.c.
References buf, bufsize, snprintf, strlcpy(), and tmpbuf.
Referenced by initialize_SSL(), parseServiceInfo(), and pqConnectOptions2().
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(), getCopyDataMessage(), getCopyStart(), getNotify(), getParamDescriptions(), getRowDescriptions(), PQconnectPoll(), pqFunctionCall3(), pqGetNegotiateProtocolVersion3(), and pqParseInput3().
int pqGetline3 | ( | PGconn * | conn, |
char * | s, | ||
int | maxlen | ||
) |
Definition at line 1802 of file fe-protocol3.c.
References pg_conn::asyncStatus, conn, pg_conn::copy_is_binary, libpq_append_conn_error(), PGASYNC_COPY_BOTH, PGASYNC_COPY_OUT, PGINVALID_SOCKET, PQgetlineAsync(), pqReadData(), pqWait(), and pg_conn::sock.
Referenced by PQgetline().
int pqGetlineAsync3 | ( | PGconn * | conn, |
char * | buffer, | ||
int | bufsize | ||
) |
Definition at line 1853 of file fe-protocol3.c.
References pg_conn::asyncStatus, bufsize, conn, pg_conn::copy_already_done, getCopyDataMessage(), pg_conn::inBuffer, pg_conn::inCursor, pg_conn::inStart, PGASYNC_COPY_BOTH, and PGASYNC_COPY_OUT.
Referenced by PQgetlineAsync().
int pqGetnchar | ( | char * | 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 pg_password_sendauth(), pg_SASL_continue(), and pqFunctionCall3().
int pqGetNegotiateProtocolVersion3 | ( | PGconn * | conn | ) |
Definition at line 1408 of file fe-protocol3.c.
References appendPQExpBuffer(), appendPQExpBufferChar(), appendPQExpBufferStr(), buf, conn, PQExpBufferData::data, pg_conn::errorMessage, i, initPQExpBuffer(), libpq_append_conn_error(), libpq_ngettext, PG_PROTOCOL_MAJOR, PG_PROTOCOL_MINOR, pqGetInt(), pqGets(), pg_conn::pversion, termPQExpBuffer(), and pg_conn::workBuffer.
Referenced by PQconnectPoll().
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().
void pqInternalNotice | ( | const PGNoticeHooks * | hooks, |
const char * | fmt, | ||
... | |||
) |
PGconn* pqMakeEmptyPGconn | ( | void | ) |
Definition at line 4550 of file fe-connect.c.
References pg_conn::asyncStatus, pg_conn::client_encoding, conn, CONNECTION_BAD, pg_conn::default_transaction_read_only, defaultNoticeProcessor(), defaultNoticeReceiver(), pg_conn::errorMessage, freePGconn(), pg_conn::in_hot_standby, pg_conn::inBuffer, pg_conn::inBufSize, initPQExpBuffer(), malloc, MemSet, pg_conn::nonblocking, pg_conn::noticeHooks, PGNoticeHooks::noticeProc, PGNoticeHooks::noticeRec, pg_conn::options_valid, pg_conn::outBuffer, pg_conn::outBufSize, pg_conn::Pfdebug, PG_BOOL_UNKNOWN, PG_SQL_ASCII, PGASYNC_IDLE, PGINVALID_SOCKET, pg_conn::pipelineStatus, PQ_PIPELINE_OFF, PQERRORS_DEFAULT, PQExpBufferBroken, PQSHOW_CONTEXT_ERRORS, PQTRANS_IDLE, pg_conn::rowBuf, pg_conn::rowBufLen, SCRAM_SHA_256_DEFAULT_ITERATIONS, pg_conn::scram_sha_256_iterations, pg_conn::show_context, pg_conn::sock, pg_conn::status, pg_conn::std_strings, pg_conn::verbosity, pg_conn::workBuffer, and pg_conn::xactStatus.
Referenced by PQcancelCreate(), PQconnectStart(), PQconnectStartParams(), and PQsetdbLogin().
int pqPacketSend | ( | PGconn * | conn, |
char | pack_type, | ||
const void * | buf, | ||
size_t | buf_len | ||
) |
Definition at line 5001 of file fe-connect.c.
References buf, conn, pqFlush(), pqPutMsgEnd(), pqPutMsgStart(), pqPutnchar(), STATUS_ERROR, and STATUS_OK.
Referenced by pg_password_sendauth(), pg_SASL_continue(), and PQconnectPoll().
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().
void pqParseInput3 | ( | PGconn * | conn | ) |
Definition at line 66 of file fe-protocol3.c.
References pg_conn::asyncStatus, pg_conn::be_key, pg_conn::be_pid, pg_conn::cmd_queue_head, pg_result::cmdStatus, CMDSTATUS_LEN, conn, pg_conn::copy_already_done, PQExpBufferData::data, pg_conn::error_result, getAnotherTuple(), getCopyStart(), getNotify(), getParamDescriptions(), getParameterStatus(), getReadyForQuery(), getRowDescriptions(), 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, strlcpy(), VALID_LONG_MESSAGE_TYPE, and pg_conn::workBuffer.
Referenced by parseInput().
Definition at line 7738 of file fe-connect.c.
References Assert, conn, context, error(), libpq_append_conn_error(), and value.
Referenced by pqConnectDBComplete(), PQconnectPoll(), PQgetCancel(), setKeepalivesCount(), setKeepalivesIdle(), setKeepalivesInterval(), setTCPUserTimeout(), and useKeepalives().
Definition at line 851 of file fe-exec.c.
References conn, pg_conn::error_result, pg_conn::errorMessage, pg_conn::errorReported, PQExpBufferData::len, libpq_append_conn_error(), OOM_result, PGRES_EMPTY_QUERY, PGRES_FATAL_ERROR, PQmakeEmptyPGresult(), pqSetResultError(), res, pg_conn::result, pg_result::resultStatus, pg_conn::saved_result, and unconstify.
Referenced by getCopyResult(), pqFunctionCall3(), and PQgetResult().
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().
int pqPutMsgEnd | ( | PGconn * | conn | ) |
Definition at line 532 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(), pqPipelineSyncInternal(), PQputCopyData(), PQputCopyEnd(), 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(), PQsendFlushRequest(), PQsendPrepare(), PQsendQueryGuts(), PQsendQueryInternal(), PQsendTypedCommand(), and sendTerminateConn().
int pqPutnchar | ( | const char * |