*
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.65 2005/07/14 06:49:58 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.66 2005/07/14 07:32:01 momjian Exp $
*/
#include "postgres_fe.h"
#include "common.h"
tmp = malloc(size);
if (!tmp)
{
- psql_error("out of memory\n");
+ fprintf(stderr, _("out of memory\n"));
exit(EXIT_FAILURE);
}
return tmp;
print_latex_text(const char *title, const char *const *headers,
const char *const *cells, const char *const *footers,
const char *opt_align, bool opt_tuples_only,
- unsigned short int opt_border, FILE *fout)
+ char *opt_numericsep, unsigned short int opt_border,
+ FILE *fout)
{
unsigned int col_count = 0;
unsigned int i;
/* print cells */
for (i = 0, ptr = cells; *ptr; i++, ptr++)
{
- latex_escaped_print(*ptr, fout);
+ if (strlen(*ptr) != 0 &&
+ opt_numericsep != NULL && strlen(opt_numericsep) > 0)
+ {
+ char *my_cell = pg_local_malloc(len_with_numericsep(*ptr) + 1);
+
+ strcpy(my_cell, *ptr);
+ format_numericsep(my_cell, opt_numericsep);
+ latex_escaped_print(my_cell, fout);
+ free(my_cell);
+ }
+ else
+ latex_escaped_print(*ptr, fout);
if ((i + 1) % col_count == 0)
fputs(" \\\\\n", fout);
print_latex_vertical(const char *title, const char *const *headers,
const char *const *cells, const char *const *footers,
const char *opt_align, bool opt_tuples_only,
- unsigned short int opt_border, FILE *fout)
+ char *opt_numericsep, unsigned short int opt_border,
+ FILE *fout)
{
unsigned int col_count = 0;
unsigned int i;
if (footers && !opt_tuples_only)
for (ptr = footers; *ptr; ptr++)
{
- latex_escaped_print(*ptr, fout);
+ if (strlen(*ptr) != 0 &&
+ opt_numericsep != NULL && strlen(opt_numericsep) > 0)
+ {
+ char *my_cell = pg_local_malloc(len_with_numericsep(*ptr) + 1);
+
+ strcpy(my_cell, *ptr);
+ format_numericsep(my_cell, opt_numericsep);
+ latex_escaped_print(my_cell, fout);
+ free(my_cell);
+ }
+ else
+ latex_escaped_print(*ptr, fout);
fputs(" \\\\\n", fout);
}
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_tuples_only,
- unsigned short int opt_border, FILE *fout)
+ char *opt_numericsep, unsigned short int opt_border,
+ FILE *fout)
{
unsigned int col_count = 0;
unsigned int i;
}
if (!opt_tuples_only)
- {
fputs("\n_\n", fout);
- }
/* print cells */
for (i = 0, ptr = cells; *ptr; i++, ptr++)
{
- troff_ms_escaped_print(*ptr, fout);
+ if (strlen(*ptr) != 0 &&
+ opt_numericsep != NULL && strlen(opt_numericsep) > 0)
+ {
+ char *my_cell = pg_local_malloc(len_with_numericsep(*ptr) + 1);
+
+ strcpy(my_cell, *ptr);
+ format_numericsep(my_cell, opt_numericsep);
+ troff_ms_escaped_print(my_cell, fout);
+ free(my_cell);
+ }
+ else
+ troff_ms_escaped_print(*ptr, fout);
if ((i + 1) % col_count == 0)
fputc('\n', fout);
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_tuples_only,
- unsigned short int opt_border, FILE *fout)
+ char *opt_numericsep, unsigned short int opt_border,
+ FILE *fout)
{
unsigned int col_count = 0;
unsigned int i;
{
if (!opt_tuples_only)
{
-
if (current_format != 1)
{
if (opt_border == 2 && i > 0)
troff_ms_escaped_print(headers[i % col_count], fout);
fputc('\t', fout);
- troff_ms_escaped_print(*ptr, fout);
+ if (strlen(*ptr) != 0 &&
+ opt_numericsep != NULL && strlen(opt_numericsep) > 0)
+ {
+ char *my_cell = pg_local_malloc(len_with_numericsep(*ptr) + 1);
+
+ strcpy(my_cell, *ptr);
+ format_numericsep(my_cell, opt_numericsep);
+ troff_ms_escaped_print(my_cell, fout);
+ free(my_cell);
+ }
+ else
+ troff_ms_escaped_print(*ptr, fout);
+
fputc('\n', fout);
}
case PRINT_LATEX:
if (use_expanded)
print_latex_vertical(title, headers, cells, footers, align,
- opt->tuples_only, border, output);
+ opt->tuples_only, opt->numericSep,
+ border, output);
else
print_latex_text(title, headers, cells, footers, align,
- opt->tuples_only, border, output);
+ opt->tuples_only, opt->numericSep,
+ border, output);
break;
case PRINT_TROFF_MS:
if (use_expanded)
- print_troff_ms_vertical(title, headers, cells, footers,
- align, opt->tuples_only,
+ print_troff_ms_vertical(title, headers, cells, footers, align,
+ opt->tuples_only, opt->numericSep,
border, output);
else
- print_troff_ms_text(title, headers, cells, footers,
- align, opt->tuples_only,
+ print_troff_ms_text(title, headers, cells, footers, align,
+ opt->tuples_only, opt->numericSep,
border, output);
break;
default: