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

Function gather_boolean_expression

src/bin/psql/command.c:2863–2883  ·  view source on GitHub ↗

* Read a boolean expression, return it as a PQExpBuffer string. * * Note: anything more or less than one token will certainly fail to be * parsed by ParseVariableBool, so we don't worry about complaining here. * This routine's return data structure will need to be rethought anyway * to support likely future extensions such as "\if defined VARNAME". */

Source from the content-addressed store, hash-verified

2861 * to support likely future extensions such as "\if defined VARNAME".
2862 */
2863static PQExpBuffer
2864gather_boolean_expression(PsqlScanState scan_state)
2865{
2866 PQExpBuffer exp_buf = createPQExpBuffer();
2867 int num_options = 0;
2868 char *value;
2869
2870 /* collect all arguments for the conditional command into exp_buf */
2871 while ((value = psql_scan_slash_option(scan_state,
2872 OT_NORMAL, NULL, false)) != NULL)
2873 {
2874 /* add spaces between tokens */
2875 if (num_options > 0)
2876 appendPQExpBufferChar(exp_buf, ' ');
2877 appendPQExpBufferStr(exp_buf, value);
2878 num_options++;
2879 free(value);
2880 }
2881
2882 return exp_buf;
2883}
2884
2885/*
2886 * Read a boolean expression, return true if the expression

Callers 2

Calls 3

createPQExpBufferFunction · 0.85
appendPQExpBufferCharFunction · 0.85
appendPQExpBufferStrFunction · 0.85

Tested by

no test coverage detected