| 701 | } |
| 702 | |
| 703 | Packet LocalConnection::receivePacket() |
| 704 | { |
| 705 | Packet packet; |
| 706 | if (!state) |
| 707 | { |
| 708 | packet.type = Protocol::Server::EndOfStream; |
| 709 | return packet; |
| 710 | } |
| 711 | |
| 712 | if (!next_packet_type) |
| 713 | poll(0); |
| 714 | |
| 715 | if (!next_packet_type) |
| 716 | { |
| 717 | packet.type = Protocol::Server::EndOfStream; |
| 718 | return packet; |
| 719 | } |
| 720 | |
| 721 | packet.type = next_packet_type.value(); |
| 722 | switch (next_packet_type.value()) |
| 723 | { |
| 724 | case Protocol::Server::Totals: |
| 725 | case Protocol::Server::Extremes: |
| 726 | case Protocol::Server::Log: |
| 727 | case Protocol::Server::Data: |
| 728 | case Protocol::Server::ProfileEvents: |
| 729 | { |
| 730 | if (state->block && !state->block.value().empty()) |
| 731 | { |
| 732 | packet.block = std::move(state->block.value()); |
| 733 | state->block.reset(); |
| 734 | } |
| 735 | next_packet_type.reset(); |
| 736 | break; |
| 737 | } |
| 738 | case Protocol::Server::ProfileInfo: |
| 739 | { |
| 740 | if (state->profile_info) |
| 741 | { |
| 742 | packet.profile_info = *state->profile_info; |
| 743 | state->profile_info.reset(); |
| 744 | } |
| 745 | next_packet_type.reset(); |
| 746 | break; |
| 747 | } |
| 748 | case Protocol::Server::TableColumns: |
| 749 | { |
| 750 | if (state->columns_description) |
| 751 | { |
| 752 | packet.columns_description = state->columns_description->toString(/* include_comments = */ false); |
| 753 | } |
| 754 | |
| 755 | if (state->block) |
| 756 | { |
| 757 | next_packet_type = Protocol::Server::Data; |
| 758 | } |
| 759 | |
| 760 | break; |
nothing calls this directly
no test coverage detected