Skip to content

Commit

Permalink
QueryResult -> MaterializedQueryResult fix
Browse files Browse the repository at this point in the history
  • Loading branch information
akvlad committed Nov 15, 2024
1 parent 03e844e commit 3c4990d
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/discovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,10 @@ std::unique_ptr<MaterializedQueryResult> PeerDiscovery::getPeers(const std::stri

// Execute the statement with the parameter
vector<Value> params = {Value(hash)};
auto result = stmt->Execute(params);
auto raw_result = stmt->Execute(params);
auto result = raw_result->Cast<StreamQueryResult>().Materialize();

auto materialized_result = dynamic_cast<MaterializedQueryResult*>(result.get());
if (!materialized_result) {
throw std::runtime_error("Failed to retrieve materialized result.");
}

return std::unique_ptr<MaterializedQueryResult>(
static_cast<MaterializedQueryResult*>(result.release()));
return std::move(result);
}

void PeerDiscovery::removePeer(const std::string& hash, const std::string& peerId) {
Expand Down

0 comments on commit 3c4990d

Please sign in to comment.