aboutsummaryrefslogtreecommitdiff
path: root/src/bin/monitor/monitor.c
diff options
context:
space:
mode:
authorMarc G. Fournier <scrappy@hub.org>1996-07-18 05:48:57 +0000
committerMarc G. Fournier <scrappy@hub.org>1996-07-18 05:48:57 +0000
commit72f76d38eb23e1fbca92f0e14b257c33e5ecccbc (patch)
tree94d8da6cbb3808247d4d9bf9f529d6f1df0eaf01 /src/bin/monitor/monitor.c
parentbc0bd47c6a8e020c523cc69a8a3c8e9dab8bb61b (diff)
downloadpostgresql-72f76d38eb23e1fbca92f0e14b257c33e5ecccbc.tar.gz
postgresql-72f76d38eb23e1fbca92f0e14b257c33e5ecccbc.zip
libpq and psql.c have been modified to do various things they didn't do
before (plus some optimisations/bug fixes et al). I've included a small demo transcript below. Note that all of of the display functionality/intelligence you see here, can be had merely by calling the new LIBPQ PQprint() routine with the appropriate arguments/options, including the HTML3 output guff. submitted by: Julian Assange <proff@suburbia.net>
Diffstat (limited to 'src/bin/monitor/monitor.c')
-rw-r--r--src/bin/monitor/monitor.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/bin/monitor/monitor.c b/src/bin/monitor/monitor.c
index f9bfa92237b..ecaf205175d 100644
--- a/src/bin/monitor/monitor.c
+++ b/src/bin/monitor/monitor.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/monitor/Attic/monitor.c,v 1.1.1.1 1996/07/09 06:22:13 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/bin/monitor/Attic/monitor.c,v 1.2 1996/07/18 05:48:34 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
@@ -642,6 +642,7 @@ handle_execution(char *query)
{
PGresult *result;
int retval = 0;
+ PQprintOpt opt;
result = PQexec(conn, query);
@@ -657,11 +658,18 @@ handle_execution(char *query)
break;
case PGRES_TUPLES_OK:
/* PQprintTuples(result,stdout,PrintAttNames,TerseOutput,COLWIDTH); */
- if (TerseOutput)
+/* if (TerseOutput)
PQdisplayTuples(result,stdout,1,"",PrintAttNames,TerseOutput);
else
- PQdisplayTuples(result,stdout,1,"|",PrintAttNames,TerseOutput);
- break;
+ PQdisplayTuples(result,stdout,1,"|",PrintAttNames,TerseOutput); */
+ memset(&opt, 0, sizeof opt);
+ opt.header = opt.align = opt.standard = 1;
+ if (TerseOutput)
+ opt.fieldSep = "";
+ else
+ opt.fieldSep = "|";
+ PQprint(stdout, result, &opt);
+ break;
case PGRES_COPY_OUT:
handle_copy_out(result);
break;