PostgreSQL Source Code
git master
|
#include <setjmp.h>
#include <signal.h>
#include "fe_utils/print.h"
#include "fe_utils/psqlscan.h"
#include "libpq-fe.h"
Go to the source code of this file.
Functions | |
bool | openQueryOutputFile (const char *fname, FILE **fout, bool *is_pipe) |
bool | setQFout (const char *fname) |
char * | psql_get_variable (const char *varname, PsqlScanQuoteType quote, void *passthrough) |
void | NoticeProcessor (void *arg, const char *message) |
void | psql_setup_cancel_handler (void) |
void | SetShellResultVariables (int wait_result) |
PGresult * | PSQLexec (const char *query) |
int | PSQLexecWatch (const char *query, const printQueryOpt *opt, FILE *printQueryFout, int min_rows) |
bool | SendQuery (const char *query) |
bool | is_superuser (void) |
bool | standard_strings (void) |
const char * | session_username (void) |
void | expand_tilde (char **filename) |
void | clean_extended_state (void) |
bool | recognized_connection_string (const char *connstr) |
Variables | |
volatile sig_atomic_t | sigint_interrupt_enabled |
sigjmp_buf | sigint_interrupt_jmp |
void clean_extended_state | ( | void | ) |
Definition at line 2279 of file common.c.
References _psqlSettings::bind_nparams, _psqlSettings::bind_params, free, i, pset, PSQL_SEND_EXTENDED_CLOSE, PSQL_SEND_EXTENDED_PARSE, PSQL_SEND_EXTENDED_QUERY_PARAMS, PSQL_SEND_EXTENDED_QUERY_PREPARED, PSQL_SEND_QUERY, _psqlSettings::send_mode, and _psqlSettings::stmtName.
Referenced by exec_command_bind(), exec_command_bind_named(), exec_command_close(), exec_command_parse(), and SendQuery().
void expand_tilde | ( | char ** | filename | ) |
Definition at line 2195 of file common.c.
References filename, fn(), free, get_home_path(), MAXPGPATH, psprintf(), and strlcpy().
Referenced by exec_command_edit(), exec_command_g(), exec_command_include(), exec_command_lo(), exec_command_out(), exec_command_s(), exec_command_write(), initializeInput(), parse_slash_copy(), and process_psqlrc().
bool is_superuser | ( | void | ) |
Definition at line 2134 of file common.c.
References _psqlSettings::db, PQparameterStatus(), pset, and val.
void NoticeProcessor | ( | void * | arg, |
const char * | message | ||
) |
Definition at line 267 of file common.c.
References arg, and pg_log_info.
Referenced by do_connect(), and main().
Definition at line 56 of file common.c.
References fflush(), pg_log_error, and generate_unaccent_rules::stdout.
Referenced by setQFout(), and SetupGOutput().
char* psql_get_variable | ( | const char * | varname, |
PsqlScanQuoteType | quote, | ||
void * | passthrough | ||
) |
Definition at line 176 of file common.c.
References appendShellStringNoError(), buf, conditional_active(), _psqlSettings::db, error(), free, GetVariable(), initPQExpBuffer(), pg_log_error, pg_log_info, pg_strdup(), PQerrorMessage(), PQescapeIdentifier(), PQescapeLiteral(), PQfreemem(), PQUOTE_PLAIN, PQUOTE_SHELL_ARG, PQUOTE_SQL_IDENT, PQUOTE_SQL_LITERAL, pset, value, and _psqlSettings::vars.
void psql_setup_cancel_handler | ( | void | ) |
Definition at line 313 of file common.c.
References psql_cancel_callback(), and setup_cancel_handler().
Referenced by main().
PGresult* PSQLexec | ( | const char * | query | ) |
Definition at line 620 of file common.c.
References _, AcceptResult(), ClearOrSaveResult(), _psqlSettings::db, _psqlSettings::echo_hidden, fflush(), fprintf, _psqlSettings::logfile, pg_log_error, PQexec(), printf, pset, PSQL_ECHO_HIDDEN_NOEXEC, PSQL_ECHO_HIDDEN_OFF, res, ResetCancelConn(), SetCancelConn(), and generate_unaccent_rules::stdout.
Referenced by add_tablespace_footer(), addFooterToPublicationDesc(), describeAccessMethods(), describeAggregates(), describeConfigurationParameters(), describeFunctions(), describeOneTableDetails(), describeOneTSConfig(), describeOneTSParser(), describeOperators(), describePublications(), describeRoleGrants(), describeRoles(), describeSubscriptions(), describeTableDetails(), describeTablespaces(), describeTypes(), do_lo_import(), exec_command_password(), fail_lo_xact(), finish_lo_xact(), listAllDbs(), listCasts(), listCollations(), listConversions(), listDbRoleSettings(), listDefaultACLs(), listDomains(), listEventTriggers(), listExtendedStats(), listExtensionContents(), listExtensions(), listForeignDataWrappers(), listForeignServers(), listForeignTables(), listLanguages(), listLargeObjects(), listOneExtensionContents(), listOperatorClasses(), listOperatorFamilies(), listOpFamilyFunctions(), listOpFamilyOperators(), listPartitionedTables(), listPublications(), listSchemas(), listTables(), listTSConfigs(), listTSConfigsVerbose(), listTSDictionaries(), listTSParsers(), listTSParsersVerbose(), listTSTemplates(), listUserMappings(), main(), objectDescription(), permissionsList(), and start_lo_xact().
int PSQLexecWatch | ( | const char * | query, |
const printQueryOpt * | opt, | ||
FILE * | printQueryFout, | ||
int | min_rows | ||
) |
Definition at line 675 of file common.c.
References _psqlSettings::db, ExecQueryAndProcessResults(), pg_log_error, PrintTiming(), pset, res, ResetCancelConn(), SetCancelConn(), and _psqlSettings::timing.
Referenced by do_watch().
bool recognized_connection_string | ( | const char * | connstr | ) |
Definition at line 2317 of file common.c.
References connstr, and uri_prefix_length().
Referenced by do_connect().
bool SendQuery | ( | const char * | query | ) |
Definition at line 1082 of file common.c.
References _, _psqlSettings::autocommit, buf, cancel_pressed, clean_extended_state(), ClearOrSaveResult(), command_no_begin(), ConnectionUp(), _psqlSettings::crosstab_flag, _psqlSettings::ctv_args, _psqlSettings::cur_cmd_interactive, _psqlSettings::db, DescribeQuery(), _psqlSettings::echo, _psqlSettings::encoding, printTableOpt::encoding, ExecQueryAndProcessResults(), fflush(), fprintf, free, _psqlSettings::gdesc_flag, _psqlSettings::gexec_flag, _psqlSettings::gfname, _psqlSettings::gsavepopt, _psqlSettings::gset_prefix, i, lengthof, _psqlSettings::logfile, _psqlSettings::on_error_rollback, pg_encoding_to_char, pg_free(), pg_log_error, pg_log_info, PGRES_COMMAND_OK, _psqlSettings::popt, PQclear(), PQclientEncoding(), PQerrorMessage(), PQexec(), PQresultStatus(), PQTRANS_ACTIVE, PQTRANS_IDLE, PQTRANS_INERROR, PQTRANS_INTRANS, PQTRANS_UNKNOWN, PQtransactionStatus(), printf, PrintNotifications(), PrintTiming(), pset, PSQL_ECHO_ERRORS, PSQL_ECHO_QUERIES, PSQL_ERROR_ROLLBACK_OFF, PSQL_ERROR_ROLLBACK_ON, ResetCancelConn(), restorePsetInfo(), SetCancelConn(), SetVariable(), _psqlSettings::singlestep, generate_unaccent_rules::stdout, _psqlSettings::timing, printQueryOpt::topt, and _psqlSettings::vars.
Referenced by do_copy(), ExecQueryTuples(), main(), and MainLoop().
const char* session_username | ( | void | ) |
Definition at line 2174 of file common.c.
References _psqlSettings::db, PQparameterStatus(), PQuser(), pset, and val.
Referenced by get_prompt().
bool setQFout | ( | const char * | fname | ) |
Definition at line 132 of file common.c.
References openQueryOutputFile(), pset, _psqlSettings::queryFout, _psqlSettings::queryFoutPipe, restore_sigpipe_trap(), set_sigpipe_trap_state(), SetShellResultVariables(), and generate_unaccent_rules::stdout.
Referenced by exec_command_out(), main(), and parse_psql_options().
void SetShellResultVariables | ( | int | wait_result | ) |
Definition at line 501 of file common.c.
References buf, pset, SetVariable(), snprintf, _psqlSettings::vars, and wait_result_to_exit_code().
Referenced by CloseGOutput(), do_copy(), do_shell(), exec_command_write(), and setQFout().
bool standard_strings | ( | void | ) |
Definition at line 2154 of file common.c.
References _psqlSettings::db, PQparameterStatus(), pset, and val.
Referenced by get_create_object_cmd(), main(), MainLoop(), and parse_slash_copy().
|
extern |
Definition at line 292 of file common.c.
Referenced by exec_command_password(), exec_command_prompt(), gets_fromFile(), gets_interactive(), handleCopyIn(), MainLoop(), prompt_for_password(), and psql_cancel_callback().
|
extern |
Definition at line 294 of file common.c.
Referenced by exec_command_password(), exec_command_prompt(), handleCopyIn(), MainLoop(), prompt_for_password(), and psql_cancel_callback().