| 119 | #endif |
| 120 | |
| 121 | Status PrintResultsForEndpoint(FlightSqlClient& client, |
| 122 | const FlightCallOptions& call_options, |
| 123 | const FlightEndpoint& endpoint) { |
| 124 | ARROW_ASSIGN_OR_RAISE(auto stream, client.DoGet(call_options, endpoint.ticket)); |
| 125 | |
| 126 | const arrow::Result<std::shared_ptr<Schema>>& schema = stream->GetSchema(); |
| 127 | ARROW_RETURN_NOT_OK(schema); |
| 128 | |
| 129 | std::cout << "Schema:" << std::endl; |
| 130 | std::cout << schema->get()->ToString() << std::endl << std::endl; |
| 131 | |
| 132 | std::cout << "Results:" << std::endl; |
| 133 | |
| 134 | int64_t num_rows = 0; |
| 135 | |
| 136 | while (true) { |
| 137 | ARROW_ASSIGN_OR_RAISE(FlightStreamChunk chunk, stream->Next()); |
| 138 | if (chunk.data == nullptr) { |
| 139 | break; |
| 140 | } |
| 141 | std::cout << chunk.data->ToString() << std::endl; |
| 142 | num_rows += chunk.data->num_rows(); |
| 143 | } |
| 144 | |
| 145 | std::cout << "Total: " << num_rows << std::endl; |
| 146 | |
| 147 | return Status::OK(); |
| 148 | } |
| 149 | |
| 150 | Status PrintResults(FlightSqlClient& client, const FlightCallOptions& call_options, |
| 151 | const std::unique_ptr<FlightInfo>& info) { |