Lightweight 0.20250904.0
Loading...
Searching...
No Matches
Lightweight::SqlResultCursor Class Reference

API for reading an SQL query result set. More...

#include <SqlStatement.hpp>

Public Member Functions

LIGHTWEIGHT_FORCE_INLINE SqlResultCursor (SqlStatement &stmt) noexcept
 
 SqlResultCursor (SqlResultCursor const &)=delete
 
SqlResultCursoroperator= (SqlResultCursor const &)=delete
 
constexpr SqlResultCursor (SqlResultCursor &&other) noexcept
 
constexpr SqlResultCursoroperator= (SqlResultCursor &&other) noexcept
 
LIGHTWEIGHT_FORCE_INLINE size_t NumRowsAffected () const
 Retrieves the number of rows affected by the last query.
 
LIGHTWEIGHT_FORCE_INLINE size_t NumColumnsAffected () const
 Retrieves the number of columns affected by the last query.
 
template<SqlOutputColumnBinder... Args>
LIGHTWEIGHT_FORCE_INLINE void BindOutputColumns (Args *... args)
 
template<SqlOutputColumnBinder T>
LIGHTWEIGHT_FORCE_INLINE void BindOutputColumn (SQLUSMALLINT columnIndex, T *arg)
 
LIGHTWEIGHT_FORCE_INLINE bool FetchRow ()
 Fetches the next row of the result set.
 
template<SqlGetColumnNativeType T>
LIGHTWEIGHT_FORCE_INLINE bool GetColumn (SQLUSMALLINT column, T *result) const
 
template<SqlGetColumnNativeType T>
LIGHTWEIGHT_FORCE_INLINE T GetColumn (SQLUSMALLINT column) const
 Retrieves the value of the column at the given index for the currently selected row.
 
template<SqlGetColumnNativeType T>
LIGHTWEIGHT_FORCE_INLINE std::optional< T > GetNullableColumn (SQLUSMALLINT column) const
 
template<SqlGetColumnNativeType T>
GetColumnOr (SQLUSMALLINT column, T &&defaultValue) const
 

Detailed Description

API for reading an SQL query result set.

Definition at line 285 of file SqlStatement.hpp.

Constructor & Destructor Documentation

◆ SqlResultCursor() [1/2]

LIGHTWEIGHT_FORCE_INLINE Lightweight::SqlResultCursor::SqlResultCursor ( SqlStatement stmt)
inlineexplicitnoexcept

Definition at line 288 of file SqlStatement.hpp.

◆ SqlResultCursor() [2/2]

constexpr Lightweight::SqlResultCursor::SqlResultCursor ( SqlResultCursor &&  other)
inlineconstexprnoexcept

Definition at line 297 of file SqlStatement.hpp.

◆ ~SqlResultCursor()

LIGHTWEIGHT_FORCE_INLINE Lightweight::SqlResultCursor::~SqlResultCursor ( )
inline

Definition at line 313 of file SqlStatement.hpp.

Member Function Documentation

◆ operator=()

constexpr SqlResultCursor & Lightweight::SqlResultCursor::operator= ( SqlResultCursor &&  other)
inlineconstexprnoexcept

Definition at line 303 of file SqlStatement.hpp.

◆ NumRowsAffected()

LIGHTWEIGHT_FORCE_INLINE size_t Lightweight::SqlResultCursor::NumRowsAffected ( ) const
inline

Retrieves the number of rows affected by the last query.

Definition at line 323 of file SqlStatement.hpp.

◆ NumColumnsAffected()

LIGHTWEIGHT_FORCE_INLINE size_t Lightweight::SqlResultCursor::NumColumnsAffected ( ) const
inline

Retrieves the number of columns affected by the last query.

Definition at line 329 of file SqlStatement.hpp.

◆ BindOutputColumns()

template<SqlOutputColumnBinder... Args>
LIGHTWEIGHT_FORCE_INLINE void Lightweight::SqlResultCursor::BindOutputColumns ( Args *...  args)
inline

Binds the given arguments to the prepared statement to store the fetched data to.

The statement must be prepared before calling this function.

Definition at line 338 of file SqlStatement.hpp.

Referenced by Lightweight::SqlCoreDataMapperQueryBuilder< Record, Derived >::All(), and Lightweight::SqlCoreDataMapperQueryBuilder< Record, Derived >::First().

◆ BindOutputColumn()

template<SqlOutputColumnBinder T>
LIGHTWEIGHT_FORCE_INLINE void Lightweight::SqlResultCursor::BindOutputColumn ( SQLUSMALLINT  columnIndex,
T *  arg 
)
inline

Definition at line 344 of file SqlStatement.hpp.

◆ FetchRow()

LIGHTWEIGHT_FORCE_INLINE bool Lightweight::SqlResultCursor::FetchRow ( )
inline

◆ GetColumn() [1/2]

template<SqlGetColumnNativeType T>
LIGHTWEIGHT_FORCE_INLINE bool Lightweight::SqlResultCursor::GetColumn ( SQLUSMALLINT  column,
T *  result 
) const
inline

Retrieves the value of the column at the given index for the currently selected row.

Returns true if the value is not NULL, false otherwise.

Definition at line 359 of file SqlStatement.hpp.

Referenced by Lightweight::SqlCoreDataMapperQueryBuilder< Record, Derived >::All(), and Lightweight::SqlCoreDataMapperQueryBuilder< Record, Derived >::Count().

◆ GetColumn() [2/2]

template<SqlGetColumnNativeType T>
LIGHTWEIGHT_FORCE_INLINE T Lightweight::SqlResultCursor::GetColumn ( SQLUSMALLINT  column) const
inline

Retrieves the value of the column at the given index for the currently selected row.

Definition at line 366 of file SqlStatement.hpp.

◆ GetNullableColumn()

template<SqlGetColumnNativeType T>
LIGHTWEIGHT_FORCE_INLINE std::optional< T > Lightweight::SqlResultCursor::GetNullableColumn ( SQLUSMALLINT  column) const
inline

Retrieves the value of the column at the given index for the currently selected row.

If the value is NULL, std::nullopt is returned.

Definition at line 375 of file SqlStatement.hpp.

◆ GetColumnOr()

template<SqlGetColumnNativeType T>
T Lightweight::SqlResultCursor::GetColumnOr ( SQLUSMALLINT  column,
T &&  defaultValue 
) const
inline

Retrieves the value of the column at the given index for the currently selected row.

If the value is NULL, the given defaultValue is returned.

Definition at line 384 of file SqlStatement.hpp.


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