Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
9672d38f
Commit
9672d38f
authored
Feb 13, 2000
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjusted psql echoing options (-a and -e)
parent
a2226ad2
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
57 additions
and
37 deletions
+57
-37
doc/src/sgml/ref/psql-ref.sgml
doc/src/sgml/ref/psql-ref.sgml
+23
-10
src/bin/psql/common.c
src/bin/psql/common.c
+2
-2
src/bin/psql/help.c
src/bin/psql/help.c
+2
-2
src/bin/psql/mainloop.c
src/bin/psql/mainloop.c
+2
-2
src/bin/psql/startup.c
src/bin/psql/startup.c
+13
-11
src/bin/psql/variables.c
src/bin/psql/variables.c
+9
-1
src/bin/psql/variables.h
src/bin/psql/variables.h
+2
-5
src/test/regress/regress.sh
src/test/regress/regress.sh
+2
-2
src/test/regress/run_check.sh
src/test/regress/run_check.sh
+2
-2
No files found.
doc/src/sgml/ref/psql-ref.sgml
View file @
9672d38f
<!--
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.2
4 2000/02/10 20:08:55
petere Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.2
5 2000/02/13 21:45:13
petere Exp $
Postgres documentation
Postgres documentation
-->
-->
...
@@ -609,7 +609,7 @@ Tue Oct 26 21:40:57 CEST 1999
...
@@ -609,7 +609,7 @@ Tue Oct 26 21:40:57 CEST 1999
<note>
<note>
<para>
<para>
If you want to see the lines on the screen as they are read you must set
If you want to see the lines on the screen as they are read you must set
the variable <envar>ECHO</envar> to <literal>
fu
ll</literal>.
the variable <envar>ECHO</envar> to <literal>
a
ll</literal>.
</para>
</para>
</note>
</note>
</listitem>
</listitem>
...
@@ -1189,6 +1189,18 @@ Access permissions for database "test"
...
@@ -1189,6 +1189,18 @@ Access permissions for database "test"
<para>
<para>
<variablelist>
<variablelist>
<varlistentry>
<term>-a, --echo-all</term>
<listitem>
<para>
Print all the lines to the screen as they are read. This is more useful for
script processing rather than interactive mode.
This is equivalent to setting the variable <envar>ECHO</envar> to <literal>all</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<varlistentry>
<term>-A, --no-align</term>
<term>-A, --no-align</term>
<listitem>
<listitem>
...
@@ -1234,11 +1246,12 @@ Access permissions for database "test"
...
@@ -1234,11 +1246,12 @@ Access permissions for database "test"
<varlistentry>
<varlistentry>
<term>-e, --echo</term>
<term>-e, --echo
-queries
</term>
<listitem>
<listitem>
<para>
<para>
In non-interactive mode, all lines are printed to the screen as they are read.
Show all queries that are sent to the backend.
This is equivalent to setting the variable <envar>ECHO</envar> to <literal>full</literal>.
This is equivalent to setting the variable <envar>ECHO</envar>
to <literal>queries</literal>.
</para>
</para>
</listitem>
</listitem>
</varlistentry>
</varlistentry>
...
@@ -1621,12 +1634,12 @@ bar
...
@@ -1621,12 +1634,12 @@ bar
<term><envar>ECHO</envar></term>
<term><envar>ECHO</envar></term>
<listitem>
<listitem>
<para>
<para>
If set to <quote><literal>
fu
ll</literal></quote>, all lines entered or from a script
If set to <quote><literal>
a
ll</literal></quote>, all lines entered or from a script
are written to the standard output before they
are written to the standard output before they
are parsed or executed. To specify this on program startup,
in conjunction with the
are parsed or executed. To specify this on program startup,
use the switch
<option>-f</option> option perhaps, use the switch <option>-e</option>.
<option>-a</option>. If set to <quote><literal>queries</literal></quote>,
If set to <quote><literal>brief</literal></quote>, <application>psql</application>
<application>psql</application> merely prints all queries as they are sent to the
merely prints all queries as they are sent to the backend
.
backend. The option for this is <option>-e</option>
.
</para>
</para>
</listitem>
</listitem>
</varlistentry>
</varlistentry>
...
...
src/bin/psql/common.c
View file @
9672d38f
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
*
*
* Copyright 2000 by PostgreSQL Global Development Group
* Copyright 2000 by PostgreSQL Global Development Group
*
*
* $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.1
2 2000/02/07 23:10:06
petere Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.1
3 2000/02/13 21:45:14
petere Exp $
*/
*/
#include <c.h>
#include <c.h>
#include "common.h"
#include "common.h"
...
@@ -382,7 +382,7 @@ SendQuery(const char *query)
...
@@ -382,7 +382,7 @@ SendQuery(const char *query)
else
else
{
{
const
char
*
var
=
GetVariable
(
pset
.
vars
,
"ECHO"
);
const
char
*
var
=
GetVariable
(
pset
.
vars
,
"ECHO"
);
if
(
var
&&
str
cmp
(
var
,
"brief"
)
==
0
)
if
(
var
&&
str
ncmp
(
var
,
"queries"
,
strlen
(
var
)
)
==
0
)
puts
(
query
);
puts
(
query
);
}
}
...
...
src/bin/psql/help.c
View file @
9672d38f
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
*
*
* Copyright 2000 by PostgreSQL Global Development Group
* Copyright 2000 by PostgreSQL Global Development Group
*
*
* $Header: /cvsroot/pgsql/src/bin/psql/help.c,v 1.1
7 2000/02/10 20:08:56
petere Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/help.c,v 1.1
8 2000/02/13 21:45:14
petere Exp $
*/
*/
#include <c.h>
#include <c.h>
#include "help.h"
#include "help.h"
...
@@ -72,7 +72,7 @@ usage(void)
...
@@ -72,7 +72,7 @@ usage(void)
puts
(
"Usage:"
);
puts
(
"Usage:"
);
puts
(
" psql [options] [dbname [username]]
\n
"
);
puts
(
" psql [options] [dbname [username]]
\n
"
);
puts
(
"Options:"
);
puts
(
"Options:"
);
/* puts( " -a Echo all input from script");*/
puts
(
" -a Echo all input from script"
);
puts
(
" -A Unaligned table output mode (-P format=unaligned)"
);
puts
(
" -A Unaligned table output mode (-P format=unaligned)"
);
puts
(
" -c <query> Run only single query (or slash command) and exit"
);
puts
(
" -c <query> Run only single query (or slash command) and exit"
);
...
...
src/bin/psql/mainloop.c
View file @
9672d38f
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
*
*
* Copyright 2000 by PostgreSQL Global Development Group
* Copyright 2000 by PostgreSQL Global Development Group
*
*
* $Header: /cvsroot/pgsql/src/bin/psql/mainloop.c,v 1.1
8 2000/02/10 20:08:56
petere Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/mainloop.c,v 1.1
9 2000/02/13 21:45:14
petere Exp $
*/
*/
#include <c.h>
#include <c.h>
#include "mainloop.h"
#include "mainloop.h"
...
@@ -217,7 +217,7 @@ MainLoop(FILE *source)
...
@@ -217,7 +217,7 @@ MainLoop(FILE *source)
/* echo back if flag is set */
/* echo back if flag is set */
var
=
GetVariable
(
pset
.
vars
,
"ECHO"
);
var
=
GetVariable
(
pset
.
vars
,
"ECHO"
);
if
(
var
&&
strcmp
(
var
,
"
fu
ll"
)
==
0
)
if
(
var
&&
strcmp
(
var
,
"
a
ll"
)
==
0
)
puts
(
line
);
puts
(
line
);
fflush
(
stdout
);
fflush
(
stdout
);
...
...
src/bin/psql/startup.c
View file @
9672d38f
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
*
*
* Copyright 2000 by PostgreSQL Global Development Group
* Copyright 2000 by PostgreSQL Global Development Group
*
*
* $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.2
2 2000/02/07 23:10:06
petere Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.2
3 2000/02/13 21:45:14
petere Exp $
*/
*/
#include <c.h>
#include <c.h>
...
@@ -280,17 +280,17 @@ parse_options(int argc, char *argv[], struct adhoc_opts * options)
...
@@ -280,17 +280,17 @@ parse_options(int argc, char *argv[], struct adhoc_opts * options)
#ifdef HAVE_GETOPT_LONG
#ifdef HAVE_GETOPT_LONG
static
struct
option
long_options
[]
=
static
struct
option
long_options
[]
=
{
{
{
"echo-all"
,
no_argument
,
NULL
,
'a'
},
{
"no-align"
,
no_argument
,
NULL
,
'A'
},
{
"no-align"
,
no_argument
,
NULL
,
'A'
},
{
"command"
,
required_argument
,
NULL
,
'c'
},
{
"command"
,
required_argument
,
NULL
,
'c'
},
{
"dbname"
,
required_argument
,
NULL
,
'd'
},
{
"dbname"
,
required_argument
,
NULL
,
'd'
},
{
"echo"
,
no_argument
,
NULL
,
'e'
},
{
"echo
-queries
"
,
no_argument
,
NULL
,
'e'
},
{
"echo-hidden"
,
no_argument
,
NULL
,
'E'
},
{
"echo-hidden"
,
no_argument
,
NULL
,
'E'
},
{
"file"
,
required_argument
,
NULL
,
'f'
},
{
"file"
,
required_argument
,
NULL
,
'f'
},
{
"field-separator"
,
required_argument
,
NULL
,
'F'
},
{
"field-separator"
,
required_argument
,
NULL
,
'F'
},
{
"host"
,
required_argument
,
NULL
,
'h'
},
{
"host"
,
required_argument
,
NULL
,
'h'
},
{
"html"
,
no_argument
,
NULL
,
'H'
},
{
"html"
,
no_argument
,
NULL
,
'H'
},
{
"list"
,
no_argument
,
NULL
,
'l'
},
{
"list"
,
no_argument
,
NULL
,
'l'
},
{
"no-readline"
,
no_argument
,
NULL
,
'n'
},
{
"output"
,
required_argument
,
NULL
,
'o'
},
{
"output"
,
required_argument
,
NULL
,
'o'
},
{
"port"
,
required_argument
,
NULL
,
'p'
},
{
"port"
,
required_argument
,
NULL
,
'p'
},
{
"pset"
,
required_argument
,
NULL
,
'P'
},
{
"pset"
,
required_argument
,
NULL
,
'P'
},
...
@@ -320,18 +320,20 @@ parse_options(int argc, char *argv[], struct adhoc_opts * options)
...
@@ -320,18 +320,20 @@ parse_options(int argc, char *argv[], struct adhoc_opts * options)
memset
(
options
,
0
,
sizeof
*
options
);
memset
(
options
,
0
,
sizeof
*
options
);
#ifdef HAVE_GETOPT_LONG
#ifdef HAVE_GETOPT_LONG
while
((
c
=
getopt_long
(
argc
,
argv
,
"Ac:d:eEf:F:lh:Hno:p:P:qRsStT:uU:v:VWx?"
,
long_options
,
&
optindex
))
!=
-
1
)
while
((
c
=
getopt_long
(
argc
,
argv
,
"
a
Ac:d:eEf:F:lh:Hno:p:P:qRsStT:uU:v:VWx?"
,
long_options
,
&
optindex
))
!=
-
1
)
#else
/* not HAVE_GETOPT_LONG */
#else
/* not HAVE_GETOPT_LONG */
/*
/*
* Be sure to leave the '-' in here, so we can catch accidental long
* Be sure to leave the '-' in here, so we can catch accidental long
* options.
* options.
*/
*/
while
((
c
=
getopt
(
argc
,
argv
,
"Ac:d:eEf:F:lh:Hno:p:P:qRsStT:uU:v:VWx?-"
))
!=
-
1
)
while
((
c
=
getopt
(
argc
,
argv
,
"
a
Ac:d:eEf:F:lh:Hno:p:P:qRsStT:uU:v:VWx?-"
))
!=
-
1
)
#endif
/* not HAVE_GETOPT_LONG */
#endif
/* not HAVE_GETOPT_LONG */
{
{
switch
(
c
)
switch
(
c
)
{
{
case
'a'
:
SetVariable
(
pset
.
vars
,
"ECHO"
,
"all"
);
break
;
case
'A'
:
case
'A'
:
pset
.
popt
.
topt
.
format
=
PRINT_UNALIGNED
;
pset
.
popt
.
topt
.
format
=
PRINT_UNALIGNED
;
break
;
break
;
...
@@ -346,10 +348,10 @@ parse_options(int argc, char *argv[], struct adhoc_opts * options)
...
@@ -346,10 +348,10 @@ parse_options(int argc, char *argv[], struct adhoc_opts * options)
options
->
dbname
=
optarg
;
options
->
dbname
=
optarg
;
break
;
break
;
case
'e'
:
case
'e'
:
SetVariable
(
pset
.
vars
,
"ECHO"
,
"
full
"
);
SetVariable
(
pset
.
vars
,
"ECHO"
,
"
queries
"
);
break
;
break
;
case
'E'
:
case
'E'
:
SetVariable
(
pset
.
vars
,
"ECHO_HIDDEN"
,
"
"
);
SetVariable
Bool
(
pset
.
vars
,
"ECHO_HIDDEN
"
);
break
;
break
;
case
'f'
:
case
'f'
:
options
->
action
=
ACT_FILE
;
options
->
action
=
ACT_FILE
;
...
@@ -402,16 +404,16 @@ parse_options(int argc, char *argv[], struct adhoc_opts * options)
...
@@ -402,16 +404,16 @@ parse_options(int argc, char *argv[], struct adhoc_opts * options)
break
;
break
;
}
}
case
'q'
:
case
'q'
:
SetVariable
(
pset
.
vars
,
"QUIET"
,
"
"
);
SetVariable
Bool
(
pset
.
vars
,
"QUIET
"
);
break
;
break
;
case
'R'
:
case
'R'
:
pset
.
popt
.
topt
.
recordSep
=
xstrdup
(
optarg
);
pset
.
popt
.
topt
.
recordSep
=
xstrdup
(
optarg
);
break
;
break
;
case
's'
:
case
's'
:
SetVariable
(
pset
.
vars
,
"SINGLESTEP"
,
"
"
);
SetVariable
Bool
(
pset
.
vars
,
"SINGLESTEP
"
);
break
;
break
;
case
'S'
:
case
'S'
:
SetVariable
(
pset
.
vars
,
"SINGLELINE"
,
"
"
);
SetVariable
Bool
(
pset
.
vars
,
"SINGLELINE
"
);
break
;
break
;
case
't'
:
case
't'
:
pset
.
popt
.
topt
.
tuples_only
=
true
;
pset
.
popt
.
topt
.
tuples_only
=
true
;
...
...
src/bin/psql/variables.c
View file @
9672d38f
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
*
*
* Copyright 2000 by PostgreSQL Global Development Group
* Copyright 2000 by PostgreSQL Global Development Group
*
*
* $Header: /cvsroot/pgsql/src/bin/psql/variables.c,v 1.
5 2000/01/29 16:58:49
petere Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/variables.c,v 1.
6 2000/02/13 21:45:14
petere Exp $
*/
*/
#include <c.h>
#include <c.h>
#include "variables.h"
#include "variables.h"
...
@@ -111,6 +111,14 @@ SetVariable(VariableSpace space, const char *name, const char *value)
...
@@ -111,6 +111,14 @@ SetVariable(VariableSpace space, const char *name, const char *value)
bool
SetVariableBool
(
VariableSpace
space
,
const
char
*
name
)
{
return
SetVariable
(
space
,
name
,
""
);
}
bool
bool
DeleteVariable
(
VariableSpace
space
,
const
char
*
name
)
DeleteVariable
(
VariableSpace
space
,
const
char
*
name
)
{
{
...
...
src/bin/psql/variables.h
View file @
9672d38f
...
@@ -3,17 +3,13 @@
...
@@ -3,17 +3,13 @@
*
*
* Copyright 2000 by PostgreSQL Global Development Group
* Copyright 2000 by PostgreSQL Global Development Group
*
*
* $Header: /cvsroot/pgsql/src/bin/psql/variables.h,v 1.
5 2000/01/29 16:58:49
petere Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/variables.h,v 1.
6 2000/02/13 21:45:14
petere Exp $
*/
*/
/*
/*
* This implements a sort of variable repository. One could also think of it
* This implements a sort of variable repository. One could also think of it
* as cheap version of an associative array. In each one of these
* as cheap version of an associative array. In each one of these
* datastructures you can store name/value pairs.
* datastructures you can store name/value pairs.
*
* All functions (should) follow the Shit-In-Shit-Out (SISO) principle, i.e.,
* you can pass them NULL pointers and the like and they will return something
* appropriate.
*/
*/
#ifndef VARIABLES_H
#ifndef VARIABLES_H
...
@@ -37,6 +33,7 @@ VariableSpace CreateVariableSpace(void);
...
@@ -37,6 +33,7 @@ VariableSpace CreateVariableSpace(void);
const
char
*
GetVariable
(
VariableSpace
space
,
const
char
*
name
);
const
char
*
GetVariable
(
VariableSpace
space
,
const
char
*
name
);
bool
GetVariableBool
(
VariableSpace
space
,
const
char
*
name
);
bool
GetVariableBool
(
VariableSpace
space
,
const
char
*
name
);
bool
SetVariable
(
VariableSpace
space
,
const
char
*
name
,
const
char
*
value
);
bool
SetVariable
(
VariableSpace
space
,
const
char
*
name
,
const
char
*
value
);
bool
SetVariableBool
(
VariableSpace
space
,
const
char
*
name
);
bool
DeleteVariable
(
VariableSpace
space
,
const
char
*
name
);
bool
DeleteVariable
(
VariableSpace
space
,
const
char
*
name
);
void
DestroyVariableSpace
(
VariableSpace
space
);
void
DestroyVariableSpace
(
VariableSpace
space
);
...
...
src/test/regress/regress.sh
View file @
9672d38f
#!/bin/sh
#!/bin/sh
# $Header: /cvsroot/pgsql/src/test/regress/Attic/regress.sh,v 1.
39 2000/01/09 20:54:36 tgl
Exp $
# $Header: /cvsroot/pgsql/src/test/regress/Attic/regress.sh,v 1.
40 2000/02/13 21:45:15 petere
Exp $
#
#
if
[
$#
-eq
0
]
if
[
$#
-eq
0
]
then
then
...
@@ -30,7 +30,7 @@ fi
...
@@ -30,7 +30,7 @@ fi
PGTZ
=
"PST8PDT"
;
export
PGTZ
PGTZ
=
"PST8PDT"
;
export
PGTZ
PGDATESTYLE
=
"Postgres,US"
;
export
PGDATESTYLE
PGDATESTYLE
=
"Postgres,US"
;
export
PGDATESTYLE
FRONTEND
=
"psql
$HOSTLOC
-
n -e
-q"
FRONTEND
=
"psql
$HOSTLOC
-
a
-q"
# ----------
# ----------
# Scan resultmap file to find which platform-specific expected files to use.
# Scan resultmap file to find which platform-specific expected files to use.
...
...
src/test/regress/run_check.sh
View file @
9672d38f
#!/bin/sh
#!/bin/sh
#
#
# $Header: /cvsroot/pgsql/src/test/regress/Attic/run_check.sh,v 1.
7 2000/01/16 20:05:00
petere Exp $
# $Header: /cvsroot/pgsql/src/test/regress/Attic/run_check.sh,v 1.
8 2000/02/13 21:45:15
petere Exp $
# ----------
# ----------
# Check call syntax
# Check call syntax
...
@@ -86,7 +86,7 @@ PGDATESTYLE="Postgres,US"; export PGDATESTYLE
...
@@ -86,7 +86,7 @@ PGDATESTYLE="Postgres,US"; export PGDATESTYLE
# ----------
# ----------
# The SQL shell to use during this test
# The SQL shell to use during this test
# ----------
# ----------
FRONTEND
=
"
$BINDIR
/psql
$HOSTLOC
-
n -e
-q"
FRONTEND
=
"
$BINDIR
/psql
$HOSTLOC
-
a
-q"
# ----------
# ----------
# Scan resultmap file to find which platform-specific expected files to use.
# Scan resultmap file to find which platform-specific expected files to use.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment