GnuCash
5.6-150-g038405b370+
|
Row of SQL Query results. More...
#include <gnc-sql-result.hpp>
Public Member Functions | |
GncSqlRow (GncSqlResult::IteratorImpl *iter) | |
GncSqlRow & | operator++ () |
GncSqlRow & | operator* () |
std::optional< int64_t > | get_int_at_col (const char *col) const |
std::optional< double > | get_float_at_col (const char *col) const |
std::optional< double > | get_double_at_col (const char *col) const |
std::optional< std::string > | get_string_at_col (const char *col) const |
std::optional< time64 > | get_time64_at_col (const char *col) const |
bool | is_col_null (const char *col) const noexcept |
Friends | |
bool | operator!= (const GncSqlRow &, const GncSqlRow &) |
Row of SQL Query results.
This is a "pointer" class of a pimpl pattern, the implementation being GncSqlResult::IteratorImpl. It's designed to present a std::forward_iterator like interface for use with range-for while allowing for wrapping a C API.
Important Implementation Note: Operator++() as written requires that the sentinel GncSqlRow returned by GncSqlResult::end() has m_impl = nullptr in order to terminate the loop condition. This is a bit of a hack and might be a problem with a different SQL interface library from libdbi.
Note that GncSqlResult::begin and GncSqlRow::operator++() return GncSqlRow&. This is necessary for operator++() to be called: Using operator ++() on a pointer performs pointer arithmetic rather than calling the pointed-to-class's operator++() and C++'s range-for uses operator++() directly on whatever begin() gives it.
Definition at line 80 of file gnc-sql-result.hpp.