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

Function printPsetInfo

src/bin/psql/command.c:4487–4667  ·  view source on GitHub ↗

* printPsetInfo: print the state of the "param" formatting parameter in popt. */

Source from the content-addressed store, hash-verified

4485 * printPsetInfo: print the state of the "param" formatting parameter in popt.
4486 */
4487static bool
4488printPsetInfo(const char *param, printQueryOpt *popt)
4489{
4490 Assert(param != NULL);
4491
4492 /* show border style/width */
4493 if (strcmp(param, "border") == 0)
4494 printf(_("Border style is %d.\n"), popt->topt.border);
4495
4496 /* show the target width for the wrapped format */
4497 else if (strcmp(param, "columns") == 0)
4498 {
4499 if (!popt->topt.columns)
4500 printf(_("Target width is unset.\n"));
4501 else
4502 printf(_("Target width is %d.\n"), popt->topt.columns);
4503 }
4504
4505 /* show expanded/vertical mode */
4506 else if (strcmp(param, "x") == 0 || strcmp(param, "expanded") == 0 || strcmp(param, "vertical") == 0)
4507 {
4508 if (popt->topt.expanded == 1)
4509 printf(_("Expanded display is on.\n"));
4510 else if (popt->topt.expanded == 2)
4511 printf(_("Expanded display is used automatically.\n"));
4512 else
4513 printf(_("Expanded display is off.\n"));
4514 }
4515
4516 /* show field separator for CSV format */
4517 else if (strcmp(param, "csv_fieldsep") == 0)
4518 {
4519 printf(_("Field separator for CSV is \"%s\".\n"),
4520 popt->topt.csvFieldSep);
4521 }
4522
4523 /* show field separator for unaligned text */
4524 else if (strcmp(param, "fieldsep") == 0)
4525 {
4526 if (popt->topt.fieldSep.separator_zero)
4527 printf(_("Field separator is zero byte.\n"));
4528 else
4529 printf(_("Field separator is \"%s\".\n"),
4530 popt->topt.fieldSep.separator);
4531 }
4532
4533 else if (strcmp(param, "fieldsep_zero") == 0)
4534 {
4535 printf(_("Field separator is zero byte.\n"));
4536 }
4537
4538 /* show disable "(x rows)" footer */
4539 else if (strcmp(param, "footer") == 0)
4540 {
4541 if (popt->topt.default_footer)
4542 printf(_("Default footer is on.\n"));
4543 else
4544 printf(_("Default footer is off.\n"));

Callers 1

do_psetFunction · 0.85

Calls 3

_align2stringFunction · 0.85
get_line_styleFunction · 0.85

Tested by

no test coverage detected