*
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.64 2005/07/14 06:46:17 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.65 2005/07/14 06:49:58 momjian Exp $
*/
#include "postgres_fe.h"
#include "common.h"
print_unaligned_text(const char *title, const char *const *headers,
const char *const *cells, const char *const *footers,
const char *opt_align, const char *opt_fieldsep,
- const char *opt_recordsep, bool opt_barebones,
+ const char *opt_recordsep, bool opt_tuples_only,
char *opt_numericsep, FILE *fout)
{
unsigned int col_count = 0;
opt_recordsep = "";
/* print title */
- if (!opt_barebones && title)
+ if (!opt_tuples_only && title)
fprintf(fout, "%s%s", title, opt_recordsep);
/* print headers and count columns */
for (ptr = headers; *ptr; ptr++)
{
col_count++;
- if (!opt_barebones)
+ if (!opt_tuples_only)
{
if (col_count > 1)
fputs(opt_fieldsep, fout);
fputs(*ptr, fout);
}
}
- if (!opt_barebones)
+ if (!opt_tuples_only)
need_recordsep = true;
/* print cells */
/* print footers */
- if (!opt_barebones && footers)
+ if (!opt_tuples_only && footers)
for (ptr = footers; *ptr; ptr++)
{
if (need_recordsep)
const char *const *cells,
const char *const *footers, const char *opt_align,
const char *opt_fieldsep, const char *opt_recordsep,
- bool opt_barebones, char *opt_numericsep, FILE *fout)
+ bool opt_tuples_only, char *opt_numericsep, FILE *fout)
{
unsigned int col_count = 0;
unsigned int i;
opt_recordsep = "";
/* print title */
- if (!opt_barebones && title)
+ if (!opt_tuples_only && title)
fputs(title, fout);
/* count columns */
/* print records */
for (i = 0, ptr = cells; *ptr; i++, ptr++)
{
- if (i != 0 || (!opt_barebones && title))
+ if (i != 0 || (!opt_tuples_only && title))
{
fputs(opt_recordsep, fout);
if (i % col_count == 0)
}
/* print footers */
- if (!opt_barebones && footers && *footers)
+ if (!opt_tuples_only && footers && *footers)
{
fputs(opt_recordsep, fout);
for (ptr = footers; *ptr; ptr++)
static void
print_aligned_text(const char *title, const char *const *headers,
const char *const *cells, const char *const *footers,
- const char *opt_align, bool opt_barebones, char *opt_numericsep,
+ const char *opt_align, bool opt_tuples_only, char *opt_numericsep,
unsigned short int opt_border, int encoding,
FILE *fout)
{
total_w += widths[i];
/* print title */
- if (title && !opt_barebones)
+ if (title && !opt_tuples_only)
{
tmp = pg_wcswidth((unsigned char *) title, strlen(title), encoding);
if (tmp >= total_w)
}
/* print headers */
- if (!opt_barebones)
+ if (!opt_tuples_only)
{
if (opt_border == 2)
_print_horizontal_line(col_count, widths, opt_border, fout);
_print_horizontal_line(col_count, widths, opt_border, fout);
/* print footers */
- if (footers && !opt_barebones)
+ if (footers && !opt_tuples_only)
for (ptr = footers; *ptr; ptr++)
fprintf(fout, "%s\n", *ptr);
static void
print_aligned_vertical(const char *title, const char *const *headers,
const char *const *cells, const char *const *footers,
- const char *opt_align, bool opt_barebones,
+ const char *opt_align, bool opt_tuples_only,
char *opt_numericsep, unsigned short int opt_border,
int encoding, FILE *fout)
{
}
/* print title */
- if (!opt_barebones && title)
+ if (!opt_tuples_only && title)
fprintf(fout, "%s\n", title);
/* make horizontal border */
{
if (i % col_count == 0)
{
- if (!opt_barebones)
+ if (!opt_tuples_only)
{
char *record_str = pg_local_malloc(32);
size_t record_str_len;
/* print footers */
- if (!opt_barebones && footers && *footers)
+ if (!opt_tuples_only && footers && *footers)
{
if (opt_border < 2)
fputc('\n', fout);
static void
print_html_text(const char *title, const char *const *headers,
const char *const *cells, const char *const *footers,
- const char *opt_align, bool opt_barebones,
+ const char *opt_align, bool opt_tuples_only,
char *opt_numericsep, unsigned short int opt_border,
const char *opt_table_attr, FILE *fout)
{
fputs(">\n", fout);
/* print title */
- if (!opt_barebones && title)
+ if (!opt_tuples_only && title)
{
fputs(" <caption>", fout);
html_escaped_print(title, fout);
}
/* print headers and count columns */
- if (!opt_barebones)
+ if (!opt_tuples_only)
fputs(" <tr>\n", fout);
for (i = 0, ptr = headers; *ptr; i++, ptr++)
{
col_count++;
- if (!opt_barebones)
+ if (!opt_tuples_only)
{
fputs(" <th align=\"center\">", fout);
html_escaped_print(*ptr, fout);
fputs("</th>\n", fout);
}
}
- if (!opt_barebones)
+ if (!opt_tuples_only)
fputs(" </tr>\n", fout);
/* print cells */
/* print footers */
- if (!opt_barebones && footers && *footers)
+ if (!opt_tuples_only && footers && *footers)
{
fputs("<p>", fout);
for (ptr = footers; *ptr; ptr++)
static void
print_html_vertical(const char *title, const char *const *headers,
const char *const *cells, const char *const *footers,
- const char *opt_align, bool opt_barebones,
+ const char *opt_align, bool opt_tuples_only,
char *opt_numericsep, unsigned short int opt_border,
const char *opt_table_attr, FILE *fout)
{
fputs(">\n", fout);
/* print title */
- if (!opt_barebones && title)
+ if (!opt_tuples_only && title)
{
fputs(" <caption>", fout);
html_escaped_print(title, fout);
{
if (i % col_count == 0)
{
- if (!opt_barebones)
+ if (!opt_tuples_only)
fprintf(fout, "\n <tr><td colspan=\"2\" align=\"center\">Record %d</td></tr>\n", record++);
else
fputs("\n <tr><td colspan=\"2\"> </td></tr>\n", fout);
fputs("</table>\n", fout);
/* print footers */
- if (!opt_barebones && footers && *footers)
+ if (!opt_tuples_only && footers && *footers)
{
fputs("<p>", fout);
for (ptr = footers; *ptr; ptr++)
static void
print_latex_text(const char *title, const char *const *headers,
const char *const *cells, const char *const *footers,
- const char *opt_align, bool opt_barebones,
+ const char *opt_align, bool opt_tuples_only,
unsigned short int opt_border, FILE *fout)
{
unsigned int col_count = 0;
/* print title */
- if (!opt_barebones && title)
+ if (!opt_tuples_only && title)
{
fputs("\\begin{center}\n", fout);
latex_escaped_print(title, fout);
fputs("}\n", fout);
- if (!opt_barebones && opt_border == 2)
+ if (!opt_tuples_only && opt_border == 2)
fputs("\\hline\n", fout);
/* print headers and count columns */
for (i = 0, ptr = headers; i < col_count; i++, ptr++)
{
- if (!opt_barebones)
+ if (!opt_tuples_only)
{
if (i != 0)
fputs(" & ", fout);
}
}
- if (!opt_barebones)
+ if (!opt_tuples_only)
{
fputs(" \\\\\n", fout);
fputs("\\hline\n", fout);
/* print footers */
- if (footers && !opt_barebones)
+ if (footers && !opt_tuples_only)
for (ptr = footers; *ptr; ptr++)
{
latex_escaped_print(*ptr, fout);
static void
print_latex_vertical(const char *title, const char *const *headers,
const char *const *cells, const char *const *footers,
- const char *opt_align, bool opt_barebones,
+ const char *opt_align, bool opt_tuples_only,
unsigned short int opt_border, FILE *fout)
{
unsigned int col_count = 0;
(void) opt_align; /* currently unused parameter */
/* print title */
- if (!opt_barebones && title)
+ if (!opt_tuples_only && title)
{
fputs("\\begin{center}\n", fout);
latex_escaped_print(title, fout);
/* new record */
if (i % col_count == 0)
{
- if (!opt_barebones)
+ if (!opt_tuples_only)
{
if (opt_border == 2)
{
/* print footers */
- if (footers && !opt_barebones)
+ if (footers && !opt_tuples_only)
for (ptr = footers; *ptr; ptr++)
{
latex_escaped_print(*ptr, fout);
static void
print_troff_ms_text(const char *title, const char *const *headers,
const char *const *cells, const char *const *footers,
- const char *opt_align, bool opt_barebones,
+ const char *opt_align, bool opt_tuples_only,
unsigned short int opt_border, FILE *fout)
{
unsigned int col_count = 0;
/* print title */
- if (!opt_barebones && title)
+ if (!opt_tuples_only && title)
{
fputs(".LP\n.DS C\n", fout);
troff_ms_escaped_print(title, fout);
/* print headers and count columns */
for (i = 0, ptr = headers; i < col_count; i++, ptr++)
{
- if (!opt_barebones)
+ if (!opt_tuples_only)
{
if (i != 0)
fputc('\t', fout);
}
}
- if (!opt_barebones)
+ if (!opt_tuples_only)
{
fputs("\n_\n", fout);
}
/* print footers */
- if (footers && !opt_barebones)
+ if (footers && !opt_tuples_only)
for (ptr = footers; *ptr; ptr++)
{
troff_ms_escaped_print(*ptr, fout);
static void
print_troff_ms_vertical(const char *title, const char *const *headers,
const char *const *cells, const char *const *footers,
- const char *opt_align, bool opt_barebones,
+ const char *opt_align, bool opt_tuples_only,
unsigned short int opt_border, FILE *fout)
{
unsigned int col_count = 0;
(void) opt_align; /* currently unused parameter */
/* print title */
- if (!opt_barebones && title)
+ if (!opt_tuples_only && title)
{
fputs(".LP\n.DS C\n", fout);
troff_ms_escaped_print(title, fout);
fputs("center;\n", fout);
/* basic format */
- if (opt_barebones)
+ if (opt_tuples_only)
fputs("c l;\n", fout);
/* new record */
if (i % col_count == 0)
{
- if (!opt_barebones)
+ if (!opt_tuples_only)
{
if (current_format != 1)
fputs("_\n", fout);
}
- if (!opt_barebones)
+ if (!opt_tuples_only)
{
if (current_format != 2)
{
/* print footers */
- if (footers && !opt_barebones)
+ if (footers && !opt_tuples_only)
for (ptr = footers; *ptr; ptr++)
{
troff_ms_escaped_print(*ptr, fout);