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

Function printTableInit

src/fe_utils/print.c:3057–3083  ·  view source on GitHub ↗

* Initialise a table contents struct. * Must be called before any other printTable method is used. * * The title is not duplicated; the caller must ensure that the buffer * is available for the lifetime of the printTableContent struct. * * If you call this, you must call printTableCleanup once you're done with the * table. */

Source from the content-addressed store, hash-verified

3055 * table.
3056 */
3057void
3058printTableInit(printTableContent *const content, const printTableOpt *opt,
3059 const char *title, const int ncolumns, const int nrows)
3060{
3061 long total_cells;
3062
3063 content->opt = opt;
3064 content->title = title;
3065 content->ncolumns = ncolumns;
3066 content->nrows = nrows;
3067
3068 content->headers = pg_malloc0((ncolumns + 1) * sizeof(*content->headers));
3069
3070 total_cells = (long)ncolumns * (long)nrows;
3071 content->cells = pg_malloc0((total_cells + 1) * sizeof(*content->cells));
3072
3073 content->cellmustfree = NULL;
3074 content->footers = NULL;
3075
3076 content->aligns = pg_malloc0((ncolumns + 1) * sizeof(*content->align));
3077
3078 content->header = content->headers;
3079 content->cell = content->cells;
3080 content->footer = content->footers;
3081 content->align = content->aligns;
3082 content->cellsadded = 0;
3083}
3084
3085/*
3086 * Add a header to the table.

Callers 5

printQueryFunction · 0.85
printCrosstabFunction · 0.85
describeOneTableDetailsFunction · 0.85
describeRolesFunction · 0.85
describePublicationsFunction · 0.85

Calls 1

pg_malloc0Function · 0.85

Tested by

no test coverage detected