MCPcopy Create free account
hub / github.com/apache/cloudberry / IsPagerNeeded

Function IsPagerNeeded

src/fe_utils/print.c:3281–3311  ·  view source on GitHub ↗

* IsPagerNeeded * * Setup pager if required */

Source from the content-addressed store, hash-verified

3279 * Setup pager if required
3280 */
3281static void
3282IsPagerNeeded(const printTableContent *cont, int extra_lines, bool expanded,
3283 FILE **fout, bool *is_pager)
3284{
3285 if (*fout == stdout)
3286 {
3287 int lines;
3288
3289 if (expanded)
3290 lines = (cont->ncolumns + 1) * cont->nrows;
3291 else
3292 lines = cont->nrows + 1;
3293
3294 if (!cont->opt->tuples_only)
3295 {
3296 printTableFooter *f;
3297
3298 /*
3299 * FIXME -- this is slightly bogus: it counts the number of
3300 * footers, not the number of lines in them.
3301 */
3302 for (f = cont->footers; f; f = f->next)
3303 lines++;
3304 }
3305
3306 *fout = PageOutput(lines + extra_lines, cont->opt);
3307 *is_pager = (*fout != stdout);
3308 }
3309 else
3310 *is_pager = false;
3311}
3312
3313/*
3314 * Use this to print any table in the supported formats.

Callers 3

print_aligned_textFunction · 0.85
print_aligned_verticalFunction · 0.85
printTableFunction · 0.85

Calls 1

PageOutputFunction · 0.85

Tested by

no test coverage detected