Closed dsmyth closed 3 years ago
Hello @dsmyth ,
In this case, you don't need Any
. It's easier to map directly to oatpp::Int64
.
Instead of oatpp::Fields
you may use oatpp::Vector
- to omit column names.
Also, it may be convenient to place this method into your DbClient itself:
QUERY(queryCaptureInfoCount, "SELECT COUNT(*) FROM captures;")
oatpp::Int64 getCaptureInfoCount() {
auto dbResult = queryCaptureInfoCount();
auto dataset = dbResult->fetch<oatpp::Vector<oatpp::Vector<oatpp::Int64>>>();
return dataset[0][0];
}
That works -- thank you!
How best to implement aggregate function queries? I have it working, but it's pretty kludgy: In my DbClient class:
In my service class:
There must be a more elegant way of doing this?