PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
command.h File Reference
#include "fe_utils/print.h"
#include "fe_utils/psqlscan.h"
#include "conditional.h"
Include dependency graph for command.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef enum _backslashResult backslashResult
 

Enumerations

enum  _backslashResult {
  PSQL_CMD_UNKNOWN = 0, PSQL_CMD_SEND, PSQL_CMD_SKIP_LINE, PSQL_CMD_TERMINATE,
  PSQL_CMD_NEWEDIT, PSQL_CMD_ERROR
}
 

Functions

backslashResult HandleSlashCmds (PsqlScanState scan_state, ConditionalStack cstack, PQExpBuffer query_buf, PQExpBuffer previous_buf)
 
int process_file (char *filename, bool use_relative_path)
 
bool do_pset (const char *param, const char *value, printQueryOpt *popt, bool quiet)
 
void connection_warnings (bool in_startup)
 
void SyncVariables (void)
 
void UnsyncVariables (void)
 

Typedef Documentation

Enumeration Type Documentation

Enumerator
PSQL_CMD_UNKNOWN 
PSQL_CMD_SEND 
PSQL_CMD_SKIP_LINE 
PSQL_CMD_TERMINATE 
PSQL_CMD_NEWEDIT 
PSQL_CMD_ERROR 

Definition at line 16 of file command.h.

17 {
18  PSQL_CMD_UNKNOWN = 0, /* not done parsing yet (internal only) */
19  PSQL_CMD_SEND, /* query complete; send off */
20  PSQL_CMD_SKIP_LINE, /* keep building query */
21  PSQL_CMD_TERMINATE, /* quit program */
22  PSQL_CMD_NEWEDIT, /* query buffer was changed (e.g., via \e) */
23  PSQL_CMD_ERROR /* the execution of the backslash command
24  * resulted in an error */
enum _backslashResult backslashResult

Function Documentation

void connection_warnings ( bool  in_startup)

Definition at line 3231 of file command.c.

References _, _psqlSettings::db, formatPGVersionNumber(), _psqlSettings::notty, PQparameterStatus(), printSSLInfo(), _psqlSettings::progname, pset, _psqlSettings::quiet, server_version, and _psqlSettings::sversion.

Referenced by do_connect(), and main().

3232 {
3233  if (!pset.quiet && !pset.notty)
3234  {
3235  int client_ver = PG_VERSION_NUM;
3236  char cverbuf[32];
3237  char sverbuf[32];
3238 
3239  if (pset.sversion != client_ver)
3240  {
3241  const char *server_version;
3242 
3243  /* Try to get full text form, might include "devel" etc */
3244  server_version = PQparameterStatus(pset.db, "server_version");
3245  /* Otherwise fall back on pset.sversion */
3246  if (!server_version)
3247  {
3249  sverbuf, sizeof(sverbuf));
3250  server_version = sverbuf;
3251  }
3252 
3253  printf(_("%s (%s, server %s)\n"),
3254  pset.progname, PG_VERSION, server_version);
3255  }
3256  /* For version match, only print psql banner on startup. */
3257  else if (in_startup)
3258  printf("%s (%s)\n", pset.progname, PG_VERSION);
3259 
3260  if (pset.sversion / 100 > client_ver / 100)
3261  printf(_("WARNING: %s major version %s, server major version %s.\n"
3262  " Some psql features might not work.\n"),
3263  pset.progname,
3264  formatPGVersionNumber(client_ver, false,
3265  cverbuf, sizeof(cverbuf)),
3267  sverbuf, sizeof(sverbuf)));
3268 
3269 #ifdef WIN32
3270  checkWin32Codepage();
3271 #endif
3272  printSSLInfo();
3273  }
3274 }
PGconn * db
Definition: settings.h:82
PsqlSettings pset
Definition: startup.c:33
const char * PQparameterStatus(const PGconn *conn, const char *paramName)
Definition: fe-connect.c:6062
const char * progname
Definition: settings.h:107
static int server_version
Definition: pg_dumpall.c:82
static void printSSLInfo(void)
Definition: command.c:3283
#define _(x)
Definition: elog.c:84
char * formatPGVersionNumber(int version_number, bool include_minor, char *buf, size_t buflen)
Definition: string_utils.c:182
bool do_pset ( const char *  param,
const char *  value,
printQueryOpt popt,
bool  quiet 
)

