PostgreSQL Source Code
git master
|
#include "postgres_fe.h"
#include <signal.h>
#include <unistd.h>
#include "common.h"
#include "common/connect.h"
#include "common/logging.h"
#include "common/string.h"
#include "fe_utils/cancel.h"
#include "fe_utils/string_utils.h"
Go to the source code of this file.
Macros | |
#define | ERRCODE_UNDEFINED_TABLE "42P01" |
#define | PG_YESLETTER gettext_noop("y") |
#define | PG_NOLETTER gettext_noop("n") |
Functions | |
void | handle_help_version_opts (int argc, char *argv[], const char *fixed_progname, help_handler hlp) |
PGconn * | connectDatabase (const ConnParams *cparams, const char *progname, bool echo, bool fail_ok, bool allow_password_reuse) |
PGconn * | connectMaintenanceDatabase (ConnParams *cparams, const char *progname, bool echo) |
void | disconnectDatabase (PGconn *conn) |
PGresult * | executeQuery (PGconn *conn, const char *query, bool echo) |
void | executeCommand (PGconn *conn, const char *query, bool echo) |
bool | executeMaintenanceCommand (PGconn *conn, const char *query, bool echo) |
bool | consumeQueryResult (PGconn *conn) |
bool | processQueryResult (PGconn *conn, PGresult *result) |
void | splitTableColumnsSpec (const char *spec, int encoding, char **table, const char **columns) |
void | appendQualifiedRelation (PQExpBuffer buf, const char *spec, PGconn *conn, bool echo) |
bool | yesno_prompt (const char *question) |
#define ERRCODE_UNDEFINED_TABLE "42P01" |
Definition at line 27 of file common.c.
Referenced by processQueryResult().
#define PG_NOLETTER gettext_noop("n") |
Definition at line 449 of file common.c.
Referenced by yesno_prompt().
#define PG_YESLETTER gettext_noop("y") |
Definition at line 447 of file common.c.
Referenced by yesno_prompt().
void appendQualifiedRelation | ( | PQExpBuffer | buf, |
const char * | spec, | ||
PGconn * | conn, | ||
bool | echo | ||
) |
Definition at line 385 of file common.c.
References ALWAYS_SECURE_SEARCH_PATH_SQL, appendPQExpBufferStr(), appendStringLiteralConn(), PQExpBufferData::data, executeCommand(), executeQuery(), fmtQualifiedId(), initPQExpBuffer(), ngettext, pg_free(), pg_log_error, PQclear(), PQclientEncoding(), PQfinish(), PQgetvalue(), PQntuples(), splitTableColumnsSpec(), and termPQExpBuffer().
Referenced by cluster_one_database(), and run_reindex_command().
PGconn* connectDatabase | ( | const ConnParams * | cparams, |
const char * | progname, | ||
bool | echo, | ||
bool | fail_ok, | ||
bool | allow_password_reuse | ||
) |
Definition at line 65 of file common.c.
References ALWAYS_SECURE_SEARCH_PATH_SQL, Assert, conn, CONNECTION_BAD, _connParams::dbname, executeQuery(), free, i, lengthof, _connParams::override_dbname, password, pg_log_error, _connParams::pghost, _connParams::pgport, _connParams::pguser, PQclear(), PQconnectdbParams(), PQconnectionNeedsPassword(), PQerrorMessage(), PQfinish(), PQstatus(), progname, _connParams::prompt_password, simple_prompt(), TRI_NO, TRI_YES, and values.
Referenced by connectMaintenanceDatabase().
PGconn* connectMaintenanceDatabase | ( | ConnParams * | cparams, |
const char * | progname, | ||
bool | echo | ||
) |
Definition at line 172 of file common.c.
References conn, connectDatabase(), and _connParams::dbname.
Referenced by cluster_all_databases(), main(), reindex_all_databases(), and vacuum_all_databases().
Definition at line 298 of file common.c.
References PQgetResult(), processQueryResult(), ResetCancelConn(), and SetCancelConn().
Referenced by ParallelSlotsWaitCompletion().
void disconnectDatabase | ( | PGconn * | conn | ) |
Definition at line 196 of file common.c.
References Assert, PQcancel(), PQfinish(), PQfreeCancel(), PQgetCancel(), PQTRANS_ACTIVE, and PQtransactionStatus().
Referenced by ParallelSlotsTerminate().
Definition at line 245 of file common.c.
References pg_log_error, pg_log_info, PGRES_COMMAND_OK, PQclear(), PQerrorMessage(), PQexec(), PQfinish(), PQresultStatus(), and printf.
Referenced by appendQualifiedRelation().
Definition at line 272 of file common.c.
References PGRES_COMMAND_OK, PQclear(), PQexec(), PQresultStatus(), printf, ResetCancelConn(), and SetCancelConn().
Referenced by cluster_one_database(), and run_reindex_command().
Definition at line 220 of file common.c.
References pg_log_error, pg_log_info, PGRES_TUPLES_OK, PQerrorMessage(), PQexec(), PQfinish(), PQresultStatus(), and printf.
Referenced by appendQualifiedRelation(), and connectDatabase().
void handle_help_version_opts | ( | int | argc, |
char * | argv[], | ||
const char * | fixed_progname, | ||
help_handler | hlp | ||
) |
Definition at line 34 of file common.c.
References get_progname(), and printf.
Referenced by main().
Definition at line 319 of file common.c.
References ERRCODE_UNDEFINED_TABLE, PG_DIAG_SQLSTATE, pg_log_error, PGRES_COMMAND_OK, PQclear(), PQdb(), PQerrorMessage(), PQresultErrorField(), and PQresultStatus().
Referenced by consumeQueryResult(), and ParallelSlotsGetIdle().
void splitTableColumnsSpec | ( | const char * | spec, |
int | encoding, | ||
char ** | table, | ||
const char ** | columns | ||
) |
Definition at line 350 of file common.c.
References pnstrdup(), and PQmblen().
Referenced by appendQualifiedRelation(), and vacuum_one_database().
bool yesno_prompt | ( | const char * | question | ) |
Definition at line 452 of file common.c.
References _, free, PG_NOLETTER, PG_YESLETTER, printf, simple_prompt(), and snprintf.
Referenced by main().