* \timing -- enable/disable timing of queries */
| 2532 | * \timing -- enable/disable timing of queries |
| 2533 | */ |
| 2534 | static backslashResult |
| 2535 | exec_command_timing(PsqlScanState scan_state, bool active_branch) |
| 2536 | { |
| 2537 | bool success = true; |
| 2538 | |
| 2539 | if (active_branch) |
| 2540 | { |
| 2541 | char *opt = psql_scan_slash_option(scan_state, |
| 2542 | OT_NORMAL, NULL, false); |
| 2543 | |
| 2544 | if (opt) |
| 2545 | success = ParseVariableBool(opt, "\\timing", &pset.timing); |
| 2546 | else |
| 2547 | pset.timing = !pset.timing; |
| 2548 | if (!pset.quiet) |
| 2549 | { |
| 2550 | if (pset.timing) |
| 2551 | puts(_("Timing is on.")); |
| 2552 | else |
| 2553 | puts(_("Timing is off.")); |
| 2554 | } |
| 2555 | free(opt); |
| 2556 | } |
| 2557 | else |
| 2558 | ignore_slash_options(scan_state); |
| 2559 | |
| 2560 | return success ? PSQL_CMD_SKIP_LINE : PSQL_CMD_ERROR; |
| 2561 | } |
| 2562 | |
| 2563 | /* |
| 2564 | * \unset -- unset variable |
no test coverage detected