| 708 | } |
| 709 | |
| 710 | Status FlightSqlServerBase::DoGet(const ServerCallContext& context, const Ticket& request, |
| 711 | std::unique_ptr<FlightDataStream>* stream) { |
| 712 | google::protobuf::Any any; |
| 713 | if (!any.ParseFromArray(request.ticket.data(), |
| 714 | static_cast<int>(request.ticket.size()))) { |
| 715 | return Status::Invalid("Unable to parse ticket"); |
| 716 | } |
| 717 | |
| 718 | if (any.Is<pb::sql::TicketStatementQuery>()) { |
| 719 | pb::sql::TicketStatementQuery command; |
| 720 | if (!any.UnpackTo(&command)) { |
| 721 | return Status::Invalid("Unable to unpack TicketStatementQuery"); |
| 722 | } |
| 723 | StatementQueryTicket result; |
| 724 | result.statement_handle = command.statement_handle(); |
| 725 | ARROW_ASSIGN_OR_RAISE(*stream, DoGetStatement(context, result)); |
| 726 | return Status::OK(); |
| 727 | } else if (any.Is<pb::sql::CommandPreparedStatementQuery>()) { |
| 728 | ARROW_ASSIGN_OR_RAISE(PreparedStatementQuery internal_command, |
| 729 | ParseCommandPreparedStatementQuery(any)); |
| 730 | ARROW_ASSIGN_OR_RAISE(*stream, DoGetPreparedStatement(context, internal_command)); |
| 731 | return Status::OK(); |
| 732 | } else if (any.Is<pb::sql::CommandGetCatalogs>()) { |
| 733 | ARROW_ASSIGN_OR_RAISE(*stream, DoGetCatalogs(context)); |
| 734 | return Status::OK(); |
| 735 | } else if (any.Is<pb::sql::CommandGetDbSchemas>()) { |
| 736 | ARROW_ASSIGN_OR_RAISE(GetDbSchemas internal_command, ParseCommandGetDbSchemas(any)); |
| 737 | ARROW_ASSIGN_OR_RAISE(*stream, DoGetDbSchemas(context, internal_command)); |
| 738 | return Status::OK(); |
| 739 | } else if (any.Is<pb::sql::CommandGetTables>()) { |
| 740 | ARROW_ASSIGN_OR_RAISE(GetTables command, ParseCommandGetTables(any)); |
| 741 | ARROW_ASSIGN_OR_RAISE(*stream, DoGetTables(context, command)); |
| 742 | return Status::OK(); |
| 743 | } else if (any.Is<pb::sql::CommandGetTableTypes>()) { |
| 744 | ARROW_ASSIGN_OR_RAISE(*stream, DoGetTableTypes(context)); |
| 745 | return Status::OK(); |
| 746 | } else if (any.Is<pb::sql::CommandGetXdbcTypeInfo>()) { |
| 747 | ARROW_ASSIGN_OR_RAISE(GetXdbcTypeInfo command, ParseCommandGetXdbcTypeInfo(any)); |
| 748 | ARROW_ASSIGN_OR_RAISE(*stream, DoGetXdbcTypeInfo(context, command)) |
| 749 | return Status::OK(); |
| 750 | } else if (any.Is<pb::sql::CommandGetSqlInfo>()) { |
| 751 | ARROW_ASSIGN_OR_RAISE(GetSqlInfo internal_command, |
| 752 | ParseCommandGetSqlInfo(any, sql_info_id_to_result_)); |
| 753 | ARROW_ASSIGN_OR_RAISE(*stream, DoGetSqlInfo(context, internal_command)); |
| 754 | return Status::OK(); |
| 755 | } else if (any.Is<pb::sql::CommandGetPrimaryKeys>()) { |
| 756 | ARROW_ASSIGN_OR_RAISE(GetPrimaryKeys internal_command, |
| 757 | ParseCommandGetPrimaryKeys(any)); |
| 758 | ARROW_ASSIGN_OR_RAISE(*stream, DoGetPrimaryKeys(context, internal_command)); |
| 759 | return Status::OK(); |
| 760 | } else if (any.Is<pb::sql::CommandGetExportedKeys>()) { |
| 761 | ARROW_ASSIGN_OR_RAISE(GetExportedKeys internal_command, |
| 762 | ParseCommandGetExportedKeys(any)); |
| 763 | ARROW_ASSIGN_OR_RAISE(*stream, DoGetExportedKeys(context, internal_command)); |
| 764 | return Status::OK(); |
| 765 | } else if (any.Is<pb::sql::CommandGetImportedKeys>()) { |
| 766 | ARROW_ASSIGN_OR_RAISE(GetImportedKeys internal_command, |
| 767 | ParseCommandGetImportedKeys(any)); |