Skip to content
Snippets Groups Projects

ENH: Support FIND and COUNT queries

Merged Florian Spreckelsen requested to merge f-query into dev
1 unresolved thread
Files
5
@@ -208,7 +208,7 @@ private:
@@ -208,7 +208,7 @@ private:
class MultiResultSet : public ResultSet {
class MultiResultSet : public ResultSet {
public:
public:
~MultiResultSet() = default;
~MultiResultSet() = default;
explicit MultiResultSet(MultiTransactionResponse *response);
explicit MultiResultSet(std::vector<std::unique_ptr<Entity>> result_set);
[[nodiscard]] inline auto Size() const noexcept -> int override {
[[nodiscard]] inline auto Size() const noexcept -> int override {
return this->entities.size();
return this->entities.size();
}
}
@@ -357,6 +357,17 @@ public:
@@ -357,6 +357,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 -> long {
 
return query_count;
 
}
 
/**
/**
* Return the number of sub-requests in this transaction.
* Return the number of sub-requests in this transaction.
*
*
@@ -367,6 +378,23 @@ public:
@@ -367,6 +378,23 @@ public:
return this->request->requests_size();
return this->request->requests_size();
}
}
 
/**
 
* Get a JSON representation of the response.
 
*
 
* For debugging.
 
*/
 
inline auto ResponseToString() const -> const std::string {
 
google::protobuf::util::JsonOptions options;
 
std::string out;
 
google::protobuf::util::MessageToJsonString(*this->response, &out, options);
 
return out;
 
}
 
 
/**
 
* Get a JSON representation of the request.
 
*
 
* For debugging.
 
*/
inline auto RequestToString() const -> const std::string {
inline auto RequestToString() const -> const std::string {
google::protobuf::util::JsonOptions options;
google::protobuf::util::JsonOptions options;
std::string out;
std::string out;
@@ -383,6 +411,7 @@ private:
@@ -383,6 +411,7 @@ private:
MultiTransactionRequest *request;
MultiTransactionRequest *request;
mutable MultiTransactionResponse *response;
mutable MultiTransactionResponse *response;
std::string error_message;
std::string error_message;
 
mutable long query_count;
Please register or sign in to reply
};
};
template <class InputIterator>
template <class InputIterator>
Loading