Definition at line 3745 of file command.c.

References Assert, printTableOpt::border, printTableOpt::columns, printTableOpt::default_footer, printTableOpt::expanded, printTableOpt::fieldSep, printTableOpt::format, free, printTableOpt::line_style, NULL, printQueryOpt::nullPrint, printTableOpt::numericLocale, printTableOpt::pager, printTableOpt::pager_min_lines, ParseVariableBool(), pg_asciiformat, pg_asciiformat_old, pg_strcasecmp(), pg_strdup(), pg_strncasecmp(), pg_utf8format, _psqlSettings::popt, PRINT_ALIGNED, PRINT_ASCIIDOC, PRINT_HTML, PRINT_LATEX, PRINT_LATEX_LONGTABLE, PRINT_TROFF_MS, PRINT_UNALIGNED, PRINT_WRAPPED, printPsetInfo(), pset, psql_error(), PsqlVarEnumError(), printTableOpt::recordSep, refresh_utf8format(), separator::separator, separator::separator_zero, set_unicode_line_style(), printTableOpt::tableAttr, printQueryOpt::title, printQueryOpt::topt, printTableOpt::tuples_only, printTableOpt::unicode_border_linestyle, printTableOpt::unicode_column_linestyle, and printTableOpt::unicode_header_linestyle.

Referenced by exec_command_a(), exec_command_C(), exec_command_f(), exec_command_html(), exec_command_pset(), exec_command_t(), exec_command_T(), exec_command_x(), and parse_psql_options().

