Commit b3f66d19 authored by Peter Eisentraut's avatar Peter Eisentraut

Add command '\pset footer' to psql to turn off default "(x rows)" footer.

parent bbc3920f
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.51 2001/05/09 17:29:10 momjian Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.52 2001/05/12 19:44:45 petere Exp $
Postgres documentation Postgres documentation
--> -->
...@@ -898,6 +898,15 @@ lo_import 152801 ...@@ -898,6 +898,15 @@ lo_import 152801
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><literal>footer</literal></term>
<listitem>
<para>
Toggles the display of the default footer <literal>(x rows)</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><literal>recordsep</literal></term> <term><literal>recordsep</literal></term>
<listitem> <listitem>
......
...@@ -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/command.c,v 1.53 2001/05/12 17:37:15 tgl Exp $ * $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.54 2001/05/12 19:44:46 petere Exp $
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
#include "command.h" #include "command.h"
...@@ -1796,6 +1796,18 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet) ...@@ -1796,6 +1796,18 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
} }
} }
/* disable "(x rows)" footer */
else if (strcmp(param, "footer") == 0)
{
popt->default_footer = !popt->default_footer;
if (!quiet)
{
if (popt->default_footer)
puts("Default footer is on.");
else
puts("Default footer is off.");
}
}
else else
{ {
......
...@@ -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/print.c,v 1.18 2001/03/22 04:00:22 momjian Exp $ * $Header: /cvsroot/pgsql/src/bin/psql/print.c,v 1.19 2001/05/12 19:44:46 petere Exp $
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
#include "print.h" #include "print.h"
...@@ -1058,7 +1058,7 @@ printQuery(const PGresult *result, const printQueryOpt *opt, FILE *fout) ...@@ -1058,7 +1058,7 @@ printQuery(const PGresult *result, const printQueryOpt *opt, FILE *fout)
if (opt->footers) if (opt->footers)
footers = opt->footers; footers = opt->footers;
else if (!opt->topt.expanded) else if (!opt->topt.expanded && opt->default_footer)
{ {
footers = calloc(2, sizeof(*footers)); footers = calloc(2, sizeof(*footers));
if (!footers) if (!footers)
......
...@@ -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/print.h,v 1.8 2000/04/12 17:16:23 momjian Exp $ * $Header: /cvsroot/pgsql/src/bin/psql/print.h,v 1.9 2001/05/12 19:44:46 petere Exp $
*/ */
#ifndef PRINT_H #ifndef PRINT_H
#define PRINT_H #define PRINT_H
...@@ -64,6 +64,7 @@ typedef struct _printQueryOpt ...@@ -64,6 +64,7 @@ typedef struct _printQueryOpt
char *title; /* override title */ char *title; /* override title */
char **footers; /* override footer (default is "(xx char **footers; /* override footer (default is "(xx
* rows)") */ * rows)") */
bool default_footer; /* print default footer if footers==NULL */
} printQueryOpt; } printQueryOpt;
/* /*
...@@ -72,7 +73,7 @@ typedef struct _printQueryOpt ...@@ -72,7 +73,7 @@ typedef struct _printQueryOpt
* It calls the printTable above with all the things set straight. * It calls the printTable above with all the things set straight.
*/ */
void void
printQuery(const PGresult *result, const printQueryOpt *opt, FILE *fout); printQuery(const PGresult *result, const printQueryOpt *opt, FILE *fout);
#endif /* PRINT_H */ #endif /* PRINT_H */
...@@ -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.47 2001/05/06 17:38:32 petere Exp $ * $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.48 2001/05/12 19:44:46 petere Exp $
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
...@@ -135,6 +135,7 @@ main(int argc, char *argv[]) ...@@ -135,6 +135,7 @@ main(int argc, char *argv[])
pset.queryFout = stdout; pset.queryFout = stdout;
pset.popt.topt.border = 1; pset.popt.topt.border = 1;
pset.popt.topt.pager = true; pset.popt.topt.pager = true;
pset.popt.default_footer = true;
SetVariable(pset.vars, "VERSION", PG_VERSION_STR); SetVariable(pset.vars, "VERSION", PG_VERSION_STR);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment