| 191 | } |
| 192 | |
| 193 | arrow::Result<int64_t> FlightSqlClient::ExecuteUpdate(const FlightCallOptions& options, |
| 194 | const std::string& query, |
| 195 | const Transaction& transaction) { |
| 196 | flight_sql_pb::CommandStatementUpdate command; |
| 197 | command.set_query(query); |
| 198 | if (transaction.is_valid()) { |
| 199 | command.set_transaction_id(transaction.transaction_id()); |
| 200 | } |
| 201 | |
| 202 | ARROW_ASSIGN_OR_RAISE(FlightDescriptor descriptor, |
| 203 | GetFlightDescriptorForCommand(command)); |
| 204 | |
| 205 | ARROW_ASSIGN_OR_RAISE(auto result, DoPut(options, descriptor, arrow::schema({}))) |
| 206 | std::shared_ptr<Buffer> metadata; |
| 207 | ARROW_RETURN_NOT_OK(result.reader->ReadMetadata(&metadata)); |
| 208 | ARROW_RETURN_NOT_OK(result.writer->Close()); |
| 209 | |
| 210 | if (!metadata) return Status::IOError("Server did not send a response"); |
| 211 | |
| 212 | flight_sql_pb::DoPutUpdateResult update_result; |
| 213 | if (!update_result.ParseFromArray(metadata->data(), |
| 214 | static_cast<int>(metadata->size()))) { |
| 215 | return Status::Invalid("Unable to parse DoPutUpdateResult"); |
| 216 | } |
| 217 | |
| 218 | return update_result.record_count(); |
| 219 | } |
| 220 | |
| 221 | arrow::Result<int64_t> FlightSqlClient::ExecuteSubstraitUpdate( |
| 222 | const FlightCallOptions& options, const SubstraitPlan& plan, |