PostgreSQL Source Code
git master
|
#include "libpq-events.h"
#include <time.h>
#include "getaddrinfo.h"
#include "libpq/pqcomm.h"
#include "pqexpbuffer.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 | pg_conn_host |
struct | pg_conn |
struct | pg_cancel |
Macros | |
#define | CMDSTATUS_LEN 64 /* should match COMPLETION_TAG_BUFSIZE */ |
#define | NULL_LEN (-1) /* pg_result len for NULL value */ |
#define | pglock_thread() ((void) 0) |
#define | pgunlock_thread() ((void) 0) |
#define | pqIsnonblocking(conn) ((conn)->nonblocking) |
#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 pg_conn_host | pg_conn_host |
Functions | |
void | pqDropConnection (PGconn *conn, bool flushInput) |
int | pqPacketSend (PGconn *conn, char pack_type, const void *buf, size_t buf_len) |
bool | pqGetHomeDirectory (char *buf, int bufsize) |
void | pqSetResultError (PGresult *res, const char *msg) |
void | pqCatenateResultError (PGresult *res, const char *msg) |
void * | pqResultAlloc (PGresult *res, size_t nBytes, bool isBinary) |
char * | pqResultStrdup (PGresult *res, const char *str) |
void | pqClearAsyncResult (PGconn *conn) |
void | pqSaveErrorResult (PGconn *conn) |
PGresult * | pqPrepareAsyncResult (PGconn *conn) |
void | pqInternalNotice (const PGNoticeHooks *hooks, const char *fmt,...) pg_attribute_printf(2 |
void void | pqSaveMessageField (PGresult *res, char code, const char *value) |
void | pqSaveParameterStatus (PGconn *conn, const char *name, const char *value) |
int | pqRowProcessor (PGconn *conn, const char **errmsgp) |
PostgresPollingStatusType | pqSetenvPoll (PGconn *conn) |
char * | pqBuildStartupPacket2 (PGconn *conn, int *packetlen, const PQEnvironmentOption *options) |
void | pqParseInput2 (PGconn *conn) |
int | pqGetCopyData2 (PGconn *conn, char **buffer, int async) |
int | pqGetline2 (PGconn *conn, char *s, int maxlen) |
int | pqGetlineAsync2 (PGconn *conn, char *buffer, int bufsize) |
int | pqEndcopy2 (PGconn *conn) |
PGresult * | pqFunctionCall2 (PGconn *conn, Oid fnid, int *result_buf, int *actual_result_len, int result_is_int, const PQArgBlock *args, int nargs) |
char * | pqBuildStartupPacket3 (PGconn *conn, int *packetlen, const PQEnvironmentOption *options) |
void | pqParseInput3 (PGconn *conn) |
int | pqGetErrorNotice3 (PGconn *conn, bool isError) |
void | pqBuildErrorMessage3 (PQExpBuffer msg, const PGresult *res, PGVerbosity verbosity, PGContextVisibility show_context) |
int | pqGetCopyData3 (PGconn *conn, char **buffer, int async) |
int | pqGetline3 (PGconn *conn, char *s, int maxlen) |
int | pqGetlineAsync3 (PGconn *conn, char *buffer, int bufsize) |
int | pqEndcopy3 (PGconn *conn) |
PGresult * | pqFunctionCall3 (PGconn *conn, Oid fnid, int *result_buf, int *actual_result_len, int result_is_int, const PQArgBlock *args, int nargs) |
int | pqCheckOutBufferSpace (size_t bytes_needed, PGconn *conn) |
int | pqCheckInBufferSpace (size_t bytes_needed, PGconn *conn) |
int | pqGetc (char *result, PGconn *conn) |
int | pqPutc (char c, PGconn *conn) |
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 | 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 | pqsecure_initialize (PGconn *) |
PostgresPollingStatusType | pqsecure_open_client (PGconn *) |
void | pqsecure_close (PGconn *) |
ssize_t | pqsecure_read (PGconn *, void *ptr, size_t len) |
ssize_t | pqsecure_write (PGconn *, const void *ptr, size_t len) |
ssize_t | pqsecure_raw_read (PGconn *, void *ptr, size_t len) |
ssize_t | pqsecure_raw_write (PGconn *, const void *ptr, size_t len) |
void | pgtls_init_library (bool do_ssl, int do_crypto) |
int | pgtls_init (PGconn *conn) |
PostgresPollingStatusType | pgtls_open_client (PGconn *conn) |
void | pgtls_close (PGconn *conn) |
ssize_t | pgtls_read (PGconn *conn, void *ptr, size_t len) |
bool | pgtls_read_pending (PGconn *conn) |
ssize_t | pgtls_write (PGconn *conn, const void *ptr, size_t len) |
int | pgtls_verify_peer_name_matches_certificate_guts (PGconn *conn, int *names_examined, char **first_name) |
Variables | |
char *const | pgresStatus [] |
#define CMDSTATUS_LEN 64 /* should match COMPLETION_TAG_BUFSIZE */ |
Definition at line 86 of file libpq-int.h.
Referenced by pqParseInput2(), and pqParseInput3().
#define libpq_gettext | ( | x | ) | (x) |
Definition at line 792 of file libpq-int.h.
Referenced by build_client_final_message(), build_client_first_message(), check_expected_areq(), connectFailureMessage(), connectNoDelay(), connectOptions2(), conninfo_add_defaults(), conninfo_array_parse(), conninfo_init(), conninfo_parse(), conninfo_storeval(), conninfo_uri_decode(), conninfo_uri_parse_options(), conninfo_uri_parse_params(), do_field(), do_header(), fillPGconn(), getAnotherTuple(), getParamDescriptions(), getRowDescriptions(), handleSyncLoss(), initialize_SSL(), lo_create(), lo_export(), lo_import_internal(), lo_initialize(), lo_lseek64(), lo_read(), lo_tell64(), lo_truncate(), lo_truncate64(), lo_write(), open_client_SSL(), openssl_verify_peer_name_matches_certificate_name(), parse_int_param(), parseServiceFile(), parseServiceInfo(), passwordFromFile(), pg_fe_getauthname(), pg_fe_scram_exchange(), pg_fe_sendauth(), pg_GSS_load_servicename(), pg_GSS_read(), pg_GSS_write(), pg_local_sendauth(), pg_password_sendauth(), pg_SASL_continue(), pg_SASL_init(), pgpassfileWarning(), pgtls_read(), pgtls_write(), pq_verify_peer_name_matches_certificate(), pq_verify_peer_name_matches_certificate_name(), pqAddTuple(), pqBuildErrorMessage3(), PQconnectPoll(), PQdefaultSSLKeyPassHook(), PQdisplayTuples(), PQencryptPasswordConn(), pqEndcopy2(), pqEndcopy3(), PQenv2encoding(), PQerrorMessage(), PQescapeByteaInternal(), PQescapeInternal(), PQescapeStringInternal(), PQexecStart(), PQfn(), pqFunctionCall2(), pqFunctionCall3(), PQgetCopyData(), pqGetCopyData2(), pqGetCopyData3(), pqGetErrorNotice2(), pqGetErrorNotice3(), pqGetline3(), PQgetResult(), pqInternalNotice(), pqPacketSend(), pqParseInput2(), pqParseInput3(), PQprint(), PQprintTuples(), PQputCopyData(), PQputCopyEnd(), pqReadData(), PQreset(), PQresetPoll(), PQresStatus(), PQresultVerboseErrorMessage(), pqSaveWriteError(), pqsecure_open_gss(), pqsecure_raw_read(), pqsecure_raw_write(), PQsendDescribe(), PQsendPrepare(), PQsendQuery(), PQsendQueryGuts(), PQsendQueryParams(), PQsendQueryPrepared(), PQsendQueryStart(), pqSendSome(), PQsetdbLogin(), pqSetenvPoll(), PQsetvalue(), pqSocketCheck(), pqWaitTimed(), read_attr_value(), read_server_final_message(), read_server_first_message(), reportErrorPosition(), restoreErrorMessage(), saveErrorMessage(), setKeepalivesCount(), setKeepalivesIdle(), setKeepalivesInterval(), setTCPUserTimeout(), and SSLerrmessage().
#define libpq_ngettext | ( | s, | |
p, | |||
n | |||
) | ((n) == 1 ? (s) : (p)) |
Definition at line 793 of file libpq-int.h.
Referenced by pq_verify_peer_name_matches_certificate(), and PQenv2encoding().
Definition at line 133 of file libpq-int.h.
Referenced by getAnotherTuple(), PQgetisnull(), PQgetlength(), pqRowProcessor(), and PQsetvalue().
#define pglock_thread | ( | ) | ((void) 0) |
Definition at line 583 of file libpq-int.h.
Referenced by pg_fe_getauthname(), and pg_fe_sendauth().
#define pgunlock_thread | ( | ) | ((void) 0) |
Definition at line 584 of file libpq-int.h.
Referenced by pg_fe_getauthname(), and pg_fe_sendauth().
Definition at line 786 of file libpq-int.h.
Referenced by PQconsumeInput(), pqEndcopy2(), pqEndcopy3(), PQisnonblocking(), PQputCopyData(), and pqSendSome().
#define SOCK_ERRNO errno |
Definition at line 805 of file libpq-int.h.
Referenced by connectNoDelay(), internal_cancel(), my_sock_read(), my_sock_write(), open_client_SSL(), pgtls_read(), pgtls_write(), PQconnectPoll(), PQgssEncInUse(), pqReadData(), pqsecure_raw_read(), pqsecure_raw_write(), pqSendSome(), pqSocketCheck(), setKeepalivesCount(), setKeepalivesIdle(), setKeepalivesInterval(), and setTCPUserTimeout().
Definition at line 807 of file libpq-int.h.
Referenced by internal_cancel(), pgtls_read(), pgtls_write(), PQgssEncInUse(), pqsecure_raw_read(), and pqsecure_raw_write().
#define SOCK_STRERROR strerror_r |
Definition at line 806 of file libpq-int.h.
Referenced by connectFailureMessage(), connectNoDelay(), internal_cancel(), open_client_SSL(), pgtls_read(), pgtls_write(), PQconnectPoll(), pqsecure_raw_read(), pqsecure_raw_write(), pqSocketCheck(), setKeepalivesCount(), setKeepalivesIdle(), setKeepalivesInterval(), and setTCPUserTimeout().
typedef struct pg_conn_host pg_conn_host |
typedef enum pg_conn_host_type pg_conn_host_type |
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 101 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 297 of file libpq-int.h.
enum PGAsyncStatusType |
Enumerator | |
---|---|
PGASYNC_IDLE | |
PGASYNC_BUSY | |
PGASYNC_READY | |
PGASYNC_COPY_IN | |
PGASYNC_COPY_OUT | |
PGASYNC_COPY_BOTH |
Definition at line 216 of file libpq-int.h.
enum PGQueryClass |
Enumerator | |
---|---|
PGQUERY_SIMPLE | |
PGQUERY_EXTENDED | |
PGQUERY_PREPARE | |
PGQUERY_DESCRIBE |
Definition at line 227 of file libpq-int.h.
enum PGSetenvStatusType |
Definition at line 238 of file libpq-int.h.
void pgtls_close | ( | PGconn * | conn | ) |
Definition at line 1299 of file fe-secure-openssl.c.
References destroy_ssl_system(), and pg_conn::ssl_in_use.
Referenced by open_client_SSL(), pgtls_open_client(), and pqsecure_close().
int pgtls_init | ( | PGconn * | conn | ) |
Definition at line 640 of file fe-secure-openssl.c.
References free, i, malloc, pq_init_crypto_lib, pq_init_ssl_lib, pthread_mutex_init(), pthread_mutex_lock(), pthread_mutex_unlock(), and ssl_lib_initialized.
Referenced by pqsecure_initialize().
void pgtls_init_library | ( | bool | do_ssl, |
int | do_crypto | ||
) |
Definition at line 104 of file fe-secure-openssl.c.
References pq_init_crypto_lib, and pq_init_ssl_lib.
Referenced by PQinitOpenSSL(), and PQinitSSL().
PostgresPollingStatusType pgtls_open_client | ( | PGconn * | conn | ) |
Definition at line 121 of file fe-secure-openssl.c.
References 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 143 of file fe-secure-openssl.c.
References ECONNRESET, pg_conn::errorMessage, libpq_gettext, PG_STRERROR_R_BUFLEN, printfPQExpBuffer(), SOCK_ERRNO, SOCK_ERRNO_SET, SOCK_STRERROR, SSLerrfree(), and SSLerrmessage().
Referenced by pqsecure_read().
Definition at line 267 of file fe-secure-openssl.c.
Referenced by pqSocketCheck().
int pgtls_verify_peer_name_matches_certificate_guts | ( | PGconn * | conn, |
int * | names_examined, | ||
char ** | first_name | ||
) |
Definition at line 512 of file fe-secure-openssl.c.
References free, i, mode, name, openssl_verify_peer_name_matches_certificate_name(), pthread_mutex_lock(), pthread_mutex_unlock(), and pthread_self().
Referenced by pq_verify_peer_name_matches_certificate().
ssize_t pgtls_write | ( | PGconn * | conn, |
const void * | ptr, | ||
size_t | len | ||
) |
Definition at line 273 of file fe-secure-openssl.c.
References conn, ECONNRESET, pg_conn::errorMessage, hash(), libpq_gettext, malloc, PG_STRERROR_R_BUFLEN, printfPQExpBuffer(), SOCK_ERRNO, SOCK_ERRNO_SET, SOCK_STRERROR, SSLerrfree(), and SSLerrmessage().
Referenced by pqsecure_write().
void pqBuildErrorMessage3 | ( | PQExpBuffer | msg, |
const PGresult * | res, | ||
PGVerbosity | verbosity, | ||
PGContextVisibility | show_context | ||
) |
Definition at line 987 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(), pg_result::resultStatus, and val.
Referenced by pqGetErrorNotice3(), and PQresultVerboseErrorMessage().
char* pqBuildStartupPacket2 | ( | PGconn * | conn, |
int * | packetlen, | ||
const PQEnvironmentOption * | options | ||
) |
Definition at line 1593 of file fe-protocol2.c.
References StartupPacket::database, pg_conn::dbName, malloc, MemSet, StartupPacket::options, pg_hton32, pg_conn::pgoptions, pg_conn::pgtty, pg_conn::pguser, StartupPacket::protoVersion, pg_conn::pversion, SM_DATABASE, SM_OPTIONS, SM_TTY, SM_USER, StartupPacket::tty, and StartupPacket::user.
Referenced by PQconnectPoll().
char* pqBuildStartupPacket3 | ( | PGconn * | conn, |
int * | packetlen, | ||
const PQEnvironmentOption * | options | ||
) |
Definition at line 2126 of file fe-protocol3.c.
References build_startup_packet(), and malloc.
Referenced by PQconnectPoll().
void pqCatenateResultError | ( | PGresult * | res, |
const char * | msg | ||
) |
Definition at line 675 of file fe-exec.c.
References appendPQExpBufferStr(), PQExpBufferData::data, pg_result::errMsg, initPQExpBuffer(), pqSetResultError(), and termPQExpBuffer().
Referenced by PQexecFinish(), pqSaveErrorResult(), and pqSaveWriteError().
int pqCheckInBufferSpace | ( | size_t | bytes_needed, |
PGconn * | conn | ||
) |
Definition at line 407 of file fe-misc.c.
References pg_conn::errorMessage, pg_conn::inBuffer, pg_conn::inBufSize, pg_conn::inCursor, pg_conn::inEnd, pg_conn::inStart, memmove, printfPQExpBuffer(), and realloc.
Referenced by getCopyDataMessage(), PQconnectPoll(), pqFunctionCall3(), pqParseInput3(), and pqReadData().
int pqCheckOutBufferSpace | ( | size_t | bytes_needed, |
PGconn * | conn | ||
) |
Definition at line 343 of file fe-misc.c.
References pg_conn::errorMessage, pg_conn::outBuffer, pg_conn::outBufSize, printfPQExpBuffer(), and realloc.
Referenced by PQputCopyData(), pqPutMsgBytes(), and pqPutMsgStart().
void pqClearAsyncResult | ( | PGconn * | conn | ) |
Definition at line 749 of file fe-exec.c.
References pg_conn::next_result, PQclear(), and pg_conn::result.
Referenced by closePGconn(), getAnotherTuple(), getParamDescriptions(), getRowDescriptions(), PQconnectPoll(), pqGetErrorNotice2(), pqGetErrorNotice3(), pqSaveErrorResult(), and PQsendQueryStart().
Definition at line 457 of file fe-connect.c.
References closesocket, free, pg_conn::inCursor, pg_conn::inEnd, pg_conn::inStart, pg_conn::outCount, pg_fe_scram_free(), PGINVALID_SOCKET, pqsecure_close(), pg_conn::sasl_state, and pg_conn::sock.
Referenced by closePGconn(), connectDBStart(), handleSyncLoss(), PQconnectPoll(), and pqReadData().
int pqEndcopy2 | ( | PGconn * | conn | ) |
Definition at line 1349 of file fe-protocol2.c.
References pg_conn::asyncStatus, PQExpBufferData::data, pg_conn::errorMessage, PQExpBufferData::len, libpq_gettext, pg_conn::noticeHooks, PGASYNC_BUSY, PGASYNC_COPY_IN, PGASYNC_COPY_OUT, PGRES_COMMAND_OK, PQclear(), pqFlush(), PQgetResult(), pqInternalNotice(), PQisBusy(), pqIsnonblocking, PQreset(), PQresetStart(), printfPQExpBuffer(), resetPQExpBuffer(), and pg_result::resultStatus.
Referenced by PQendcopy().
int pqEndcopy3 | ( | PGconn * | conn | ) |
Definition at line 1831 of file fe-protocol3.c.
References pg_conn::asyncStatus, PQExpBufferData::data, pg_conn::errorMessage, PQExpBufferData::len, libpq_gettext, 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, pqPutMsgEnd(), pqPutMsgStart(), printfPQExpBuffer(), pg_conn::queryclass, resetPQExpBuffer(), and pg_result::resultStatus.
Referenced by PQendcopy().
int pqFlush | ( | PGconn * | conn | ) |
Definition at line 997 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(), PQsendQuery(), PQsendQueryGuts(), PQsetnonblocking(), and sendTerminateConn().
PGresult* pqFunctionCall2 | ( | PGconn * | conn, |
Oid | fnid, | ||
int * | result_buf, | ||
int * | actual_result_len, | ||
int | result_is_int, | ||
const PQArgBlock * | args, | ||
int | nargs | ||
) |
Definition at line 1434 of file fe-protocol2.c.
References pg_conn::errorMessage, getNotify(), i, pg_conn::inCursor, pg_conn::inStart, PQArgBlock::integer, PQArgBlock::len, libpq_gettext, PGRES_COMMAND_OK, PGRES_FATAL_ERROR, pqFlush(), pqGetc(), pqGetErrorNotice2(), pqGetInt(), pqGetnchar(), PQmakeEmptyPGresult(), pqPrepareAsyncResult(), pqPutInt(), pqPutMsgEnd(), pqPutMsgStart(), pqPutnchar(), pqPuts(), pqReadData(), pqSaveErrorResult(), pqWait(), printfPQExpBuffer(), PQArgBlock::ptr, pg_conn::result, and status().
Referenced by PQfn().
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 1925 of file fe-protocol3.c.
References pg_conn::errorMessage, getNotify(), getParameterStatus(), getReadyForQuery(), handleSyncLoss(), i, pg_conn::inCursor, pg_conn::inEnd, pg_conn::inStart, PQArgBlock::integer, PQArgBlock::len, libpq_gettext, PGRES_COMMAND_OK, PGRES_FATAL_ERROR, pqCheckInBufferSpace(), pqFlush(), pqGetc(), pqGetErrorNotice3(), pqGetInt(), pqGetnchar(), PQmakeEmptyPGresult(), pqPrepareAsyncResult(), pqPutInt(), pqPutMsgEnd(), pqPutMsgStart(), pqPutnchar(), pqReadData(), pqSaveErrorResult(), pqWait(), printfPQExpBuffer(), PQArgBlock::ptr, pg_conn::result, status(), and VALID_LONG_MESSAGE_TYPE.
Referenced by PQfn().
int pqGetc | ( | char * | result, |
PGconn * | conn | ||
) |
Definition at line 93 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 pqGetCopyData2 | ( | PGconn * | conn, |
char ** | buffer, | ||
int | async | ||
) |
Definition at line 1166 of file fe-protocol2.c.
References pg_conn::asyncStatus, pg_conn::errorMessage, pg_conn::inBuffer, pg_conn::inCursor, pg_conn::inEnd, pg_conn::inStart, libpq_gettext, malloc, PGASYNC_BUSY, pqReadData(), pqWait(), and printfPQExpBuffer().
Referenced by PQgetCopyData().
int pqGetCopyData3 | ( | PGconn * | conn, |
char ** | buffer, | ||
int | async | ||
) |
Definition at line 1664 of file fe-protocol3.c.
References pg_conn::errorMessage, getCopyDataMessage(), pg_conn::inBuffer, pg_conn::inCursor, pg_conn::inStart, libpq_gettext, malloc, pqReadData(), pqWait(), and printfPQExpBuffer().
Referenced by PQgetCopyData().
Definition at line 873 of file fe-protocol3.c.
References appendPQExpBufferStr(), PQExpBufferData::data, pg_result::errMsg, pg_conn::errorMessage, pg_result::errQuery, initPQExpBuffer(), pg_conn::last_query, pg_conn::last_sqlstate, 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, pqBuildErrorMessage3(), PQclear(), pqClearAsyncResult(), PQExpBufferDataBroken, pqGetc(), pqGets(), PQmakeEmptyPGresult(), pqResultStrdup(), pqSaveMessageField(), printfPQExpBuffer(), 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 7046 of file fe-connect.c.
References pqGetpwuid(), snprintf, and strlcpy().
Referenced by connectOptions2(), initialize_SSL(), and parseServiceInfo().
int pqGetInt | ( | int * | result, |
size_t | bytes, | ||
PGconn * | conn | ||
) |
Definition at line 266 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 pqGetline2 | ( | PGconn * | conn, |
char * | s, | ||
int | maxlen | ||
) |
Definition at line 1240 of file fe-protocol2.c.
References pg_conn::asyncStatus, pg_conn::inBuffer, pg_conn::inEnd, pg_conn::inStart, PGASYNC_COPY_OUT, PGINVALID_SOCKET, pqReadData(), pqWait(), and pg_conn::sock.
Referenced by PQgetline().
int pqGetline3 | ( | PGconn * | conn, |
char * | s, | ||
int | maxlen | ||
) |
Definition at line 1724 of file fe-protocol3.c.
References pg_conn::asyncStatus, pg_conn::copy_is_binary, pg_conn::errorMessage, libpq_gettext, PGASYNC_COPY_BOTH, PGASYNC_COPY_OUT, PGINVALID_SOCKET, PQgetlineAsync(), pqReadData(), pqWait(), printfPQExpBuffer(), pg_conn::sock, and status().
Referenced by PQgetline().
int pqGetlineAsync2 | ( | PGconn * | conn, |
char * | buffer, | ||
int | bufsize | ||
) |
Definition at line 1291 of file fe-protocol2.c.
References pg_conn::asyncStatus, pg_conn::inBuffer, pg_conn::inCursor, pg_conn::inEnd, pg_conn::inStart, and PGASYNC_COPY_OUT.
Referenced by PQgetlineAsync().
int pqGetlineAsync3 | ( | PGconn * | conn, |
char * | buffer, | ||
int | bufsize | ||
) |
Definition at line 1776 of file fe-protocol3.c.
References pg_conn::asyncStatus, 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 194 of file fe-misc.c.
References fprintf, fputnbytes(), 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 162 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 168 of file fe-misc.c.
References pqGets_internal().
Referenced by PQconnectPoll().
void pqInternalNotice | ( | const PGNoticeHooks * | hooks, |
const char * | fmt, | ||
... | |||
) |
int pqPacketSend | ( | PGconn * | conn, |
char | pack_type, | ||
const void * | buf, | ||
size_t | buf_len | ||
) |
Definition at line 4470 of file fe-connect.c.
References DefaultHost, free, hostname, i, _internalPQconninfoOption::keyword, _PQconninfoOption::keyword, libpq_gettext, malloc, pg_strcasecmp(), pg_strncasecmp(), port, pqFlush(), pqPutMsgEnd(), pqPutMsgStart(), pqPutnchar(), printfPQExpBuffer(), STATUS_ERROR, STATUS_OK, _internalPQconninfoOption::val, _PQconninfoOption::val, and values.
Referenced by pg_password_sendauth(), pg_SASL_continue(), and PQconnectPoll().
void pqParseInput2 | ( | PGconn * | conn | ) |
Definition at line 408 of file fe-protocol2.c.
References pg_conn::asyncStatus, pg_conn::be_key, pg_conn::be_pid, checkXactStatus(), pg_result::cmdStatus, CMDSTATUS_LEN, PQExpBufferData::data, pg_conn::errorMessage, getAnotherTuple(), getNotify(), getRowDescriptions(), pg_conn::inCursor, pg_conn::inEnd, pg_conn::inStart, libpq_gettext, pg_conn::noticeHooks, PGASYNC_BUSY, PGASYNC_COPY_IN, PGASYNC_COPY_OUT, PGASYNC_IDLE, PGASYNC_READY, PGRES_COMMAND_OK, PGRES_EMPTY_QUERY, pqGetc(), pqGetErrorNotice2(), pqGetInt(), pqGets(), pqInternalNotice(), PQmakeEmptyPGresult(), pqSaveErrorResult(), printfPQExpBuffer(), pg_conn::result, strlcpy(), and pg_conn::workBuffer.
Referenced by parseInput().
void pqParseInput3 | ( | PGconn * | conn | ) |
Definition at line 63 of file fe-protocol3.c.
References pg_conn::asyncStatus, pg_conn::be_key, pg_conn::be_pid, pg_result::cmdStatus, CMDSTATUS_LEN, pg_conn::copy_already_done, PQExpBufferData::data, pg_conn::errorMessage, getAnotherTuple(), getCopyStart(), getNotify(), getParamDescriptions(), getParameterStatus(), getReadyForQuery(), getRowDescriptions(), handleSyncLoss(), pg_conn::inCursor, pg_conn::inEnd, pg_conn::inStart, libpq_gettext, pg_conn::noticeHooks, PGASYNC_BUSY, PGASYNC_COPY_BOTH, PGASYNC_COPY_IN, PGASYNC_COPY_OUT, PGASYNC_IDLE, PGASYNC_READY, PGQUERY_DESCRIBE, PGQUERY_PREPARE, PGRES_COMMAND_OK, PGRES_COPY_BOTH, PGRES_COPY_IN, PGRES_COPY_OUT, PGRES_EMPTY_QUERY, PGRES_FATAL_ERROR, PGRES_TUPLES_OK, pqCheckInBufferSpace(), pqGetc(), pqGetErrorNotice3(), pqGetInt(), pqGets(), pqInternalNotice(), PQmakeEmptyPGresult(), pqSaveErrorResult(), printfPQExpBuffer(), pg_conn::queryclass, pg_conn::result, pg_result::resultStatus, strlcpy(), VALID_LONG_MESSAGE_TYPE, and pg_conn::workBuffer.
Referenced by parseInput().
Definition at line 826 of file fe-exec.c.
References appendPQExpBufferStr(), pg_conn::errorMessage, pg_conn::next_result, PGRES_FATAL_ERROR, PQmakeEmptyPGresult(), PQresultErrorMessage(), resetPQExpBuffer(), and pg_conn::result.
Referenced by getCopyResult(), pqFunctionCall2(), pqFunctionCall3(), and PQgetResult().
int pqPutc | ( | char | c, |
PGconn * | conn | ||
) |
Definition at line 111 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 306 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().
int pqPutMsgEnd | ( | PGconn * | conn | ) |
Definition at line 586 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(), PQsendQuery(), PQsendQueryGuts(), and sendTerminateConn().
Definition at line 518 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(), PQsendQuery(), PQsendQueryGuts(), and sendTerminateConn().
int pqPutnchar | ( | const char * | s, |
size_t | len, | ||
PGconn * | conn | ||
) |
Definition at line 245 of file fe-misc.c.
References fprintf, fputnbytes(), 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 178 of file fe-misc.c.
References fprintf, pg_conn::Pfdebug, and pqPutMsgBytes().
Referenced by pg_SASL_init(), pqFunctionCall2(), PQputCopyEnd(), PQsendDescribe(), PQsendPrepare(), PQsendQuery(), and PQsendQueryGuts().
int pqReadData | ( | PGconn * | conn | ) |
Definition at line 628 of file fe-misc.c.
References CONNECTION_BAD, EAGAIN, ECONNRESET, EINTR, pg_conn::errorMessage, EWOULDBLOCK, pg_conn::inBuffer, pg_conn::inBufSize, pg_conn::inCursor, pg_conn::inEnd, pg_conn::inStart, libpq_gettext, memmove, PGINVALID_SOCKET, pqCheckInBufferSpace(), pqDropConnection(), pqReadReady(), pqsecure_read(), printfPQExpBuffer(), 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 1057 of file fe-misc.c.
References pqSocketCheck().
Referenced by gss_read(), and pqReadData().
Definition at line 534 of file fe-exec.c.
References pg_result::curBlock, pg_result::curOffset, malloc, pg_result::memorySize, pgresult_data::next, pg_result::null_field, PGRESULT_ALIGN_BOUNDARY, PGRESULT_BLOCK_OVERHEAD, PGRESULT_DATA_BLOCKSIZE, PGRESULT_SEP_ALLOC_THRESHOLD, pgresult_data::space, and pg_result::spaceLeft.
Referenced by getCopyStart(), getParamDescriptions(), getRowDescriptions(), pqInternalNotice(), PQresultAlloc(), pqResultStrdup(), pqRowProcessor(), pqSaveMessageField(), and PQsetvalue().
char* pqResultStrdup | ( | PGresult * | res, |
const char * | str | ||
) |
Definition at line 646 of file fe-exec.c.
References pqResultAlloc().
Referenced by getRowDescriptions(), pqGetErrorNotice2(), pqGetErrorNotice3(), PQsetResultAttrs(), and pqSetResultError().
int pqRowProcessor | ( | PGconn * | conn, |
const char ** | errmsgp | ||
) |
Definition at line 1132 of file fe-exec.c.
References pg_conn::asyncStatus, pg_result::attDescs, pgresAttDesc::format, i, pgresAttValue::len, pgDataValue::len, pg_conn::next_result, pg_result::null_field, NULL_LEN, pg_result::numAttributes, PG_COPYRES_ATTRS, PG_COPYRES_EVENTS, PG_COPYRES_NOTICEHOOKS, PGASYNC_READY, PGRES_SINGLE_TUPLE, pqAddTuple(), PQclear(), PQcopyResult(), pqResultAlloc(), pg_conn::result, pg_result::resultStatus, pg_conn::rowBuf, pg_conn::singleRowMode, val, pgresAttValue::value, and value.
Referenced by getAnotherTuple().
void pqSaveErrorResult | ( | PGconn * | conn | ) |
Definition at line 772 of file fe-exec.c.
References PQExpBufferData::data, pg_result::errMsg, pg_conn::errorMessage, PGRES_FATAL_ERROR, pqCatenateResultError(), pqClearAsyncResult(), PQmakeEmptyPGresult(), pg_conn::result, and pg_result::resultStatus.
Referenced by getAnotherTuple(), getCopyResult(), getParamDescriptions(), getRowDescriptions(), handleSyncLoss(), pqFunctionCall2(), pqFunctionCall3(), PQgetResult(), pqParseInput2(), pqParseInput3(), and pqSaveWriteError().
void void pqSaveMessageField | ( | PGresult * | res, |
char | code, | ||
const char * | value | ||
) |
Definition at line 993 of file fe-exec.c.
References pgMessageField::code, pgMessageField::contents, pg_result::errFields, pgMessageField::next, offsetof, and pqResultAlloc().
Referenced by pqGetErrorNotice2(), pqGetErrorNotice3(), and pqInternalNotice().
void pqSaveParameterStatus | ( | PGconn * | conn, |
const char * | name, | ||
const char * | value | ||
) |
Definition at line 1014 of file fe-exec.c.
References pg_conn::client_encoding, fprintf, free, malloc, pgParameterStatus::name, pgParameterStatus::next, pg_conn::Pfdebug, pg_char_to_encoding(), PG_SQL_ASCII, pg_conn::pstatus, static_client_encoding, static_std_strings, pg_conn::std_strings, pg_conn::sversion, and pgParameterStatus::value.
Referenced by getParameterStatus(), PQsetClientEncoding(), and pqSetenvPoll().
void pqsecure_close | ( | PGconn * | ) |
Definition at line 197 of file fe-secure.c.
References pgtls_close(), and pg_conn::ssl_in_use.
Referenced by pqDropConnection().
int pqsecure_initialize | ( | PGconn * | ) |
PostgresPollingStatusType pqsecure_open_client | ( | PGconn * | ) |
Definition at line 183 of file fe-secure.c.
References PGRES_POLLING_FAILED, and pgtls_open_client().
Referenced by PQconnectPoll().
ssize_t pqsecure_raw_read | ( | PGconn * | , |
void * | ptr, | ||
size_t | len | ||
) |
Definition at line 239 of file fe-secure.c.
References EAGAIN, ECONNRESET, EINTR, pg_conn::errorMessage, EWOULDBLOCK, libpq_gettext, PG_STRERROR_R_BUFLEN, printfPQExpBuffer(), recv, pg_conn::sock, SOCK_ERRNO, SOCK_ERRNO_SET, and SOCK_STRERROR.
Referenced by gss_read(), my_sock_read(), pg_GSS_read(), and pqsecure_read().
ssize_t pqsecure_raw_write | ( | PGconn * | , |
const void * | ptr, | ||
size_t | len | ||
) |
Definition at line 323 of file fe-secure.c.
References DECLARE_SIGPIPE_INFO, DISABLE_SIGPIPE, EAGAIN, ECONNRESET, EINTR, pg_conn::errorMessage, EWOULDBLOCK, libpq_gettext, PG_STRERROR_R_BUFLEN, printfPQExpBuffer(), REMEMBER_EPIPE, RESTORE_SIGPIPE, send, pg_conn::sigpipe_flag, pg_conn::sock, SOCK_ERRNO, SOCK_ERRNO_SET, and SOCK_STRERROR.
Referenced by my_sock_write(), pg_GSS_write(), pqsecure_open_gss(), and pqsecure_write().