| 1676 | |
| 1677 | |
| 1678 | void ClientBase::onEndOfStream() |
| 1679 | { |
| 1680 | if (need_render_progress && tty_buf) |
| 1681 | { |
| 1682 | std::unique_lock lock(tty_mutex); |
| 1683 | progress_indication.clearProgressOutput(*tty_buf, lock); |
| 1684 | } |
| 1685 | if (need_render_progress_table && tty_buf) |
| 1686 | { |
| 1687 | std::unique_lock lock(tty_mutex); |
| 1688 | progress_table.clearTableOutput(*tty_buf, lock); |
| 1689 | } |
| 1690 | |
| 1691 | if (output_format) |
| 1692 | { |
| 1693 | /// Do our best to estimate the start of the query so the output format matches the one reported by the server |
| 1694 | bool is_running = false; |
| 1695 | output_format->setStartTime( |
| 1696 | clock_gettime_ns(CLOCK_MONOTONIC) - static_cast<UInt64>(progress_indication.elapsedSeconds() * 1000000000), is_running); |
| 1697 | |
| 1698 | try |
| 1699 | { |
| 1700 | output_format->finalize(); |
| 1701 | } |
| 1702 | catch (...) |
| 1703 | { |
| 1704 | /// Format should be reset to make it work for subsequent query |
| 1705 | /// (otherwise it will throw again in resetOutput()) |
| 1706 | output_format.reset(); |
| 1707 | throw; |
| 1708 | } |
| 1709 | } |
| 1710 | |
| 1711 | resetOutput(); |
| 1712 | |
| 1713 | if (is_interactive) |
| 1714 | { |
| 1715 | if (cancelled && !cancelled_printed.exchange(true)) |
| 1716 | output_stream << "Query was cancelled." << std::endl; |
| 1717 | else if (!written_first_block) |
| 1718 | output_stream << "Ok." << std::endl; |
| 1719 | } |
| 1720 | } |
| 1721 | |
| 1722 | |
| 1723 | void ClientBase::onProfileEvents(Block & block) |
nothing calls this directly
no test coverage detected