Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef SETTINGS_H
00009 #define SETTINGS_H
00010
00011
00012 #include "variables.h"
00013 #include "print.h"
00014
00015 #define DEFAULT_FIELD_SEP "|"
00016 #define DEFAULT_RECORD_SEP "\n"
00017
00018 #if defined(WIN32) || defined(__CYGWIN__)
00019 #define DEFAULT_EDITOR "notepad.exe"
00020
00021 #else
00022 #define DEFAULT_EDITOR "vi"
00023 #define DEFAULT_EDITOR_LINENUMBER_ARG "+"
00024 #endif
00025
00026 #define DEFAULT_PROMPT1 "%/%R%# "
00027 #define DEFAULT_PROMPT2 "%/%R%# "
00028 #define DEFAULT_PROMPT3 ">> "
00029
00030 typedef enum
00031 {
00032 PSQL_ECHO_NONE,
00033 PSQL_ECHO_QUERIES,
00034 PSQL_ECHO_ALL
00035 } PSQL_ECHO;
00036
00037 typedef enum
00038 {
00039 PSQL_ECHO_HIDDEN_OFF,
00040 PSQL_ECHO_HIDDEN_ON,
00041 PSQL_ECHO_HIDDEN_NOEXEC
00042 } PSQL_ECHO_HIDDEN;
00043
00044 typedef enum
00045 {
00046 PSQL_ERROR_ROLLBACK_OFF,
00047 PSQL_ERROR_ROLLBACK_INTERACTIVE,
00048 PSQL_ERROR_ROLLBACK_ON
00049 } PSQL_ERROR_ROLLBACK;
00050
00051 typedef enum
00052 {
00053 hctl_none = 0,
00054 hctl_ignorespace = 1,
00055 hctl_ignoredups = 2,
00056 hctl_ignoreboth = hctl_ignorespace | hctl_ignoredups
00057 } HistControl;
00058
00059 enum trivalue
00060 {
00061 TRI_DEFAULT,
00062 TRI_NO,
00063 TRI_YES
00064 };
00065
00066 typedef struct _psqlSettings
00067 {
00068 PGconn *db;
00069 int encoding;
00070 FILE *queryFout;
00071 bool queryFoutPipe;
00072
00073 printQueryOpt popt;
00074
00075 char *gfname;
00076 char *gset_prefix;
00077
00078 bool notty;
00079
00080 enum trivalue getPassword;
00081 FILE *cur_cmd_source;
00082
00083 bool cur_cmd_interactive;
00084 int sversion;
00085 const char *progname;
00086 char *inputfile;
00087 char *dirname;
00088
00089 uint64 lineno;
00090
00091 bool timing;
00092
00093 FILE *logfile;
00094
00095 VariableSpace vars;
00096
00097
00098
00099
00100
00101
00102 bool autocommit;
00103 bool on_error_stop;
00104 bool quiet;
00105 bool singleline;
00106 bool singlestep;
00107 int fetch_count;
00108 PSQL_ECHO echo;
00109 PSQL_ECHO_HIDDEN echo_hidden;
00110 PSQL_ERROR_ROLLBACK on_error_rollback;
00111 HistControl histcontrol;
00112 const char *prompt1;
00113 const char *prompt2;
00114 const char *prompt3;
00115 PGVerbosity verbosity;
00116 } PsqlSettings;
00117
00118 extern PsqlSettings pset;
00119
00120
00121 #ifndef EXIT_SUCCESS
00122 #define EXIT_SUCCESS 0
00123 #endif
00124
00125 #ifndef EXIT_FAILURE
00126 #define EXIT_FAILURE 1
00127 #endif
00128
00129 #define EXIT_BADCONN 2
00130
00131 #define EXIT_USER 3
00132
00133 #endif