8 #ifndef LIBFOSSDBQUERYRESULT_HPP_
9 #define LIBFOSSDBQUERYRESULT_HPP_
11 #include "libfossdbmanager.h"
60 operator bool()
const {
66 std::vector<std::string>
getRow(
int i)
const;
69 std::vector<T>
getSimpleResults(
int columnN, T (functionP)(
const char*))
const;
72 unptr::unique_ptr <PGresult, PGresultDeleter>
ptr;
86 std::vector<T> result;
89 PGresult* r =
ptr.get();
91 if (columnN < PQnfields(r)) {
93 result.push_back(functionP(PQgetvalue(r, i, columnN)));
Database handler for agents.
PGresult deleter (for shared pointer)
void operator()(PGresult *p)
std::vector< T > getSimpleResults(int columnN, T(functionP)(const char *)) const
Get vector of a single column from query result.
bool isFailed() const
Check if the query failed.
unptr::unique_ptr< PGresult, PGresultDeleter > ptr
Unique pointer to the actual PGresult.
std::vector< std::string > getRow(int i) const
QueryResult(PGresult *ptr)
fo namespace holds the FOSSology library functions.
Defined which unique to be used by creating new unptr namespace.