![]() |
FOSSology
3.2.0rc1
Open Source License Compliance by Open Source Software
|
Wrapper for DB result. More...
#include <libfossdbQueryResult.hpp>

Public Member Functions | |
| QueryResult (QueryResult &&o) | |
| bool | isFailed () const |
| Check if the query failed. More... | |
| operator bool () const | |
| int | getRowCount () const |
| std::vector< std::string > | getRow (int i) const |
| template<typename T > | |
| std::vector< T > | getSimpleResults (int columnN, T(functionP)(const char *)) const |
| Get vector of a single column from query result. More... | |
Private Member Functions | |
| QueryResult (PGresult *ptr) | |
Private Attributes | |
| unptr::unique_ptr< PGresult, PGresultDeleter > | ptr |
| Unique pointer to the actual PGresult. | |
Friends | |
| class | DbManager |
| class | AgentDatabaseHandler |
Wrapper for DB result.
Definition at line 55 of file libfossdbQueryResult.hpp.
|
private |
Constructor for QueryResult
| pgResult | Postgres query result object |
Definition at line 34 of file libfossdbQueryResult.cc.
| std::vector< std::string > QueryResult::getRow | ( | int | i | ) | const |
Get all columns from required row as a string vector
| i | The row to be fetched |
Definition at line 64 of file libfossdbQueryResult.cc.
| int QueryResult::getRowCount | ( | ) | const |
Check the row count in the query result
Definition at line 51 of file libfossdbQueryResult.cc.
| std::vector< T > fo::QueryResult::getSimpleResults | ( | int | columnN, |
| T(functionP)(const char *) | |||
| ) | const |
Get vector of a single column from query result.
Get a single column's values as a vector of type T (defined by functionP param). The values will be translated using the functionP.
| columnN | Position of the required column |
| functionP | Function to translate the string result in desired format |
Definition at line 98 of file libfossdbQueryResult.hpp.
| bool QueryResult::isFailed | ( | ) | const |
Check if the query failed.
Check if the query is failed by checking the Postgres object for NULL
Definition at line 43 of file libfossdbQueryResult.cc.
|
inline |
Check if the query result failed
Definition at line 73 of file libfossdbQueryResult.hpp.