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

Function print_csv_text

src/fe_utils/print.c:1766–1804  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1764}
1765
1766static void
1767print_csv_text(const printTableContent *cont, FILE *fout)
1768{
1769 const char *const *ptr;
1770 int i;
1771
1772 if (cancel_pressed)
1773 return;
1774
1775 /*
1776 * The title and footer are never printed in csv format. The header is
1777 * printed if opt_tuples_only is false.
1778 *
1779 * Despite RFC 4180 saying that end of lines are CRLF, terminate lines
1780 * with '\n', which prints out as the system-dependent EOL string in text
1781 * mode (typically LF on Unix and CRLF on Windows).
1782 */
1783 if (cont->opt->start_table && !cont->opt->tuples_only)
1784 {
1785 /* print headers */
1786 for (ptr = cont->headers; *ptr; ptr++)
1787 {
1788 if (ptr != cont->headers)
1789 fputc(cont->opt->csvFieldSep[0], fout);
1790 csv_print_field(*ptr, fout, cont->opt->csvFieldSep[0]);
1791 }
1792 fputc('\n', fout);
1793 }
1794
1795 /* print cells */
1796 for (i = 0, ptr = cont->cells; *ptr; i++, ptr++)
1797 {
1798 csv_print_field(*ptr, fout, cont->opt->csvFieldSep[0]);
1799 if ((i + 1) % cont->ncolumns)
1800 fputc(cont->opt->csvFieldSep[0], fout);
1801 else
1802 fputc('\n', fout);
1803 }
1804}
1805
1806static void
1807print_csv_vertical(const printTableContent *cont, FILE *fout)

Callers 1

printTableFunction · 0.85

Calls 1

csv_print_fieldFunction · 0.85

Tested by

no test coverage detected