| 44 | } |
| 45 | |
| 46 | std::shared_ptr<::hybridse::sdk::ResultSet> ResultSetSQL::MakeResultSet( |
| 47 | const std::shared_ptr<::fedb::api::QueryResponse>& response, const std::shared_ptr<brpc::Controller>& cntl, |
| 48 | hybridse::sdk::Status* status) { |
| 49 | if (!status || !response || !cntl) { |
| 50 | return std::shared_ptr<ResultSet>(); |
| 51 | } |
| 52 | ::hybridse::vm::Schema schema; |
| 53 | bool ok = ::hybridse::codec::SchemaCodec::Decode(response->schema(), &schema); |
| 54 | if (!ok) { |
| 55 | status->code = -1; |
| 56 | status->msg = "request error, fail to decodec schema"; |
| 57 | return std::shared_ptr<ResultSet>(); |
| 58 | } |
| 59 | std::shared_ptr<::fedb::sdk::ResultSetSQL> rs = |
| 60 | std::make_shared<fedb::sdk::ResultSetSQL>(schema, response->count(), response->byte_size(), cntl); |
| 61 | ok = rs->Init(); |
| 62 | if (!ok) { |
| 63 | status->code = -1; |
| 64 | status->msg = "request error, resuletSetSQL init failed"; |
| 65 | return std::shared_ptr<ResultSet>(); |
| 66 | } |
| 67 | return rs; |
| 68 | } |
| 69 | |
| 70 | std::shared_ptr<::hybridse::sdk::ResultSet> ResultSetSQL::MakeResultSet( |
| 71 | const std::shared_ptr<::fedb::api::ScanResponse>& response, |