fb-cpp 0.0.2
A modern C++ wrapper for the Firebird database API
Loading...
Searching...
No Matches
fbcpp::RowSet Class Referencefinal

A disconnected buffer of rows fetched from a Statement's result set. More...

#include <RowSet.h>

Public Member Functions

 RowSet (Statement &statement, unsigned maxRows)
 Fetches up to maxRows rows from the current result set of statement.
 
 RowSet (Statement &statement, unsigned maxRows, bool includeCurrentRow)
 Fetches up to maxRows rows from the current result set of statement.
 
 RowSet (RowSet &&o) noexcept
 
RowSetoperator= (RowSet &&o) noexcept
 
 RowSet (const RowSet &)=delete
 
RowSetoperator= (const RowSet &)=delete
 
unsigned getCount () const noexcept
 Returns the number of rows actually fetched.
 
unsigned getMessageLength () const noexcept
 Returns the message length (in bytes) of each row.
 
Row getRow (unsigned index)
 Returns a Row view for typed access to the row at index.
 
std::span< const std::byte > getRawRow (unsigned index) const
 Returns a span over the raw data of the row at index.
 
const std::vector< std::byte > & getRawBuffer () const noexcept
 Returns the entire contiguous buffer containing all fetched rows.
 

Detailed Description

A disconnected buffer of rows fetched from a Statement's result set.

Rows are fetched into a contiguous buffer at construction time. After construction the RowSet is independent of its source Statement and can be used, moved, or destroyed freely.

Definition at line 55 of file RowSet.h.

Constructor & Destructor Documentation

◆ RowSet() [1/3]

RowSet::RowSet ( Statement statement,
unsigned  maxRows 
)
explicit

Fetches up to maxRows rows from the current result set of statement.

The statement must have an open result set (i.e. execute() was called and it is a SELECT-type statement). Rows are fetched via IResultSet::fetchNext() directly into the internal buffer.

Parameters
statementThe statement with an open result set.
maxRowsMaximum number of rows to fetch.

Definition at line 35 of file RowSet.cpp.

◆ RowSet() [2/3]

RowSet::RowSet ( Statement statement,
unsigned  maxRows,
bool  includeCurrentRow 
)
explicit

Fetches up to maxRows rows from the current result set of statement.

When includeCurrentRow is true, the current output message already fetched by statement.execute() is copied as the first row before fetching the remaining rows from the result set.

Definition at line 40 of file RowSet.cpp.

◆ RowSet() [3/3]

fbcpp::RowSet::RowSet ( RowSet &&  o)
inlinenoexcept

Definition at line 80 of file RowSet.h.

Member Function Documentation

◆ getCount()

unsigned fbcpp::RowSet::getCount ( ) const
inlinenoexcept

Returns the number of rows actually fetched.

Definition at line 120 of file RowSet.h.

◆ getMessageLength()

unsigned fbcpp::RowSet::getMessageLength ( ) const
inlinenoexcept

Returns the message length (in bytes) of each row.

Definition at line 128 of file RowSet.h.

◆ getRawBuffer()

const std::vector< std::byte > & fbcpp::RowSet::getRawBuffer ( ) const
inlinenoexcept

Returns the entire contiguous buffer containing all fetched rows.

Definition at line 157 of file RowSet.h.

◆ getRawRow()

std::span< const std::byte > fbcpp::RowSet::getRawRow ( unsigned  index) const
inline

Returns a span over the raw data of the row at index.

Parameters
indexZero-based row index (must be < getCount()).

Definition at line 147 of file RowSet.h.

◆ getRow()

Row fbcpp::RowSet::getRow ( unsigned  index)
inline

Returns a Row view for typed access to the row at index.

Parameters
indexZero-based row index (must be < getCount()).

Definition at line 137 of file RowSet.h.

◆ operator=()

RowSet & fbcpp::RowSet::operator= ( RowSet &&  o)
inlinenoexcept

Definition at line 94 of file RowSet.h.


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