1/*-------------------------------------------------------------------------
3 * Query-result printing support for frontend code
6 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
9 * src/include/fe_utils/print.h
11 *-------------------------------------------------------------------------
21/* This is not a particularly great place for this ... */
23 #define DEFAULT_PAGER "more"
25#define DEFAULT_PAGER "less"
40 /* add your favourite output format here ... */
45 /* Line drawing characters to be used in various contexts */
46 const char *
hrule;
/* horizontal line character */
47 const char *
leftvrule;
/* left vertical line (+horizontal) */
48 const char *
midvrule;
/* intra-column vertical line (+horizontal) */
49 const char *
rightvrule;
/* right vertical line (+horizontal) */
54 /* Additional context for selecting line drawing characters */
63 /* Line wrapping conditions */
71 /* Expanded header line width variants */
83 /* A complete line style */
84 const char *
name;
/* for display purposes */
86 const char *
midvrule_nl;
/* vertical line for continue after newline */
91 const char *
nl_left;
/* left mark after newline */
92 const char *
nl_right;
/* right mark for newline */
93 const char *
wrap_left;
/* left mark after wrapped data */
94 const char *
wrap_right;
/* right mark for wrapped data */
114 unsigned short int expanded;
/* expanded/vertical output (if supported
115 * by output format); 0=no, 1=yes, 2=auto */
117 * line in expanded mode */
119 * line in expanded mode */
120 unsigned short int border;
/* Print a border around the table. 0=none,
121 * 1=dividing lines, 2=full */
122 unsigned short int pager;
/* use pager for output (if to stdout and
123 * stdout is a tty) 0=off 1=on 2=always */
125 * least this many lines */
140 int columns;
/* target width for wrapped format */
147 * Table footers are implemented as a singly-linked list.
149 * This is so that you don't need to know the number of footers in order to
150 * initialise the printTableContent struct, which is very convenient when
151 * preparing complex footers (as in describeOneTableDetails).
160 * The table content struct holds all the information which will be displayed
166 const char *
title;
/* May be NULL */
168 int nrows;
/* Specified in Init() */
169 const char **
headers;
/* NULL-terminated array of header strings */
170 const char **
header;
/* Pointer to the last added header */
171 const char **
cells;
/* NULL-terminated array of cell content
173 const char **
cell;
/* Pointer to the last added cell */
178 char *
aligns;
/* Array of alignment specifiers; 'l' or 'r',
180 char *
align;
/* Pointer to the last added alignment */
188 char **
footers;
/* override footer (default is "(xx rows)") */
215 const int ncolumns,
const int nrows);
217 char *header,
const bool translate,
const char align);
219 char *cell,
const bool translate,
const bool mustfree);
226 FILE *fout,
bool is_pager, FILE *flog);
228 FILE *fout,
bool is_pager, FILE *flog);
struct printTableContent printTableContent
void printTableInit(printTableContent *const content, const printTableOpt *opt, const char *title, const int ncolumns, const int nrows)
PGDLLIMPORT volatile sig_atomic_t cancel_pressed
void printTableCleanup(printTableContent *const content)
void restore_sigpipe_trap(void)
@ PRINT_XHEADER_EXACT_WIDTH
void printQuery(const PGresult *result, const printQueryOpt *opt, FILE *fout, bool is_pager, FILE *flog)
PGDLLIMPORT printTextFormat pg_utf8format
struct printTableOpt printTableOpt
struct printTextLineFormat printTextLineFormat
const printTextFormat * get_line_style(const printTableOpt *opt)
struct printTextFormat printTextFormat
FILE * PageOutput(int lines, const printTableOpt *topt)
void refresh_utf8format(const printTableOpt *opt)
PGDLLIMPORT const printTextFormat pg_asciiformat
void printTableAddCell(printTableContent *const content, char *cell, const bool translate, const bool mustfree)
PGDLLIMPORT const printTextFormat pg_asciiformat_old
void printTableSetFooter(printTableContent *const content, const char *footer)
struct printTableFooter printTableFooter
void ClosePager(FILE *pagerpipe)
@ UNICODE_LINESTYLE_SINGLE
@ UNICODE_LINESTYLE_DOUBLE
void disable_sigpipe_trap(void)
@ PRINT_LINE_WRAP_NEWLINE
void printTable(const printTableContent *cont, FILE *fout, bool is_pager, FILE *flog)
void html_escaped_print(const char *in, FILE *fout)
struct printQueryOpt printQueryOpt
void printTableAddFooter(printTableContent *const content, const char *footer)
void set_sigpipe_trap_state(bool ignore)
void printTableAddHeader(printTableContent *const content, char *header, const bool translate, const char align)
char column_type_alignment(Oid)
void setDecimalLocale(void)
Datum translate(PG_FUNCTION_ARGS)
const bool * translate_columns
const printTableOpt * opt
printTableFooter * footers
printTableFooter * footer
unsigned short int expanded
unsigned long prior_records
unicode_linestyle unicode_border_linestyle
struct separator fieldSep
int expanded_header_exact_width
struct separator recordSep
printXheaderWidthType expanded_header_width_type
const printTextFormat * line_style
unsigned short int border
unicode_linestyle unicode_header_linestyle
unicode_linestyle unicode_column_linestyle
const char * midvrule_blank
const char * header_nl_left
printTextLineFormat lrule[4]
const char * midvrule_wrap
const char * header_nl_right