26#include "Attachment.h"
32using namespace fbcpp::impl;
36 : client{&statement.getAttachment().getClient()},
37 statusWrapper{statement.getAttachment().getClient()},
38 numericConverter{statement.getAttachment().getClient()},
39 calendarConverter{statement.getAttachment().getClient()}
47 messageLength = outMetadata->getMessageLength(&statusWrapper);
49 buffer.resize(
static_cast<std::size_t
>(maxRows) * messageLength);
52 auto* dest = buffer.data();
57 assert(currentRow.size() == messageLength);
58 std::copy(currentRow.begin(), currentRow.end(), dest);
59 dest += messageLength;
61 statement.clearCurrentRow();
66 buffer.resize(
static_cast<std::size_t
>(dest - buffer.data()));
70 for (
unsigned i = count; i < maxRows; ++i)
72 if (resultSet->fetchNext(&statusWrapper, dest) != fb::IStatus::RESULT_OK)
75 dest += messageLength;
79 buffer.resize(
static_cast<std::size_t
>(dest - buffer.data()));
RowSet(Statement &statement, unsigned maxRows)
Fetches up to maxRows rows from statement.
Prepares, executes, and fetches SQL statements against a Firebird attachment.
bool hasCurrentRow() const noexcept
Returns whether the statement is positioned on a current output row.
std::vector< std::byte > & getOutputMessage() noexcept
Provides direct access to the raw output message buffer.
const std::vector< Descriptor > & getOutputDescriptors() noexcept
Provides cached descriptors for each output column.
bool isValid() noexcept
Returns whether the Statement object is valid.
FbRef< fb::IResultSet > getResultSetHandle() noexcept
Provides access to the underlying Firebird currently open result set handle, if any.
FbRef< fb::IMessageMetadata > getOutputMetadata() noexcept
Returns the metadata describing columns produced by the statement.