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

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

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

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

Definition at line 2426 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, strerror(), and strlcpy().

Referenced by exec_command().

2427 {
2428  FILE *fd;
2429  int result;
2430  char *oldfilename;
2431  char relpath[MAXPGPATH];
2432 
2433  if (!filename)
2434  {
2435  fd = stdin;
2436  filename = NULL;
2437  }
2438  else if (strcmp(filename, "-") != 0)
2439  {
2441 
2442  /*
2443  * If we were asked to resolve the pathname relative to the location
2444  * of the currently executing script, and there is one, and this is a
2445  * relative pathname, then prepend all but the last pathname component
2446  * of the current script to this pathname.
2447  */
2448  if (use_relative_path && pset.inputfile &&
2450  {
2451  strlcpy(relpath, pset.inputfile, sizeof(relpath));
2452  get_parent_directory(relpath);
2453  join_path_components(relpath, relpath, filename);
2454  canonicalize_path(relpath);
2455 
2456  filename = relpath;
2457  }
2458 
2459  fd = fopen(filename, PG_BINARY_R);
2460 
2461  if (!fd)
2462  {
2463  psql_error("%s: %s\n", filename, strerror(errno));
2464  return EXIT_FAILURE;
2465  }
2466  }
2467  else
2468  {
2469  fd = stdin;
2470  filename = "<stdin>"; /* for future error messages */
2471  }
2472 
2473  oldfilename = pset.inputfile;
2475 
2476  result = MainLoop(fd);
2477 
2478  if (fd != stdin)
2479  fclose(fd);
2480 
2481  pset.inputfile = oldfilename;
2482  return result;
2483 }
PsqlSettings pset
Definition: startup.c:37
void canonicalize_path(char *path)
Definition: path.c:254
char * inputfile
Definition: settings.h:107
#define PG_BINARY_R
Definition: c.h:1039
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:177
size_t strlcpy(char *dst, const char *src, size_t siz)
Definition: strlcpy.c:45
#define NULL
Definition: c.h:226
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:84
const char * strerror(int errnum)
Definition: strerror.c:19
#define relpath(rnode, forknum)
Definition: relpath.h:71
#define EXIT_FAILURE
Definition: settings.h:150
void SyncVariables ( void  )

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

2154 {
2155  /* get stuff from connection */
2159 
2160  SetVariable(pset.vars, "DBNAME", PQdb(pset.db));
2161  SetVariable(pset.vars, "USER", PQuser(pset.db));
2162  SetVariable(pset.vars, "HOST", PQhost(pset.db));
2163  SetVariable(pset.vars, "PORT", PQport(pset.db));
2165 
2166  /* send stuff to it, too */
2169 }
PGconn * db
Definition: settings.h:82
int encoding
Definition: print.h:118
PsqlSettings pset
Definition: startup.c:37
printTableOpt topt
Definition: print.h:165
char * PQport(const PGconn *conn)
Definition: fe-connect.c:5881
int PQserverVersion(const PGconn *conn)
Definition: fe-connect.c:5950
int PQclientEncoding(const PGconn *conn)
Definition: fe-connect.c:6020
char * PQuser(const PGconn *conn)
Definition: fe-connect.c:5836
PGContextVisibility show_context
Definition: settings.h:139
PGContextVisibility PQsetErrorContextVisibility(PGconn *conn, PGContextVisibility show_context)
Definition: fe-connect.c:6086
PGVerbosity verbosity
Definition: settings.h:138
char * PQhost(const PGconn *conn)
Definition: fe-connect.c:5861
const char * pg_encoding_to_char(int encoding)
Definition: encnames.c:531
char * PQdb(const PGconn *conn)
Definition: fe-connect.c:5828
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:6074
VariableSpace vars
Definition: settings.h:115
void UnsyncVariables ( void  )

Definition at line 2177 of file command.c.

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

Referenced by CheckConnection().

2178 {
2179  SetVariable(pset.vars, "DBNAME", NULL);
2180  SetVariable(pset.vars, "USER", NULL);
2181  SetVariable(pset.vars, "HOST", NULL);
2182  SetVariable(pset.vars, "PORT", NULL);
2183  SetVariable(pset.vars, "ENCODING", NULL);
2184 }
PsqlSettings pset
Definition: startup.c:37
#define NULL
Definition: c.h:226
bool SetVariable(VariableSpace space, const char *name, const char *value)
Definition: variables.c:211
VariableSpace vars
Definition: settings.h:115