From 3c4990dc1ab31ea565fa91b00391e5d460626fca Mon Sep 17 00:00:00 2001 From: akvlad Date: Fri, 15 Nov 2024 12:06:44 +0200 Subject: [PATCH] QueryResult -> MaterializedQueryResult fix --- src/discovery.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/discovery.cpp b/src/discovery.cpp index 2dae174..decbf1b 100644 --- a/src/discovery.cpp +++ b/src/discovery.cpp @@ -75,15 +75,10 @@ std::unique_ptr PeerDiscovery::getPeers(const std::stri // Execute the statement with the parameter vector params = {Value(hash)}; - auto result = stmt->Execute(params); + auto raw_result = stmt->Execute(params); + auto result = raw_result->Cast().Materialize(); - auto materialized_result = dynamic_cast(result.get()); - if (!materialized_result) { - throw std::runtime_error("Failed to retrieve materialized result."); - } - - return std::unique_ptr( - static_cast(result.release())); + return std::move(result); } void PeerDiscovery::removePeer(const std::string& hash, const std::string& peerId) {