3746 {
3747  size_t vallen = 0;
3748 
3749  Assert(param != NULL);
3750 
3751  if (value)
3752  vallen = strlen(value);
3753 
3754  /* set format */
3755  if (strcmp(param, "format") == 0)
3756  {
3757  if (!value)
3758  ;
3759  else if (pg_strncasecmp("unaligned", value, vallen) == 0)
3760  popt->topt.format = PRINT_UNALIGNED;
3761  else if (pg_strncasecmp("aligned", value, vallen) == 0)
3762  popt->topt.format = PRINT_ALIGNED;
3763  else if (pg_strncasecmp("wrapped", value, vallen) == 0)
3764  popt->topt.format = PRINT_WRAPPED;
3765  else if (pg_strncasecmp("html", value, vallen) == 0)
3766  popt->topt.format = PRINT_HTML;
3767  else if (pg_strncasecmp("asciidoc", value, vallen) == 0)
3768  popt->topt.format = PRINT_ASCIIDOC;
3769  else if (pg_strncasecmp("latex", value, vallen) == 0)
3770  popt->topt.format = PRINT_LATEX;
3771  else if (pg_strncasecmp("latex-longtable", value, vallen) == 0)
3773  else if (pg_strncasecmp("troff-ms", value, vallen) == 0)
3774  popt->topt.format = PRINT_TROFF_MS;
3775  else
3776  {
3777  psql_error("\\pset: allowed formats are unaligned, aligned, wrapped, html, asciidoc, latex, latex-longtable, troff-ms\n");
3778  return false;
3779  }
3780  }
3781 
3782  /* set table line style */
3783  else if (strcmp(param, "linestyle") == 0)
3784  {
3785  if (!value)
3786  ;
3787  else if (pg_strncasecmp("ascii", value, vallen) == 0)
3788  popt->topt.line_style = &pg_asciiformat;
3789  else if (pg_strncasecmp("old-ascii", value, vallen) == 0)
3791  else if (pg_strncasecmp("unicode", value, vallen) == 0)
3792  popt->topt.line_style = &pg_utf8format;
3793  else
3794  {
3795  psql_error("\\pset: allowed line styles are ascii, old-ascii, unicode\n");
3796  return false;
3797  }
3798  }
3799 
3800  /* set unicode border line style */
3801  else if (strcmp(param, "unicode_border_linestyle") == 0)
3802  {
3803  if (!value)
3804  ;
3805  else if (set_unicode_line_style(value, vallen,
3807  refresh_utf8format(&(popt->topt));
3808  else
3809  {
3810  psql_error("\\pset: allowed Unicode border line styles are single, double\n");
3811  return false;
3812  }
3813  }
3814 
3815  /* set unicode column line style */
3816  else if (strcmp(param, "unicode_column_linestyle") == 0)
3817  {
3818  if (!value)
3819  ;
3820  else if (set_unicode_line_style(value, vallen,
3822  refresh_utf8format(&(popt->topt));
3823  else
3824  {
3825  psql_error("\\pset: allowed Unicode column line styles are single, double\n");
3826  return false;
3827  }
3828  }
3829 
3830  /* set unicode header line style */
3831  else if (strcmp(param, "unicode_header_linestyle") == 0)
3832  {
3833  if (!value)
3834  ;
3835  else if (set_unicode_line_style(value, vallen,
3837  refresh_utf8format(&(popt->topt));
3838  else
3839  {
3840  psql_error("\\pset: allowed Unicode header line styles are single, double\n");
3841  return false;
3842  }
3843  }
3844 
3845  /* set border style/width */
3846  else if (strcmp(param, "border") == 0)
3847  {
3848  if (value)
3849  popt->topt.border = atoi(value);
3850  }
3851 
3852  /* set expanded/vertical mode */
3853  else if (strcmp(param, "x") == 0 ||
3854  strcmp(param, "expanded") == 0 ||
3855  strcmp(param, "vertical") == 0)
3856  {
3857  if (value && pg_strcasecmp(value, "auto") == 0)
3858  popt->topt.expanded = 2;
3859  else if (value)
3860  {
3861  bool on_off;
3862 
3863  if (ParseVariableBool(value, NULL, &on_off))
3864  popt->topt.expanded = on_off ? 1 : 0;
3865  else
3866  {
3867  PsqlVarEnumError(param, value, "on, off, auto");
3868  return false;
3869  }
3870  }
3871  else
3872  popt->topt.expanded = !popt->topt.expanded;
3873  }
3874 
3875  /* locale-aware numeric output */
3876  else if (strcmp(param, "numericlocale") == 0)
3877  {
3878  if (value)
3879  return ParseVariableBool(value, param, &popt->topt.numericLocale);
3880  else
3881  popt->topt.numericLocale = !popt->topt.numericLocale;
3882  }
3883 
3884  /* null display */
3885  else if (strcmp(param, "null") == 0)
3886  {
3887  if (value)
3888  {
3889  free(popt->nullPrint);
3890  popt->nullPrint = pg_strdup(value);
3891  }
3892  }
3893 
3894  /* field separator for unaligned text */
3895  else if (strcmp(param, "fieldsep") == 0)
3896  {
3897  if (value)
3898  {
3899  free(popt->topt.fieldSep.separator);
3901  popt->topt.fieldSep.separator_zero = false;
3902  }
3903  }
3904 
3905  else if (strcmp(param, "fieldsep_zero") == 0)
3906  {
3907  free(popt->topt.fieldSep.separator);
3908  popt->topt.fieldSep.separator = NULL;
3909  popt->topt.fieldSep.separator_zero = true;
3910  }
3911 
3912  /* record separator for unaligned text */
3913  else if (strcmp(param, "recordsep") == 0)
3914  {
3915  if (value)
3916  {
3917  free(popt->topt.recordSep.separator);
3919  popt->topt.recordSep.separator_zero = false;
3920  }
3921  }
3922 
3923  else if (strcmp(param, "recordsep_zero") == 0)
3924  {
3925  free(popt->topt.recordSep.separator);
3926  popt->topt.recordSep.separator = NULL;
3927  popt->topt.recordSep.separator_zero = true;
3928  }
3929 
3930  /* toggle between full and tuples-only format */
3931  else if (strcmp(param, "t") == 0 || strcmp(param, "tuples_only") == 0)
3932  {
3933  if (value)
3934  return ParseVariableBool(value, param, &popt->topt.tuples_only);
3935  else
3936  popt->topt.tuples_only = !popt->topt.tuples_only;
3937  }
3938 
3939  /* set title override */
3940  else if (strcmp(param, "C") == 0 || strcmp(param, "title") == 0)
3941  {
3942  free(popt->title);
3943  if (!value)
3944  popt->title = NULL;
3945  else
3946  popt->title = pg_strdup(value);
3947  }
3948 
3949  /* set HTML table tag options */
3950  else if (strcmp(param, "T") == 0 || strcmp(param, "tableattr") == 0)
3951  {
3952  free(popt->topt.tableAttr);
3953  if (!value)
3954  popt->topt.tableAttr = NULL;
3955  else
3956  popt->topt.tableAttr = pg_strdup(value);
3957  }
3958 
3959  /* toggle use of pager */
3960  else if (strcmp(param, "pager") == 0)
3961  {
3962  if (value && pg_strcasecmp(value, "always") == 0)
3963  popt->topt.pager = 2;
3964  else if (value)
3965  {
3966  bool on_off;
3967 
3968  if (!ParseVariableBool(value, NULL, &on_off))
3969  {
3970  PsqlVarEnumError(param, value, "on, off, always");
3971  return false;
3972  }
3973  popt->topt.pager = on_off ? 1 : 0;
3974  }
3975  else if (popt->topt.pager == 1)
3976  popt->topt.pager = 0;
3977  else
3978  popt->topt.pager = 1;
3979  }
3980 
3981  /* set minimum lines for pager use */
3982  else if (strcmp(param, "pager_min_lines") == 0)
3983  {
3984  if (value)
3985  popt->topt.pager_min_lines = atoi(value);
3986  }
3987 
3988  /* disable "(x rows)" footer */
3989  else if (strcmp(param, "footer") == 0)
3990  {
3991  if (value)
3992  return ParseVariableBool(value, param, &popt->topt.default_footer);
3993  else
3994  popt->topt.default_footer = !popt->topt.default_footer;
3995  }
3996 
3997  /* set border style/width */
3998  else if (strcmp(param, "columns") == 0)
3999  {
4000  if (value)
4001  popt->topt.columns = atoi(value);
4002  }
4003  else
4004  {
4005  psql_error("\\pset: unknown option: %s\n", param);
4006  return false;
4007  }
4008 
4009  if (!quiet)
4010  printPsetInfo(param, &pset.popt);
4011 
4012  return true;
4013 }
char * nullPrint
Definition: print.h:166
PsqlSettings pset
Definition: startup.c:33
const printTextFormat * line_style
Definition: print.h:112
printTextFormat pg_utf8format
Definition: print.c:102
const printTextFormat pg_asciiformat_old
Definition: print.c:80
enum printFormat format
Definition: print.h:98
void PsqlVarEnumError(const char *name, const char *value, const char *suggestions)
Definition: variables.c:391
printTableOpt topt
Definition: print.h:165
unicode_linestyle unicode_header_linestyle
Definition: print.h:123
int pg_strcasecmp(const char *s1, const char *s2)
Definition: pgstrcasecmp.c:36
bool separator_zero
Definition: print.h:93
unicode_linestyle unicode_border_linestyle
Definition: print.h:121
int pg_strncasecmp(const char *s1, const char *s2, size_t n)
Definition: pgstrcasecmp.c:69
unsigned short int border
Definition: print.h:101
unsigned short int expanded
Definition: print.h:99
static bool printPsetInfo(const char *param, struct printQueryOpt *popt)
Definition: command.c:4017
unicode_linestyle unicode_column_linestyle
Definition: print.h:122
static struct @121 value
bool tuples_only
Definition: print.h:107
char * pg_strdup(const char *in)
Definition: fe_memutils.c:85
char * tableAttr
Definition: print.h:117
void psql_error(const char *fmt,...)
Definition: common.c:220
unsigned short int pager
Definition: print.h:103
#define free(a)
Definition: header.h:65
struct separator fieldSep
Definition: print.h:113
char * title
Definition: print.h:167
int pager_min_lines
Definition: print.h:105
bool default_footer
Definition: print.h:110
#define NULL
Definition: c.h:229
#define Assert(condition)
Definition: c.h:676
printQueryOpt popt
Definition: settings.h:91
static bool set_unicode_line_style(const char *value, size_t vallen, unicode_linestyle *linestyle)
Definition: command.c:3713
bool numericLocale
Definition: print.h:115
bool ParseVariableBool(const char *value, const char *name, bool *result)
Definition: variables.c:107
void refresh_utf8format(const printTableOpt *opt)
Definition: print.c:3426
const printTextFormat pg_asciiformat
Definition: print.c:59
char * separator
Definition: print.h:92
struct separator recordSep
Definition: print.h:114
int columns
Definition: print.h:120
backslashResult HandleSlashCmds ( PsqlScanState  scan_state,
ConditionalStack  cstack,
PQExpBuffer  query_buf,
PQExpBuffer  previous_buf 
)

Definition at line 202 of file command.c.

References arg, Assert, conditional_active(), conditional_stack_pop(), conditional_stack_push(), _psqlSettings::cur_cmd_interactive, exec_command(), free, IFSTATE_IGNORED, NULL, OT_NORMAL, OT_WHOLE_LINE, pset, PSQL_CMD_ERROR, PSQL_CMD_UNKNOWN, psql_error(), psql_scan_slash_command(), psql_scan_slash_command_end(), psql_scan_slash_option(), _psqlSettings::queryFout, and status().

Referenced by main(), and MainLoop().

206 {
208  char *cmd;
209  char *arg;
210 
211  Assert(scan_state != NULL);
212  Assert(cstack != NULL);
213 
214  /* Parse off the command name */
215  cmd = psql_scan_slash_command(scan_state);
216 
217  /* And try to execute it */
218  status = exec_command(cmd, scan_state, cstack, query_buf, previous_buf);
219 
220  if (status == PSQL_CMD_UNKNOWN)
221  {
223  psql_error("Invalid command \\%s. Try \\? for help.\n", cmd);
224  else
225  psql_error("invalid command \\%s\n", cmd);
226  status = PSQL_CMD_ERROR;
227  }
228 
229  if (status != PSQL_CMD_ERROR)
230  {
231  /*
232  * Eat any remaining arguments after a valid command. We want to
233  * suppress evaluation of backticks in this situation, so transiently
234  * push an inactive conditional-stack entry.
235  */
236  bool active_branch = conditional_active(cstack);
237 
239  while ((arg = psql_scan_slash_option(scan_state,
240  OT_NORMAL, NULL, false)))
241  {
242  if (active_branch)
243  psql_error("\\%s: extra argument \"%s\" ignored\n", cmd, arg);
244  free(arg);
245  }
246  conditional_stack_pop(cstack);
247  }
248  else
249  {
250  /* silently throw away rest of line after an erroneous command */
251  while ((arg = psql_scan_slash_option(scan_state,
252  OT_WHOLE_LINE, NULL, false)))
253  free(arg);
254  }
255 
256  /* if there is a trailing \\, swallow it */
257  psql_scan_slash_command_end(scan_state);
258 
259  free(cmd);
260 
261  /* some commands write to queryFout, so make sure output is sent */
262  fflush(pset.queryFout);
263 
264  return status;
265 }
void psql_scan_slash_command_end(PsqlScanState state)
bool conditional_active(ConditionalStack cstack)
Definition: conditional.c:104
PsqlSettings pset
Definition: startup.c:33
bool conditional_stack_pop(ConditionalStack cstack)
Definition: conditional.c:55
char * psql_scan_slash_command(PsqlScanState state)
void conditional_stack_push(ConditionalStack cstack, ifState new_state)
Definition: conditional.c:39
FILE * queryFout
Definition: settings.h:84
static backslashResult exec_command(const char *cmd, PsqlScanState scan_state, ConditionalStack cstack, PQExpBuffer query_buf, PQExpBuffer previous_buf)
Definition: command.c:276
bool cur_cmd_interactive
Definition: settings.h:105
char * psql_scan_slash_option(PsqlScanState state, enum slash_option_type type, char *quote, bool semicolon)
void psql_error(const char *fmt,...)
Definition: common.c:220
#define free(a)
Definition: header.h:65
enum _backslashResult backslashResult
#define NULL
Definition: c.h:229
#define Assert(condition)
Definition: c.h:676
void * arg
static void static void status(const char *fmt,...) pg_attribute_printf(1
Definition: pg_regress.c:224
int process_file ( char *  filename,
bool  use_relative_path 
)

Definition at line 3611 of file command.c.

References canonicalize_path(), EXIT_FAILURE, fd(), filename, get_parent_directory(), has_drive_prefix(), _psqlSettings::inputfile, is_absolute_path, join_path_components(), MainLoop(), MAXPGPATH, NULL, PG_BINARY_R, pset, psql_error(), relpath, result, strerror(), and strlcpy().

Referenced by exec_command_include().

3612 {
3613  FILE *fd;
3614  int result;
3615  char *oldfilename;
3616  char relpath[MAXPGPATH];
3617 
3618  if (!filename)
3619  {
3620  fd = stdin;
3621  filename = NULL;
3622  }
3623  else if (strcmp(filename, "-") != 0)
3624  {
3626 
3627  /*
3628  * If we were asked to resolve the pathname relative to the location
3629  * of the currently executing script, and there is one, and this is a
3630  * relative pathname, then prepend all but the last pathname component
3631  * of the current script to this pathname.
3632  */
3633  if (use_relative_path && pset.inputfile &&
3635  {
3636  strlcpy(relpath, pset.inputfile, sizeof(relpath));
3637  get_parent_directory(relpath);
3638  join_path_components(relpath, relpath, filename);
3639  canonicalize_path(relpath);
3640 
3641  filename = relpath;
3642  }
3643 
3644  fd = fopen(filename, PG_BINARY_R);
3645 
3646  if (!fd)
3647  {
3648  psql_error("%s: %s\n", filename, strerror(errno));
3649  return EXIT_FAILURE;
3650  }
3651  }
3652  else
3653  {
3654  fd = stdin;
3655  filename = "<stdin>"; /* for future error messages */
3656  }
3657 
3658  oldfilename = pset.inputfile;
3660 
3661  result = MainLoop(fd);
3662 
3663  if (fd != stdin)
3664  fclose(fd);
3665 
3666  pset.inputfile = oldfilename;
3667  return result;
3668 }
PsqlSettings pset
Definition: startup.c:33
void canonicalize_path(char *path)
Definition: path.c:254
return result
Definition: formatting.c:1633
char * inputfile
Definition: settings.h:108
#define PG_BINARY_R
Definition: c.h:1041
static int fd(const char *x, int i)
Definition: preproc-init.c:105
bool has_drive_prefix(const char *filename)
Definition: path.c:87
#define MAXPGPATH
#define is_absolute_path(filename)
Definition: port.h:77
void get_parent_directory(char *path)
Definition: path.c:854
void psql_error(const char *fmt,...)
Definition: common.c:220
size_t strlcpy(char *dst, const char *src, size_t siz)
Definition: strlcpy.c:45
#define NULL
Definition: c.h:229
int MainLoop(FILE *source)
Definition: mainloop.c:35
void join_path_components(char *ret_path, const char *head, const char *tail)
Definition: path.c:218
static char * filename
Definition: pg_dumpall.c:90
const char * strerror(int errnum)
Definition: strerror.c:19
#define relpath(rnode, forknum)
Definition: relpath.h:71
#define EXIT_FAILURE
Definition: settings.h:151
void SyncVariables ( void  )

Definition at line 3338 of file command.c.

References _psqlSettings::db, _psqlSettings::encoding, printTableOpt::encoding, pg_encoding_to_char(), _psqlSettings::popt, PQclientEncoding(), PQdb(), PQhost(), PQport(), PQserverVersion(), PQsetErrorContextVisibility(), PQsetErrorVerbosity(), PQuser(), pset, SetVariable(), _psqlSettings::show_context, _psqlSettings::sversion, printQueryOpt::topt, _psqlSettings::vars, and _psqlSettings::verbosity.

Referenced by do_connect(), and main().

3339 {
3340  /* get stuff from connection */
3344 
3345  SetVariable(pset.vars, "DBNAME", PQdb(pset.db));
3346  SetVariable(pset.vars, "USER", PQuser(pset.db));
3347  SetVariable(pset.vars, "HOST", PQhost(pset.db));
3348  SetVariable(pset.vars, "PORT", PQport(pset.db));
3350 
3351  /* send stuff to it, too */
3354 }
PGconn * db
Definition: settings.h:82
int encoding
Definition: print.h:118
PsqlSettings pset
Definition: startup.c:33
printTableOpt topt
Definition: print.h:165
char * PQport(const PGconn *conn)
Definition: fe-connect.c:6018
int PQserverVersion(const PGconn *conn)
Definition: fe-connect.c:6087
int PQclientEncoding(const PGconn *conn)
Definition: fe-connect.c:6157
char * PQuser(const PGconn *conn)
Definition: fe-connect.c:5973
PGContextVisibility show_context
Definition: settings.h:140
PGContextVisibility PQsetErrorContextVisibility(PGconn *conn, PGContextVisibility show_context)
Definition: fe-connect.c:6223
PGVerbosity verbosity
Definition: settings.h:139
char * PQhost(const PGconn *conn)
Definition: fe-connect.c:5998
const char * pg_encoding_to_char(int encoding)
Definition: encnames.c:607
char * PQdb(const PGconn *conn)
Definition: fe-connect.c:5965
bool SetVariable(VariableSpace space, const char *name, const char *value)
Definition: variables.c:211
printQueryOpt popt
Definition: settings.h:91
int encoding
Definition: settings.h:83
PGVerbosity PQsetErrorVerbosity(PGconn *conn, PGVerbosity verbosity)
Definition: fe-connect.c:6211
VariableSpace vars
Definition: settings.h:116
void UnsyncVariables ( void  )

Definition at line 3362 of file command.c.

References NULL, pset, SetVariable(), and _psqlSettings::vars.

Referenced by CheckConnection().

3363 {
3364  SetVariable(pset.vars, "DBNAME", NULL);
3365  SetVariable(pset.vars, "USER", NULL);
3366  SetVariable(pset.vars, "HOST", NULL);
3367  SetVariable(pset.vars, "PORT", NULL);
3368  SetVariable(pset.vars, "ENCODING", NULL);
3369 }
PsqlSettings pset
Definition: startup.c:33
#define NULL
Definition: c.h:229
bool SetVariable(VariableSpace space, const char *name, const char *value)
Definition: variables.c:211
VariableSpace vars
Definition: settings.h:116