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

Function discard_query_text

src/bin/psql/command.c:3009–3023  ·  view source on GitHub ↗

* Discard any query text absorbed during an inactive conditional branch. * * We must discard data that was appended to query_buf during an inactive * \if branch. We don't have to do anything there if there's no query_buf. * * Also, reset the lexer state to the same paren depth there was before. * (The rest of its state doesn't need attention, since we could not be * inside a comment or lit

Source from the content-addressed store, hash-verified

3007 * inside a comment or literal or partial token.)
3008 */
3009static void
3010discard_query_text(PsqlScanState scan_state, ConditionalStack cstack,
3011 PQExpBuffer query_buf)
3012{
3013 if (query_buf)
3014 {
3015 int new_len = conditional_stack_get_query_len(cstack);
3016
3017 Assert(new_len >= 0 && new_len <= query_buf->len);
3018 query_buf->len = new_len;
3019 query_buf->data[new_len] = '\0';
3020 }
3021 psql_scan_set_paren_depth(scan_state,
3022 conditional_stack_get_paren_depth(cstack));
3023}
3024
3025/*
3026 * If query_buf is empty, copy previous_buf into it.

Callers 3

exec_command_elifFunction · 0.85
exec_command_elseFunction · 0.85
exec_command_endifFunction · 0.85

Tested by

no test coverage detected