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 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, PQExpBuffer query_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 15 of file command.h.

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

Function Documentation

void connection_warnings ( bool  in_startup)

Definition at line 2048 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().

2049 {
2050  if (!pset.quiet && !pset.notty)
2051  {
2052  int client_ver = PG_VERSION_NUM;
2053  char cverbuf[32];
2054  char sverbuf[32];
2055 
2056  if (pset.sversion != client_ver)
2057  {
2058  const char *server_version;
2059 
2060  /* Try to get full text form, might include "devel" etc */
2061  server_version = PQparameterStatus(pset.db, "server_version");
2062  /* Otherwise fall back on pset.sversion */
2063  if (!server_version)
2064  {
2066  sverbuf, sizeof(sverbuf));
2067  server_version = sverbuf;
2068  }
2069 
2070  printf(_("%s (%s, server %s)\n"),
2071  pset.progname, PG_VERSION, server_version);
2072  }
2073  /* For version match, only print psql banner on startup. */
2074  else if (in_startup)
2075  printf("%s (%s)\n", pset.progname, PG_VERSION);
2076 
2077  if (pset.sversion / 100 > client_ver / 100)
2078  printf(_("WARNING: %s major version %s, server major version %s.\n"
2079  " Some psql features might not work.\n"),
2080  pset.progname,
2081  formatPGVersionNumber(client_ver, false,
2082  cverbuf, sizeof(cverbuf)),
2084  sverbuf, sizeof(sverbuf)));
2085 
2086 #ifdef WIN32
2087  checkWin32Codepage();
2088 #endif
2089  printSSLInfo();
2090  }
2091 }
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:5976
const char * progname
Definition: settings.h:107
static int server_version
Definition: pg_dumpall.c:80
static void printSSLInfo(void)
Definition: command.c:2100
#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 2562 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(), and parse_psql_options().

