* 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". */
| 2861 | * to support likely future extensions such as "\if defined VARNAME". |
| 2862 | */ |
| 2863 | static PQExpBuffer |
| 2864 | gather_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 |
no test coverage detected