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 3223 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().

3224 {
3225  if (!pset.quiet && !pset.notty)
3226  {
3227  int client_ver = PG_VERSION_NUM;
3228  char cverbuf[32];
3229  char sverbuf[32];
3230 
3231  if (pset.sversion != client_ver)
3232  {
3233  const char *server_version;
3234 
3235  /* Try to get full text form, might include "devel" etc */
3236  server_version = PQparameterStatus(pset.db, "server_version");
3237  /* Otherwise fall back on pset.sversion */
3238  if (!server_version)
3239  {
3241  sverbuf, sizeof(sverbuf));
3242  server_version = sverbuf;
3243  }
3244 
3245  printf(_("%s (%s, server %s)\n"),
3246  pset.progname, PG_VERSION, server_version);
3247  }
3248  /* For version match, only print psql banner on startup. */
3249  else if (in_startup)
3250  printf("%s (%s)\n", pset.progname, PG_VERSION);
3251 
3252  if (pset.sversion / 100 > client_ver / 100)
3253  printf(_("WARNING: %s major version %s, server major version %s.\n"
3254  " Some psql features might not work.\n"),
3255  pset.progname,
3256  formatPGVersionNumber(client_ver, false,
3257  cverbuf, sizeof(cverbuf)),
3259  sverbuf, sizeof(sverbuf)));
3260 
3261 #ifdef WIN32
3262  checkWin32Codepage();
3263 #endif
3264  printSSLInfo();
3265  }
3266 }
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:5899
const char * progname
Definition: settings.h:107
static int server_version
Definition: pg_dumpall.c:80
static void printSSLInfo(void)
Definition: command.c:3275
#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 3737 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().