2563 {
2564  size_t vallen = 0;
2565 
2566  Assert(param != NULL);
2567 
2568  if (value)
2569  vallen = strlen(value);
2570 
2571  /* set format */
2572  if (strcmp(param, "format") == 0)
2573  {
2574  if (!value)
2575  ;
2576  else if (pg_strncasecmp("unaligned", value, vallen) == 0)
2577  popt->topt.format = PRINT_UNALIGNED;
2578  else if (pg_strncasecmp("aligned", value, vallen) == 0)
2579  popt->topt.format = PRINT_ALIGNED;
2580  else if (pg_strncasecmp("wrapped", value, vallen) == 0)
2581  popt->topt.format = PRINT_WRAPPED;
2582  else if (pg_strncasecmp("html", value, vallen) == 0)
2583  popt->topt.format = PRINT_HTML;
2584  else if (pg_strncasecmp("asciidoc", value, vallen) == 0)
2585  popt->topt.format = PRINT_ASCIIDOC;
2586  else if (pg_strncasecmp("latex", value, vallen) == 0)
2587  popt->topt.format = PRINT_LATEX;
2588  else if (pg_strncasecmp("latex-longtable", value, vallen) == 0)
2590  else if (pg_strncasecmp("troff-ms", value, vallen) == 0)
2591  popt->topt.format = PRINT_TROFF_MS;
2592  else
2593  {
2594  psql_error("\\pset: allowed formats are unaligned, aligned, wrapped, html, asciidoc, latex, latex-longtable, troff-ms\n");
2595  return false;
2596  }
2597  }
2598 
2599  /* set table line style */
2600  else if (strcmp(param, "linestyle") == 0)
2601  {
2602  if (!value)
2603  ;
2604  else if (pg_strncasecmp("ascii", value, vallen) == 0)
2605  popt->topt.line_style = &pg_asciiformat;
2606  else if (pg_strncasecmp("old-ascii", value, vallen) == 0)
2608  else if (pg_strncasecmp("unicode", value, vallen) == 0)
2609  popt->topt.line_style = &pg_utf8format;
2610  else
2611  {
2612  psql_error("\\pset: allowed line styles are ascii, old-ascii, unicode\n");
2613  return false;
2614  }
2615  }
2616 
2617  /* set unicode border line style */
2618  else if (strcmp(param, "unicode_border_linestyle") == 0)
2619  {
2620  if (!value)
2621  ;
2622  else if (set_unicode_line_style(value, vallen,
2624  refresh_utf8format(&(popt->topt));
2625  else
2626  {
2627  psql_error("\\pset: allowed Unicode border line styles are single, double\n");
2628  return false;
2629  }
2630  }
2631 
2632  /* set unicode column line style */
2633  else if (strcmp(param, "unicode_column_linestyle") == 0)
2634  {
2635  if (!value)
2636  ;
2637  else if (set_unicode_line_style(value, vallen,
2639  refresh_utf8format(&(popt->topt));
2640  else
2641  {
2642  psql_error("\\pset: allowed Unicode column line styles are single, double\n");
2643  return false;
2644  }
2645  }
2646 
2647  /* set unicode header line style */
2648  else if (strcmp(param, "unicode_header_linestyle") == 0)
2649  {
2650  if (!value)
2651  ;
2652  else if (set_unicode_line_style(value, vallen,
2654  refresh_utf8format(&(popt->topt));
2655  else
2656  {
2657  psql_error("\\pset: allowed Unicode header line styles are single, double\n");
2658  return false;
2659  }
2660  }
2661 
2662  /* set border style/width */
2663  else if (strcmp(param, "border") == 0)
2664  {
2665  if (value)
2666  popt->topt.border = atoi(value);
2667  }
2668 
2669  /* set expanded/vertical mode */
2670  else if (strcmp(param, "x") == 0 ||
2671  strcmp(param, "expanded") == 0 ||
2672  strcmp(param, "vertical") == 0)
2673  {
2674  if (value && pg_strcasecmp(value, "auto") == 0)
2675  popt->topt.expanded = 2;
2676  else if (value)
2677  {
2678  bool on_off;
2679 
2680  if (ParseVariableBool(value, NULL, &on_off))
2681  popt->topt.expanded = on_off ? 1 : 0;
2682  else
2683  {
2684  PsqlVarEnumError(param, value, "on, off, auto");
2685  return false;
2686  }
2687  }
2688  else
2689  popt->topt.expanded = !popt->topt.expanded;
2690  }
2691 
2692  /* locale-aware numeric output */
2693  else if (strcmp(param, "numericlocale") == 0)
2694  {
2695  if (value)
2696  return ParseVariableBool(value, param, &popt->topt.numericLocale);
2697  else
2698  popt->topt.numericLocale = !popt->topt.numericLocale;
2699  }
2700 
2701  /* null display */
2702  else if (strcmp(param, "null") == 0)
2703  {
2704  if (value)
2705  {
2706  free(popt->nullPrint);
2707  popt->nullPrint = pg_strdup(value);
2708  }
2709  }
2710 
2711  /* field separator for unaligned text */
2712  else if (strcmp(param, "fieldsep") == 0)
2713  {
2714  if (value)
2715  {
2716  free(popt->topt.fieldSep.separator);
2718  popt->topt.fieldSep.separator_zero = false;
2719  }
2720  }
2721 
2722  else if (strcmp(param, "fieldsep_zero") == 0)
2723  {
2724  free(popt->topt.fieldSep.separator);
2725  popt->topt.fieldSep.separator = NULL;
2726  popt->topt.fieldSep.separator_zero = true;
2727  }
2728 
2729  /* record separator for unaligned text */
2730  else if (strcmp(param, "recordsep") == 0)
2731  {
2732  if (value)
2733  {
2734  free(popt->topt.recordSep.separator);
2736  popt->topt.recordSep.separator_zero = false;
2737  }
2738  }
2739 
2740  else if (strcmp(param, "recordsep_zero") == 0)
2741  {
2742  free(popt->topt.recordSep.separator);
2743  popt->topt.recordSep.separator = NULL;
2744  popt->topt.recordSep.separator_zero = true;
2745  }
2746 
2747  /* toggle between full and tuples-only format */
2748  else if (strcmp(param, "t") == 0 || strcmp(param, "tuples_only") == 0)
2749  {
2750  if (value)
2751  return ParseVariableBool(value, param, &popt->topt.tuples_only);
2752  else
2753  popt->topt.tuples_only = !popt->topt.tuples_only;
2754  }
2755 
2756  /* set title override */
2757  else if (strcmp(param, "C") == 0 || strcmp(param, "title") == 0)
2758  {
2759  free(popt->title);
2760  if (!value)
2761  popt->title = NULL;
2762  else
2763  popt->title = pg_strdup(value);
2764  }
2765 
2766  /* set HTML table tag options */
2767  else if (strcmp(param, "T") == 0 || strcmp(param, "tableattr") == 0)
2768  {
2769  free(popt->topt.tableAttr);
2770  if (!value)
2771  popt->topt.tableAttr = NULL;
2772  else
2773  popt->topt.tableAttr = pg_strdup(value);
2774  }
2775 
2776  /* toggle use of pager */
2777  else if (strcmp(param, "pager") == 0)
2778  {
2779  if (value && pg_strcasecmp(value, "always") == 0)
2780  popt->topt.pager = 2;
2781  else if (value)
2782  {
2783  bool on_off;
2784 
2785  if (!ParseVariableBool(value, NULL, &on_off))
2786  {
2787  PsqlVarEnumError(param, value, "on, off, always");
2788  return false;
2789  }
2790  popt->topt.pager = on_off ? 1 : 0;
2791  }
2792  else if (popt->topt.pager == 1)
2793  popt->topt.pager = 0;
2794  else
2795  popt->topt.pager = 1;
2796  }
2797 
2798  /* set minimum lines for pager use */
2799  else if (strcmp(param, "pager_min_lines") == 0)
2800  {
2801  if (value)
2802  popt->topt.pager_min_lines = atoi(value);
2803  }
2804 
2805  /* disable "(x rows)" footer */
2806  else if (strcmp(param, "footer") == 0)
2807  {
2808  if (value)
2809  return ParseVariableBool(value, param, &popt->topt.default_footer);
2810  else
2811  popt->topt.default_footer = !popt->topt.default_footer;
2812  }
2813 
2814  /* set border style/width */
2815  else if (strcmp(param, "columns") == 0)
2816  {
2817  if (value)
2818  popt->topt.columns = atoi(value);
2819  }
2820  else
2821  {
2822  psql_error("\\pset: unknown option: %s\n", param);
2823  return false;
2824  }
2825 
2826  if (!quiet)
2827  printPsetInfo(param, &pset.popt);
2828 
2829  return true;
2830 }
char * nullPrint
Definition: print.h:166
static struct @78 value
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:2834
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:181
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:2530
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,
PQExpBuffer  query_buf 
)

Definition at line 108 of file command.c.

References arg, Assert, _psqlSettings::cur_cmd_interactive, exec_command(), free, NULL, OT_NO_EVAL, OT_WHOLE_LINE, pset, PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, 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().

110 {
112  char *cmd;
113  char *arg;
114 
115  Assert(scan_state != NULL);
116 
117  /* Parse off the command name */
118  cmd = psql_scan_slash_command(scan_state);
119 
120  /* And try to execute it */
121  status = exec_command(cmd, scan_state, query_buf);
122 
123  if (status == PSQL_CMD_UNKNOWN)
124  {
126  psql_error("Invalid command \\%s. Try \\? for help.\n", cmd);
127  else
128  psql_error("invalid command \\%s\n", cmd);
129  status = PSQL_CMD_ERROR;
130  }
131 
132  if (status != PSQL_CMD_ERROR)
133  {
134  /* eat any remaining arguments after a valid command */
135  /* note we suppress evaluation of backticks here */
136  while ((arg = psql_scan_slash_option(scan_state,
137  OT_NO_EVAL, NULL, false)))
138  {
139  psql_error("\\%s: extra argument \"%s\" ignored\n", cmd, arg);
140  free(arg);
141  }
142  }
143  else
144  {
145  /* silently throw away rest of line after an erroneous command */
146  while ((arg = psql_scan_slash_option(scan_state,
147  OT_WHOLE_LINE, NULL, false)))
148  free(arg);
149  }
150 
151  /* if there is a trailing \\, swallow it */
152  psql_scan_slash_command_end(scan_state);
153 
154  free(cmd);
155 
156  /* some commands write to queryFout, so make sure output is sent */
157  fflush(pset.queryFout);
158 
159  return status;
160 }
void psql_scan_slash_command_end(PsqlScanState state)
PsqlSettings pset
Definition: startup.c:33
char * psql_scan_slash_command(PsqlScanState state)
static backslashResult exec_command(const char *cmd, PsqlScanState scan_state, PQExpBuffer query_buf)
Definition: command.c:199
FILE * queryFout
Definition: settings.h:84
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:181
#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 2428 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().

2429 {
2430  FILE *fd;
2431  int result;
2432  char *oldfilename;
2433  char relpath[MAXPGPATH];
2434 
2435  if (!filename)
2436  {
2437  fd = stdin;
2438  filename = NULL;
2439  }
2440  else if (strcmp(filename, "-") != 0)
2441  {
2443 
2444  /*
2445  * If we were asked to resolve the pathname relative to the location
2446  * of the currently executing script, and there is one, and this is a
2447  * relative pathname, then prepend all but the last pathname component
2448  * of the current script to this pathname.
2449  */
2450  if (use_relative_path && pset.inputfile &&
2452  {
2453  strlcpy(relpath, pset.inputfile, sizeof(relpath));
2454  get_parent_directory(relpath);
2455  join_path_components(relpath, relpath, filename);
2456  canonicalize_path(relpath);
2457 
2458  filename = relpath;
2459  }
2460 
2461  fd = fopen(filename, PG_BINARY_R);
2462 
2463  if (!fd)
2464  {
2465  psql_error("%s: %s\n", filename, strerror(errno));
2466  return EXIT_FAILURE;
2467  }
2468  }
2469  else
2470  {
2471  fd = stdin;
2472  filename = "<stdin>"; /* for future error messages */
2473  }
2474 
2475  oldfilename = pset.inputfile;
2477 
2478  result = MainLoop(fd);
2479 
2480  if (fd != stdin)
2481  fclose(fd);
2482 
2483  pset.inputfile = oldfilename;
2484  return result;
2485 }
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:181
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 2155 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().

2156 {
2157  /* get stuff from connection */
2161 
2162  SetVariable(pset.vars, "DBNAME", PQdb(pset.db));
2163  SetVariable(pset.vars, "USER", PQuser(pset.db));
2164  SetVariable(pset.vars, "HOST", PQhost(pset.db));
2165  SetVariable(pset.vars, "PORT", PQport(pset.db));
2167 
2168  /* send stuff to it, too */
2171 }
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:5932
int PQserverVersion(const PGconn *conn)
Definition: fe-connect.c:6001
int PQclientEncoding(const PGconn *conn)
Definition: fe-connect.c:6071
char * PQuser(const PGconn *conn)
Definition: fe-connect.c:5887
PGContextVisibility show_context
Definition: settings.h:140
PGContextVisibility PQsetErrorContextVisibility(PGconn *conn, PGContextVisibility show_context)
Definition: fe-connect.c:6137
PGVerbosity verbosity
Definition: settings.h:139
char * PQhost(const PGconn *conn)
Definition: fe-connect.c:5912
const char * pg_encoding_to_char(int encoding)
Definition: encnames.c:607
char * PQdb(const PGconn *conn)
Definition: fe-connect.c:5879
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:6125
VariableSpace vars
Definition: settings.h:116
void UnsyncVariables ( void  )

Definition at line 2179 of file command.c.

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

Referenced by CheckConnection().

2180 {
2181  SetVariable(pset.vars, "DBNAME", NULL);
2182  SetVariable(pset.vars, "USER", NULL);
2183  SetVariable(pset.vars, "HOST", NULL);
2184  SetVariable(pset.vars, "PORT", NULL);
2185  SetVariable(pset.vars, "ENCODING", NULL);
2186 }
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