AnCH Framework 0.2
Another C++ Hack: C++23 utility libraries
Loading...
Searching...
No Matches
anch::sql::PostgreSQLResultSet Class Reference

PostgreSQL result set implementation. More...

#include <postgresqlResultSet.hpp>

Inheritance diagram for anch::sql::PostgreSQLResultSet:
Collaboration diagram for anch::sql::PostgreSQLResultSet:

Public Member Functions

 PostgreSQLResultSet (PGconn *conn) noexcept
virtual ~PostgreSQLResultSet () noexcept
Public Member Functions inherited from anch::sql::ResultSet
 ResultSet () noexcept
virtual ~ResultSet () noexcept
template<typename T>
bool get (std::size_t idx, T &out)
template<anch::sql::SystemTimePoint T>
bool get (std::size_t idx, T &out)
template<typename T>
bool get (const std::string field, T &out)
template<typename T>
std::optional< T > get (std::size_t idx)
template<anch::sql::SystemTimePoint T>
std::optional< T > get (std::size_t idx)
template<typename T>
const std::optional< T > get (const std::string field)
std::vector< std::string > columns () const
std::optional< std::size_t > columnIndex (const std::string &name) const
bool next ()
template<>
bool get (std::size_t idx, int64_t &out)
template<>
bool get (std::size_t idx, int32_t &out)
template<>
bool get (std::size_t idx, int16_t &out)
template<>
bool get (std::size_t idx, uint64_t &out)
template<>
bool get (std::size_t idx, uint32_t &out)
template<>
bool get (std::size_t idx, uint16_t &out)
template<>
bool get (std::size_t idx, double &out)
template<>
bool get (std::size_t idx, float &out)
template<>
bool get (std::size_t idx, bool &out)
template<>
std::optional< int64_t > get (std::size_t idx)
template<>
std::optional< int32_t > get (std::size_t idx)
template<>
std::optional< int16_t > get (std::size_t idx)
template<>
std::optional< uint64_t > get (std::size_t idx)
template<>
std::optional< uint32_t > get (std::size_t idx)
template<>
std::optional< uint16_t > get (std::size_t idx)
template<>
std::optional< double > get (std::size_t idx)
template<>
std::optional< float > get (std::size_t idx)
template<>
std::optional< bool > get (std::size_t idx)

Protected Member Functions

virtual bool fetchNext () override
virtual bool getValue (std::size_t idx, std::string &out) override
virtual std::optional< std::string > getValue (std::size_t idx) override
virtual const anch::date::DateFormatter & getTimestampFormatter () override
Protected Member Functions inherited from anch::sql::ResultSet
void invalidateStatement () noexcept
const anch::date::DateFormatter & getDefaultTimestampFormatter ()

Additional Inherited Members

Protected Attributes inherited from anch::sql::ResultSet
std::map< std::string, std::size_t > _fields

Detailed Description

PostgreSQL result set implementation.

Implements ResultSet for PostgreSQL

Author
Vincent Lachenal
Since
0.1

Constructor & Destructor Documentation

◆ PostgreSQLResultSet()

anch::sql::PostgreSQLResultSet::PostgreSQLResultSet ( PGconn * conn)
noexcept

PostgreSQLResultSet constructor

Parameters
connthe PostgreSQL database connection

◆ ~PostgreSQLResultSet()

virtual anch::sql::PostgreSQLResultSet::~PostgreSQLResultSet ( )
virtualnoexcept

PostgreSQLResultSet destructor

Member Function Documentation

◆ fetchNext()

virtual bool anch::sql::PostgreSQLResultSet::fetchNext ( )
overrideprotectedvirtual

Fetch next row in SQL result set.

Returns
true if next row exists, false otherwise
Exceptions
SqlExceptionany error

Implements anch::sql::ResultSet.

Here is the call graph for this function:

◆ getTimestampFormatter()

virtual const anch::date::DateFormatter & anch::sql::PostgreSQLResultSet::getTimestampFormatter ( )
overrideprotectedvirtual

Retrieve SQL timestamp formatter

Returns
the SQL timestamp formatter

Implements anch::sql::ResultSet.

Here is the call graph for this function:

◆ getValue() [1/2]

virtual std::optional< std::string > anch::sql::PostgreSQLResultSet::getValue ( std::size_t idx)
overrideprotectedvirtual

Retrieve string value from result set according to SQL database engine.

Parameters
idxthe index
Returns
the result
Exceptions
SqlExceptionany error

Implements anch::sql::ResultSet.

Here is the call graph for this function:

◆ getValue() [2/2]

virtual bool anch::sql::PostgreSQLResultSet::getValue ( std::size_t idx,
std::string & out )
overrideprotectedvirtual

Retrieve string value from result set according to SQL database engine.

Parameters
idxthe field index
outthe result
Exceptions
SqlExceptionany error

Implements anch::sql::ResultSet.

Here is the call graph for this function:

The documentation for this class was generated from the following file: