19 #ifndef LIBFOSSDBQUERYRESULT_HPP_ 20 #define LIBFOSSDBQUERYRESULT_HPP_ 23 #include "libfossdbmanager.h" 66 bool isFailed()
const;
73 operator bool()
const {
77 int getRowCount()
const;
79 std::vector<std::string> getRow(
int i)
const;
82 std::vector<T> getSimpleResults(
int columnN, T (functionP)(
const char*))
const;
85 unptr::unique_ptr <PGresult, PGresultDeleter>
ptr;
99 std::vector<T> result;
102 PGresult* r = ptr.get();
104 if (columnN < PQnfields(r)) {
105 for (
int i = 0; i < getRowCount(); i++) {
106 result.push_back(functionP(PQgetvalue(r, i, columnN)));
void operator()(PGresult *p)
PGresult deleter (for shared pointer)
Database handler for agents.
Defined which unique to be used by creating new unptr namespace.
fo namespace holds the FOSSology library functions.
unptr::unique_ptr< PGresult, PGresultDeleter > ptr
Unique pointer to the actual PGresult.
std::vector< T > getSimpleResults(int columnN, T(functionP)(const char *)) const
Get vector of a single column from query result.