2000-01-19 00:30:24 +01:00
|
|
|
/*
|
|
|
|
* psql - the PostgreSQL interactive terminal
|
|
|
|
*
|
2000-01-29 17:58:54 +01:00
|
|
|
* Copyright 2000 by PostgreSQL Global Development Group
|
2000-01-19 00:30:24 +01:00
|
|
|
*
|
2002-03-05 01:01:03 +01:00
|
|
|
* $Header: /cvsroot/pgsql/src/bin/psql/settings.h,v 1.13 2002/03/05 00:01:02 momjian Exp $
|
2000-01-19 00:30:24 +01:00
|
|
|
*/
|
1999-11-04 22:56:02 +01:00
|
|
|
#ifndef SETTINGS_H
|
|
|
|
#define SETTINGS_H
|
2000-01-19 00:30:24 +01:00
|
|
|
|
2000-02-16 14:15:26 +01:00
|
|
|
#include "libpq-fe.h"
|
1999-11-04 22:56:02 +01:00
|
|
|
|
|
|
|
#include "variables.h"
|
|
|
|
#include "print.h"
|
|
|
|
|
|
|
|
#define DEFAULT_FIELD_SEP "|"
|
2000-01-19 00:30:24 +01:00
|
|
|
#define DEFAULT_RECORD_SEP "\n"
|
1999-12-10 04:59:30 +01:00
|
|
|
#define DEFAULT_EDITOR "vi"
|
1999-11-04 22:56:02 +01:00
|
|
|
|
|
|
|
#define DEFAULT_PROMPT1 "%/%R%# "
|
|
|
|
#define DEFAULT_PROMPT2 "%/%R%# "
|
|
|
|
#define DEFAULT_PROMPT3 ">> "
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct _psqlSettings
|
|
|
|
{
|
1999-11-05 00:14:30 +01:00
|
|
|
PGconn *db; /* connection to backend */
|
2000-04-12 19:17:23 +02:00
|
|
|
int encoding;
|
1999-11-05 00:14:30 +01:00
|
|
|
FILE *queryFout; /* where to send the query results */
|
|
|
|
bool queryFoutPipe; /* queryFout is from a popen() */
|
|
|
|
|
|
|
|
printQueryOpt popt;
|
|
|
|
VariableSpace vars; /* "shell variable" repository */
|
|
|
|
|
|
|
|
char *gfname; /* one-shot file output argument for \g */
|
|
|
|
|
|
|
|
bool notty; /* stdin or stdout is not a tty (as
|
|
|
|
* determined on startup) */
|
|
|
|
bool useReadline; /* use libreadline routines */
|
|
|
|
bool useHistory;
|
|
|
|
bool getPassword; /* prompt the user for a username and
|
|
|
|
* password */
|
|
|
|
FILE *cur_cmd_source; /* describe the status of the current main
|
|
|
|
* loop */
|
|
|
|
bool cur_cmd_interactive;
|
|
|
|
|
2000-04-12 19:17:23 +02:00
|
|
|
char *progname; /* in case you renamed psql */
|
|
|
|
char *inputfile; /* for error reporting */
|
|
|
|
unsigned lineno; /* also for error reporting */
|
2000-01-29 17:58:54 +01:00
|
|
|
|
2000-04-12 19:17:23 +02:00
|
|
|
bool issuper; /* is the current user a superuser? (used
|
|
|
|
* to form the prompt) */
|
2002-03-05 01:01:03 +01:00
|
|
|
bool timing; /* timing of all queries */
|
1999-11-04 22:56:02 +01:00
|
|
|
} PsqlSettings;
|
|
|
|
|
2000-01-14 23:18:03 +01:00
|
|
|
extern PsqlSettings pset;
|
|
|
|
|
|
|
|
|
|
|
|
#define QUIET() (GetVariableBool(pset.vars, "QUIET"))
|
1999-11-04 22:56:02 +01:00
|
|
|
|
|
|
|
|
|
|
|
#ifndef EXIT_SUCCESS
|
|
|
|
#define EXIT_SUCCESS 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef EXIT_FAILURE
|
|
|
|
#define EXIT_FAILURE 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define EXIT_BADCONN 2
|
|
|
|
|
|
|
|
#define EXIT_USER 3
|
2001-10-28 07:26:15 +01:00
|
|
|
|
1999-11-04 22:56:02 +01:00
|
|
|
#endif
|