3738 {
3739  size_t vallen = 0;
3740 
3741  Assert(param != NULL);
3742 
3743  if (value)
3744  vallen = strlen(value);
3745 
3746  /* set format */
3747  if (strcmp(param, "format") == 0)
3748  {
3749  if (!value)
3750  ;
3751  else if (pg_strncasecmp("unaligned", value, vallen) == 0)
3752  popt->topt.format = PRINT_UNALIGNED;
3753  else if (pg_strncasecmp("aligned", value, vallen) == 0)
3754  popt->topt.format = PRINT_ALIGNED;
3755  else if (pg_strncasecmp("wrapped", value, vallen) == 0)
3756  popt->topt.format = PRINT_WRAPPED;
3757  else if (pg_strncasecmp("html", value, vallen) == 0)
3758  popt->topt.format = PRINT_HTML;
3759  else if (pg_strncasecmp("asciidoc", value, vallen) == 0)
3760  popt->topt.format = PRINT_ASCIIDOC;
3761  else if (pg_strncasecmp("latex", value, vallen) == 0)
3762  popt->topt.format = PRINT_LATEX;
3763  else if (pg_strncasecmp("latex-longtable", value, vallen) == 0)
3765  else if (pg_strncasecmp("troff-ms", value, vallen) == 0)
3766  popt->topt.format = PRINT_TROFF_MS;
3767  else
3768  {
3769  psql_error("\\pset: allowed formats are unaligned, aligned, wrapped, html, asciidoc, latex, latex-longtable, troff-ms\n");
3770  return false;
3771  }
3772  }
3773 
3774  /* set table line style */
3775  else if (strcmp(param, "linestyle") == 0)
3776  {
3777  if (!value)
3778  ;
3779  else if (pg_strncasecmp("ascii", value, vallen) == 0)
3780  popt->topt.line_style = &pg_asciiformat;
3781  else if (pg_strncasecmp("old-ascii", value, vallen) == 0)
3783  else if (pg_strncasecmp("unicode", value, vallen) == 0)
3784  popt->topt.line_style = &pg_utf8format;
3785  else
3786  {
3787  psql_error("\\pset: allowed line styles are ascii, old-ascii, unicode\n");
3788  return false;
3789  }
3790  }
3791 
3792  /* set unicode border line style */
3793  else if (strcmp(param, "unicode_border_linestyle") == 0)
3794  {
3795  if (!value)
3796  ;
3797  else if (set_unicode_line_style(value, vallen,
3799  refresh_utf8format(&(popt->topt));
3800  else
3801  {
3802  psql_error("\\pset: allowed Unicode border line styles are single, double\n");
3803  return false;
3804  }
3805  }
3806 
3807  /* set unicode column line style */
3808  else if (strcmp(param, "unicode_column_linestyle") == 0)
3809  {
3810  if (!value)
3811  ;
3812  else if (set_unicode_line_style(value, vallen,
3814  refresh_utf8format(&(popt->topt));
3815  else
3816  {
3817  psql_error("\\pset: allowed Unicode column line styles are single, double\n");
3818  return false;
3819  }
3820  }
3821 
3822  /* set unicode header line style */
3823  else if (strcmp(param, "unicode_header_linestyle") == 0)
3824  {
3825  if (!value)
3826  ;
3827  else if (set_unicode_line_style(value, vallen,
3829  refresh_utf8format(&(popt->topt));
3830  else
3831  {
3832  psql_error("\\pset: allowed Unicode header line styles are single, double\n");
3833  return false;
3834  }
3835  }
3836 
3837  /* set border style/width */
3838  else if (strcmp(param, "border") == 0)
3839  {
3840  if (value)
3841  popt->topt.border = atoi(value);
3842  }
3843 
3844  /* set expanded/vertical mode */
3845  else if (strcmp(param, "x") == 0 ||
3846  strcmp(param, "expanded") == 0 ||
3847  strcmp(param, "vertical") == 0)
3848  {
3849  if (value && pg_strcasecmp(value, "auto") == 0)
3850  popt->topt.expanded = 2;
3851  else if (value)
3852  {
3853  bool on_off;
3854 
3855  if (ParseVariableBool(value, NULL, &on_off))
3856  popt->topt.expanded = on_off ? 1 : 0;
3857  else
3858  {
3859  PsqlVarEnumError(param, value, "on, off, auto");
3860  return false;
3861  }
3862  }
3863  else
3864  popt->topt.expanded = !popt->topt.expanded;
3865  }
3866 
3867  /* locale-aware numeric output */
3868  else if (strcmp(param, "numericlocale") == 0)
3869  {
3870  if (value)
3871  return ParseVariableBool(value, param, &popt->topt.numericLocale);
3872  else
3873  popt->topt.numericLocale = !popt->topt.numericLocale;
3874  }
3875 
3876  /* null display */
3877  else if (strcmp(param, "null") == 0)
3878  {
3879  if (value)
3880  {
3881  free(popt->nullPrint);
3882  popt->nullPrint = pg_strdup(value);
3883  }
3884  }
3885 
3886  /* field separator for unaligned text */
3887  else if (strcmp(param, "fieldsep") == 0)
3888  {
3889  if (value)
3890  {
3891  free(popt->topt.fieldSep.separator);
3893  popt->topt.fieldSep.separator_zero = false;
3894  }
3895  }
3896 
3897  else if (strcmp(param, "fieldsep_zero") == 0)
3898  {
3899  free(popt->topt.fieldSep.separator);
3900  popt->topt.fieldSep.separator = NULL;
3901  popt->topt.fieldSep.separator_zero = true;
3902  }
3903 
3904  /* record separator for unaligned text */
3905  else if (strcmp(param, "recordsep") == 0)
3906  {
3907  if (value)
3908  {
3909  free(popt->topt.recordSep.separator);
3911  popt->topt.recordSep.separator_zero = false;
3912  }
3913  }
3914 
3915  else if (strcmp(param, "recordsep_zero") == 0)
3916  {
3917  free(popt->topt.recordSep.separator);
3918  popt->topt.recordSep.separator = NULL;
3919  popt->topt.recordSep.separator_zero = true;
3920  }
3921 
3922  /* toggle between full and tuples-only format */
3923  else if (strcmp(param, "t") == 0 || strcmp(param, "tuples_only") == 0)
3924  {
3925  if (value)
3926  return ParseVariableBool(value, param, &popt->topt.tuples_only);
3927  else
3928  popt->topt.tuples_only = !popt->topt.tuples_only;
3929  }
3930 
3931  /* set title override */
3932  else if (strcmp(param, "C") == 0 || strcmp(param, "title") == 0)
3933  {
3934  free(popt->title);
3935  if (!value)
3936  popt->title = NULL;
3937  else
3938  popt->title = pg_strdup(value);
3939  }
3940 
3941  /* set HTML table tag options */
3942  else if (strcmp(param, "T") == 0 || strcmp(param, "tableattr") == 0)
3943  {
3944  free(popt->topt.tableAttr);
3945  if (!value)
3946  popt->topt.tableAttr = NULL;
3947  else
3948  popt->topt.tableAttr = pg_strdup(value);
3949  }
3950 
3951  /* toggle use of pager */
3952  else if (strcmp(param, "pager") == 0)
3953  {
3954  if (value && pg_strcasecmp(value, "always") == 0)
3955  popt->topt.pager = 2;
3956  else if (value)
3957  {
3958  bool on_off;
3959 
3960  if (!ParseVariableBool(value, NULL, &on_off))
3961  {
3962  PsqlVarEnumError(param, value, "on, off, always");
3963  return false;
3964  }
3965  popt->topt.pager = on_off ? 1 : 0;
3966  }
3967  else if (popt->topt.pager == 1)
3968  popt->topt.pager = 0;
3969  else
3970  popt->topt.pager = 1;
3971  }
3972 
3973  /* set minimum lines for pager use */
3974  else if (strcmp(param, "pager_min_lines") == 0)
3975  {
3976  if (value)
3977  popt->topt.pager_min_lines = atoi(value);
3978  }
3979 
3980  /* disable "(x rows)" footer */
3981  else if (strcmp(param, "footer") == 0)
3982  {
3983  if (value)
3984  return ParseVariableBool(value, param, &popt->topt.default_footer);
3985  else
3986  popt->topt.default_footer = !popt->topt.default_footer;
3987  }
3988 
3989  /* set border style/width */
3990  else if (strcmp(param, "columns") == 0)
3991  {
3992  if (value)
3993  popt->topt.columns = atoi(value);
3994  }
3995  else
3996  {
3997  psql_error("\\pset: unknown option: %s\n", param);
3998  return false;
3999  }
4000 
4001  if (!quiet)
4002  printPsetInfo(param, &pset.popt);
4003 
4004  return true;
4005 }
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:4009
unicode_linestyle unicode_column_linestyle
Definition: print.h:122
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:675
printQueryOpt popt
Definition: settings.h:91
static bool set_unicode_line_style(const char *value, size_t vallen, unicode_linestyle *linestyle)
Definition: command.c:3705
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
static struct @121 value
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:675
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 3603 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().

3604 {
3605  FILE *fd;
3606  int result;
3607  char *oldfilename;
3608  char relpath[MAXPGPATH];
3609 
3610  if (!filename)
3611  {
3612  fd = stdin;
3613  filename = NULL;
3614  }
3615  else if (strcmp(filename, "-") != 0)
3616  {
3618 
3619  /*
3620  * If we were asked to resolve the pathname relative to the location
3621  * of the currently executing script, and there is one, and this is a
3622  * relative pathname, then prepend all but the last pathname component
3623  * of the current script to this pathname.
3624  */
3625  if (use_relative_path && pset.inputfile &&
3627  {
3628  strlcpy(relpath, pset.inputfile, sizeof(relpath));
3629  get_parent_directory(relpath);
3630  join_path_components(relpath, relpath, filename);
3631  canonicalize_path(relpath);
3632 
3633  filename = relpath;
3634  }
3635 
3636  fd = fopen(filename, PG_BINARY_R);
3637 
3638  if (!fd)
3639  {
3640  psql_error("%s: %s\n", filename, strerror(errno));
3641  return EXIT_FAILURE;
3642  }
3643  }
3644  else
3645  {
3646  fd = stdin;
3647  filename = "<stdin>"; /* for future error messages */
3648  }
3649 
3650  oldfilename = pset.inputfile;
3652 
3653  result = MainLoop(fd);
3654 
3655  if (fd != stdin)
3656  fclose(fd);
3657 
3658  pset.inputfile = oldfilename;
3659  return result;
3660 }
PsqlSettings pset
Definition: startup.c:33
void canonicalize_path(char *path)
Definition: path.c:254
return result
Definition: formatting.c:1618
char * inputfile
Definition: settings.h:108
#define PG_BINARY_R
Definition: c.h:1040
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:87
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 3330 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().

3331 {
3332  /* get stuff from connection */
3336 
3337  SetVariable(pset.vars, "DBNAME", PQdb(pset.db));
3338  SetVariable(pset.vars, "USER", PQuser(pset.db));
3339  SetVariable(pset.vars, "HOST", PQhost(pset.db));
3340  SetVariable(pset.vars, "PORT", PQport(pset.db));
3342 
3343  /* send stuff to it, too */
3346 }
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:5855
int PQserverVersion(const PGconn *conn)
Definition: fe-connect.c:5924
int PQclientEncoding(const PGconn *conn)
Definition: fe-connect.c:5994
char * PQuser(const PGconn *conn)
Definition: fe-connect.c:5810
PGContextVisibility show_context
Definition: settings.h:140
PGContextVisibility PQsetErrorContextVisibility(PGconn *conn, PGContextVisibility show_context)
Definition: fe-connect.c:6060
PGVerbosity verbosity
Definition: settings.h:139
char * PQhost(const PGconn *conn)
Definition: fe-connect.c:5835
const char * pg_encoding_to_char(int encoding)
Definition: encnames.c:607
char * PQdb(const PGconn *conn)
Definition: fe-connect.c:5802
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:6048
VariableSpace vars
Definition: settings.h:116
void UnsyncVariables ( void  )

Definition at line 3354 of file command.c.

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

Referenced by CheckConnection().

3355 {
3356  SetVariable(pset.vars, "DBNAME", NULL);
3357  SetVariable(pset.vars, "USER", NULL);
3358  SetVariable(pset.vars, "HOST", NULL);
3359  SetVariable(pset.vars, "PORT", NULL);
3360  SetVariable(pset.vars, "ENCODING", NULL);
3361 }
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