2 * psql - the PostgreSQL interactive terminal
4 * Copyright (c) 2000-2005, PostgreSQL Global Development Group
6 * $PostgreSQL: pgsql/src/bin/psql/print.h,v 1.28 2005/07/18 20:57:53 momjian Exp $
14 extern FILE *PageOutput(int lines, unsigned short int pager);
16 extern void html_escaped_print(const char *in, FILE *fout);
20 PRINT_NOTHING = 0, /* to make sure someone initializes this */
26 /* add your favourite output format here ... */
30 typedef struct _printTableOpt
32 enum printFormat format; /* one of the above */
33 bool expanded; /* expanded/vertical output (if supported
34 * by output format) */
35 unsigned short int pager; /* use pager for output (if to stdout and
36 * stdout is a tty) 0=off 1=on 2=always */
37 bool tuples_only; /* don't output headers, row counts, etc. */
38 unsigned short int border; /* Print a border around the table.
39 * 0=none, 1=dividing lines, 2=full */
40 char *fieldSep; /* field separator for unaligned text mode */
41 char *recordSep; /* record separator for unaligned text
43 bool numericLocale; /* locale-aware numeric units separator and
45 char *tableAttr; /* attributes for HTML <table ...> */
46 int encoding; /* character encoding */
47 bool normal_query; /* are we presenting the results of a
48 * "normal" query, or a slash
54 * Use this to print just any table in the supported formats.
55 * - title is just any string (NULL is fine)
56 * - headers is the column headings (NULL ptr terminated). It must be given and
57 * complete since the column count is generated from this.
58 * - cells are the data cells to be printed. Now you know why the correct
59 * column count is important
60 * - footers are lines to be printed below the table
61 * - align is an 'l' or an 'r' for every column, if the output format needs it.
62 * (You must specify this long enough. Otherwise anything could happen.)
64 void printTable(const char *title, const char *const * headers,
65 const char *const * cells, const char *const * footers,
67 const printTableOpt *opt, FILE *fout, FILE *flog);
71 typedef struct _printQueryOpt
73 printTableOpt topt; /* the options above */
74 char *nullPrint; /* how to print null entities */
75 bool quote; /* quote all values as much as possible */
76 char *title; /* override title */
77 char **footers; /* override footer (default is "(xx
79 bool default_footer; /* print default footer if footers==NULL */
83 * Use this to print query results
85 * It calls the printTable above with all the things set straight.
87 void printQuery(const PGresult *result, const printQueryOpt *opt,
88 FILE *fout, FILE *flog);
90 void setDecimalLocale(void);
93 #define DEFAULT_PAGER "more"
95 #define DEFAULT_PAGER "less"