1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-12 02:37:31 +03:00

Attached is a patch that enhances the output of psql's HTML mode.

The output now validates as HTML 4.01 Strict, XHTML 1.0 strict,
and XHTML 1.1 (assuming you wrap it in a valid html/body document).

It also wraps the output of PGRES_COMMAND_OK if the HTML tag is on,
for full compliance: this is why html_escaped_print has to be
externalized.

Greg Sabino Mullane greg@turnstep.com
This commit is contained in:
Bruce Momjian
2003-06-12 07:52:51 +00:00
parent e9cda08b2b
commit ef2ba42717
3 changed files with 50 additions and 27 deletions

View File

@@ -3,7 +3,7 @@
*
* Copyright 2000 by PostgreSQL Global Development Group
*
* $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.62 2003/03/25 02:44:36 momjian Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.63 2003/06/12 07:52:51 momjian Exp $
*/
#include "postgres_fe.h"
#include "common.h"
@@ -525,7 +525,18 @@ PrintQueryResults(PGresult *results,
success = true;
sprintf(buf, "%u", (unsigned int) PQoidValue(results));
if (!QUIET())
fprintf(pset.queryFout, "%s\n", PQcmdStatus(results));
{
if (pset.popt.topt.format == PRINT_HTML)
{
fputs("<p>", pset.queryFout);
html_escaped_print(PQcmdStatus(results), pset.queryFout);
fputs("</p>\n", pset.queryFout);
}
else
{
fprintf(pset.queryFout, "%s\n", PQcmdStatus(results));
}
}
SetVariable(pset.vars, "LASTOID", buf);
break;
}