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

Function exec_command_pset

src/bin/psql/command.c:2171–2220  ·  view source on GitHub ↗

* \pset -- set printing parameters */

Source from the content-addressed store, hash-verified

2169 * \pset -- set printing parameters
2170 */
2171static backslashResult
2172exec_command_pset(PsqlScanState scan_state, bool active_branch)
2173{
2174 bool success = true;
2175
2176 if (active_branch)
2177 {
2178 char *opt0 = psql_scan_slash_option(scan_state,
2179 OT_NORMAL, NULL, false);
2180 char *opt1 = psql_scan_slash_option(scan_state,
2181 OT_NORMAL, NULL, false);
2182
2183 if (!opt0)
2184 {
2185 /* list all variables */
2186
2187 int i;
2188 static const char *const my_list[] = {
2189 "border", "columns", "csv_fieldsep", "expanded", "fieldsep",
2190 "fieldsep_zero", "footer", "format", "linestyle", "null",
2191 "numericlocale", "pager", "pager_min_lines",
2192 "recordsep", "recordsep_zero",
2193 "tableattr", "title", "tuples_only",
2194 "unicode_border_linestyle",
2195 "unicode_column_linestyle",
2196 "unicode_header_linestyle",
2197 NULL
2198 };
2199
2200 for (i = 0; my_list[i] != NULL; i++)
2201 {
2202 char *val = pset_value_string(my_list[i], &pset.popt);
2203
2204 printf("%-24s %s\n", my_list[i], val);
2205 free(val);
2206 }
2207
2208 success = true;
2209 }
2210 else
2211 success = do_pset(opt0, opt1, &pset.popt, pset.quiet);
2212
2213 free(opt0);
2214 free(opt1);
2215 }
2216 else
2217 ignore_slash_options(scan_state);
2218
2219 return success ? PSQL_CMD_SKIP_LINE : PSQL_CMD_ERROR;
2220}
2221
2222/*
2223 * \q or \quit -- exit psql

Callers 1

exec_commandFunction · 0.85

Calls 3

pset_value_stringFunction · 0.85
do_psetFunction · 0.85
ignore_slash_optionsFunction · 0.85

Tested by

no test coverage detected