Skip to content
Snippets Groups Projects
Commit d5818c16 authored by florian's avatar florian
Browse files

WIP: Add query_count to Transaction class

parent 75a171cd
No related branches found
No related tags found
1 merge request!7ENH: Support FIND and COUNT queries
...@@ -368,6 +368,17 @@ public: ...@@ -368,6 +368,17 @@ public:
return *result_set; return *result_set;
} }
/**
* Return the result of a count query
*
* Only meaningful if there was exactly one COUNT query executed in
* this transaction. In all other cases, the return value will be
* -1.
*/
[[nodiscard]] inline auto GetCountResult() const -> int {
return query_count;
}
/** /**
* Return the number of sub-requests in this transaction. * Return the number of sub-requests in this transaction.
* *
...@@ -394,6 +405,7 @@ private: ...@@ -394,6 +405,7 @@ private:
MultiTransactionRequest *request; MultiTransactionRequest *request;
mutable MultiTransactionResponse *response; mutable MultiTransactionResponse *response;
std::string error_message; std::string error_message;
int query_count;
}; };
template <class InputIterator> template <class InputIterator>
......
...@@ -166,6 +166,7 @@ Transaction::Transaction( ...@@ -166,6 +166,7 @@ Transaction::Transaction(
response(google::protobuf::Arena::CreateMessage<MultiTransactionResponse>( response(google::protobuf::Arena::CreateMessage<MultiTransactionResponse>(
get_arena())) { get_arena())) {
this->service_stub = std::move(service_stub); this->service_stub = std::move(service_stub);
this->query_count = -1;
} }
auto Transaction::RetrieveById(const std::string &id) noexcept -> StatusCode { auto Transaction::RetrieveById(const std::string &id) noexcept -> StatusCode {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment