2 * psql - the PostgreSQL interactive terminal
4 * Copyright (c) 2000-2008, PostgreSQL Global Development Group
6 * $PostgreSQL: pgsql/src/bin/psql/settings.h,v 1.33 2008/01/01 19:45:56 momjian Exp $
13 #include "variables.h"
16 #define DEFAULT_FIELD_SEP "|"
17 #define DEFAULT_RECORD_SEP "\n"
19 #if defined(WIN32) || defined(__CYGWIN__)
20 #define DEFAULT_EDITOR "notepad.exe"
22 #define DEFAULT_EDITOR "vi"
25 #define DEFAULT_PROMPT1 "%/%R%# "
26 #define DEFAULT_PROMPT2 "%/%R%# "
27 #define DEFAULT_PROMPT3 ">> "
40 PSQL_ECHO_HIDDEN_NOEXEC
45 PSQL_ERROR_ROLLBACK_OFF,
46 PSQL_ERROR_ROLLBACK_INTERACTIVE,
47 PSQL_ERROR_ROLLBACK_ON
48 } PSQL_ERROR_ROLLBACK;
55 hctl_ignoreboth = hctl_ignorespace | hctl_ignoredups
59 typedef struct _psqlSettings
61 PGconn *db; /* connection to backend */
62 int encoding; /* client_encoding */
63 FILE *queryFout; /* where to send the query results */
64 bool queryFoutPipe; /* queryFout is from a popen() */
68 char *gfname; /* one-shot file output argument for \g */
70 bool notty; /* stdin or stdout is not a tty (as determined
72 bool getPassword; /* prompt the user for a username and password */
73 FILE *cur_cmd_source; /* describe the status of the current main
75 bool cur_cmd_interactive;
76 int sversion; /* backend server version */
77 const char *progname; /* in case you renamed psql */
78 char *inputfile; /* for error reporting */
79 char *dirname; /* current directory for \s display */
81 uint64 lineno; /* also for error reporting */
83 bool timing; /* enable timing of all queries */
85 FILE *logfile; /* session log file handle */
87 VariableSpace vars; /* "shell variable" repository */
90 * The remaining fields are set by assign hooks associated with entries in
91 * "vars". They should not be set directly except by those hook
101 PSQL_ECHO_HIDDEN echo_hidden;
102 PSQL_ERROR_ROLLBACK on_error_rollback;
103 HistControl histcontrol;
107 PGVerbosity verbosity; /* current error verbosity level */
110 extern PsqlSettings pset;
114 #define EXIT_SUCCESS 0
118 #define EXIT_FAILURE 1
121 #define EXIT_BADCONN 2