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

Prepares, executes, and fetches SQL statements against a Firebird attachment. More...

#include <Statement.h>

Public Member Functions

 Statement (Attachment &attachment, Transaction &transaction, std::string_view sql, const StatementOptions &options={})
 Prepares an SQL statement.
 
 Statement (Statement &&o) noexcept
 Transfers ownership of an existing prepared statement.
 
Statementoperator= (Statement &&o) noexcept
 Transfers ownership of another prepared statement into this one.
 
 Statement (const Statement &)=delete
 
Statementoperator= (const Statement &)=delete
 
 ~Statement () noexcept
 Releases resources; ignores failures to keep destructor noexcept.
 
void free ()
 Releases the prepared handle and any associated result set.
 
std::string getLegacyPlan ()
 Retrieves the textual legacy plan if the server produced one.
 
std::string getPlan ()
 Retrieves the structured textual plan if the server produced one.
 
bool execute (Transaction &transaction)
 Executes a prepared statement using the supplied transaction.
 
template<typename T >
get (unsigned index)
 Retrieves a column using the most appropriate typed accessor specialization.
 
template<Aggregate T>
get ()
 Retrieves all output columns into a user-defined aggregate struct.
 
template<Aggregate T>
void set (const T &value)
 Sets all input parameters from fields of a user-defined aggregate struct.
 
template<TupleLike T>
get ()
 Retrieves all output columns into a tuple-like type.
 
template<TupleLike T>
void set (const T &value)
 Sets all input parameters from elements of a tuple-like type.
 
template<VariantLike V>
get (unsigned index)
 Retrieves a column value as a user-defined variant type.
 
template<VariantLike V>
void set (unsigned index, const V &value)
 Sets a parameter from a variant value.
 
Handle accessors

Reports whether the statement currently owns a prepared handle.

bool isValid () noexcept
 Returns whether the Statement object is valid.
 
FbRef< fb::IStatement > getStatementHandle () noexcept
 Provides direct access to the underlying Firebird statement handle.
 
FbRef< fb::IResultSet > getResultSetHandle () noexcept
 Provides access to the underlying Firebird currently open result set handle, if any.
 
FbRef< fb::IMessageMetadata > getInputMetadata () noexcept
 Returns the metadata describing prepared input parameters.
 
FbRef< fb::IMessageMetadata > getOutputMetadata () noexcept
 Returns the metadata describing columns produced by the statement.
 
StatementType getType () noexcept
 Returns the type classification reported by the server.
 
Descriptor accessors

Provides cached descriptors for each input parameter.

const std::vector< Descriptor > & getInputDescriptors () noexcept
 Provides cached descriptors for each input column.
 
const std::vector< Descriptor > & getOutputDescriptors () noexcept
 Provides cached descriptors for each output column.
 
Cursor movement
bool fetchNext ()
 Fetches the next row in the current result set.
 
bool fetchPrior ()
 Fetches the previous row in the current result set.
 
bool fetchFirst ()
 Positions the cursor on the first row.
 
bool fetchLast ()
 Positions the cursor on the last row.
 
bool fetchAbsolute (unsigned position)
 Positions the cursor on the given absolute row number.
 
bool fetchRelative (int offset)
 Moves the cursor by the requested relative offset.
 
Parameter writing
void clearParameters ()
 Marks all bound parameters as null values.
 
void setNull (unsigned index)
 Marks the specified parameter as null.
 
void setBool (unsigned index, std::optional< bool > optValue)
 Binds a boolean parameter value or null.
 
void setInt16 (unsigned index, std::optional< std::int16_t > optValue)
 Binds a 16-bit signed integer value or null.
 
void setScaledInt16 (unsigned index, std::optional< ScaledInt16 > optValue)
 Binds a scaled 16-bit signed integer value or null.
 
void setInt32 (unsigned index, std::optional< std::int32_t > optValue)
 Binds a 32-bit signed integer value or null.
 
void setScaledInt32 (unsigned index, std::optional< ScaledInt32 > optValue)
 Binds a scaled 32-bit signed integer value or null.
 
void setInt64 (unsigned index, std::optional< std::int64_t > optValue)
 Binds a 64-bit signed integer value or null.
 
void setScaledInt64 (unsigned index, std::optional< ScaledInt64 > optValue)
 Binds a scaled 64-bit signed integer value or null.
 
void setOpaqueInt128 (unsigned index, std::optional< OpaqueInt128 > optValue)
 Binds a raw 128-bit integer value in Firebird's representation or null.
 
void setBoostInt128 (unsigned index, std::optional< BoostInt128 > optValue)
 Binds a 128-bit integer value expressed with Boost.Multiprecision or null.
 
void setScaledBoostInt128 (unsigned index, std::optional< ScaledBoostInt128 > optValue)
 Binds a scaled 128-bit integer value expressed with Boost.Multiprecision or null.
 
void setFloat (unsigned index, std::optional< float > optValue)
 Binds a single precision floating-point value or null.
 
void setDouble (unsigned index, std::optional< double > optValue)
 Binds a double precision floating-point value or null.
 
void setOpaqueDecFloat16 (unsigned index, std::optional< OpaqueDecFloat16 > optValue)
 Binds a 16-digit decimal floating-point value in Firebird's representation or null.
 
void setBoostDecFloat16 (unsigned index, std::optional< BoostDecFloat16 > optValue)
 Binds a 16-digit decimal floating-point value using Boost.Multiprecision or null.
 
void setOpaqueDecFloat34 (unsigned index, std::optional< OpaqueDecFloat34 > optValue)
 Binds a 34-digit decimal floating-point value in Firebird's representation or null.
 
void setBoostDecFloat34 (unsigned index, std::optional< BoostDecFloat34 > optValue)
 Binds a 34-digit decimal floating-point value using Boost.Multiprecision or null.
 
void setDate (unsigned index, std::optional< Date > optValue)
 Binds a date value or null.
 
void setOpaqueDate (unsigned index, std::optional< OpaqueDate > optValue)
 Binds a raw date value in Firebird's representation or null.
 
void setTime (unsigned index, std::optional< Time > optValue)
 Binds a time-of-day value without timezone or null.
 
void setOpaqueTime (unsigned index, std::optional< OpaqueTime > optValue)
 Binds a raw time-of-day value in Firebird's representation or null.
 
void setTimestamp (unsigned index, std::optional< Timestamp > optValue)
 Binds a timestamp value without timezone or null.
 
void setOpaqueTimestamp (unsigned index, std::optional< OpaqueTimestamp > optValue)
 Binds a raw timestamp value in Firebird's representation or null.
 
void setTimeTz (unsigned index, std::optional< TimeTz > optValue)
 Binds a time-of-day value with timezone or null.
 
void setOpaqueTimeTz (unsigned index, std::optional< OpaqueTimeTz > optValue)
 Binds a raw time-of-day value with timezone in Firebird's representation or null.
 
void setTimestampTz (unsigned index, std::optional< TimestampTz > optValue)
 Binds a timestamp value with timezone or null.
 
void setOpaqueTimestampTz (unsigned index, std::optional< OpaqueTimestampTz > optValue)
 Binds a raw timestamp value with timezone in Firebird's representation or null.
 
void setString (unsigned index, std::optional< std::string_view > optValue)
 Binds a textual parameter or null, performing direct conversions where supported.
 
void setBlobId (unsigned index, std::optional< BlobId > optValue)
 Binds a blob identifier to the specified parameter or null.
 
void set (unsigned index, std::nullopt_t)
 Convenience overload that binds a null value.
 
void set (unsigned index, BlobId value)
 Convenience overload that binds a blob identifier.
 
void set (unsigned index, std::optional< BlobId > value)
 Convenience overload that binds an optional blob identifier.
 
void set (unsigned index, bool value)
 Convenience overload that binds a boolean value.
 
void set (unsigned index, std::int16_t value)
 Convenience overload that binds a 16-bit signed integer.
 
void set (unsigned index, ScaledInt16 value)
 Convenience overload that binds a scaled 16-bit signed integer.
 
void set (unsigned index, std::int32_t value)
 Convenience overload that binds a 32-bit signed integer.
 
void set (unsigned index, ScaledInt32 value)
 Convenience overload that binds a scaled 32-bit signed integer.
 
void set (unsigned index, std::int64_t value)
 Convenience overload that binds a 64-bit signed integer.
 
void set (unsigned index, ScaledInt64 value)
 Convenience overload that binds a scaled 64-bit signed integer.
 
void set (unsigned index, OpaqueInt128 value)
 Convenience overload that binds a Firebird 128-bit integer.
 
void set (unsigned index, BoostInt128 value)
 Convenience overload that binds a Boost-provided 128-bit integer.
 
void set (unsigned index, ScaledBoostInt128 value)
 Convenience overload that binds a scaled Boost-provided 128-bit integer.
 
void set (unsigned index, float value)
 Convenience overload that binds a single precision floating-point value.
 
void set (unsigned index, double value)
 Convenience overload that binds a double precision floating-point value.
 
void set (unsigned index, OpaqueDecFloat16 value)
 Convenience overload that binds a Firebird 16-digit decimal floating-point value.
 
void set (unsigned index, BoostDecFloat16 value)
 Convenience overload that binds a Boost 16-digit decimal floating-point value.
 
void set (unsigned index, OpaqueDecFloat34 value)
 Convenience overload that binds a Firebird 34-digit decimal floating-point value.
 
void set (unsigned index, BoostDecFloat34 value)
 Convenience overload that binds a Boost 34-digit decimal floating-point value.
 
void set (unsigned index, Date value)
 Convenience overload that binds a Firebird date value.
 
void set (unsigned index, OpaqueDate value)
 Convenience overload that binds a Firebird date value.
 
void set (unsigned index, Time value)
 Convenience overload that binds a Firebird time value.
 
void set (unsigned index, OpaqueTime value)
 Convenience overload that binds a Firebird time value.
 
void set (unsigned index, Timestamp value)
 Convenience overload that binds a Firebird timestamp value.
 
void set (unsigned index, OpaqueTimestamp value)
 Convenience overload that binds a Firebird timestamp value.
 
void set (unsigned index, TimeTz value)
 Convenience overload that binds a Firebird time with timezone value.
 
void set (unsigned index, OpaqueTimeTz value)
 Convenience overload that binds a Firebird time with timezone value.
 
void set (unsigned index, TimestampTz value)
 Convenience overload that binds a Firebird timestamp with timezone value.
 
void set (unsigned index, OpaqueTimestampTz value)
 Convenience overload that binds a Firebird timestamp with timezone value.
 
void set (unsigned index, std::string_view value)
 Convenience overload that binds a textual value.
 
template<typename T >
void set (unsigned index, std::optional< T > value)
 Convenience template that forwards optional values to specialized overloads.
 
Result reading
bool isNull (unsigned index)
 Reports whether the most recently fetched row has a null at the given column.
 
std::optional< bool > getBool (unsigned index)
 Reads a boolean column from the current row.
 
std::optional< std::int16_t > getInt16 (unsigned index)
 Reads a 16-bit signed integer column.
 
std::optional< ScaledInt16getScaledInt16 (unsigned index)
 Reads a scaled 16-bit signed integer column.
 
std::optional< std::int32_t > getInt32 (unsigned index)
 Reads a 32-bit signed integer column.
 
std::optional< ScaledInt32getScaledInt32 (unsigned index)
 Reads a scaled 32-bit signed integer column.
 
std::optional< std::int64_t > getInt64 (unsigned index)
 Reads a 64-bit signed integer column.
 
std::optional< ScaledInt64getScaledInt64 (unsigned index)
 Reads a scaled 64-bit signed integer column.
 
std::optional< ScaledOpaqueInt128getScaledOpaqueInt128 (unsigned index)
 Reads a Firebird scaled 128-bit integer column.
 
std::optional< BoostInt128getBoostInt128 (unsigned index)
 Reads a Boost 128-bit integer column.
 
std::optional< ScaledBoostInt128getScaledBoostInt128 (unsigned index)
 Reads a scaled Boost 128-bit integer column.
 
std::optional< float > getFloat (unsigned index)
 Reads a single precision floating-point column.
 
std::optional< double > getDouble (unsigned index)
 Reads a double precision floating-point column.
 
std::optional< OpaqueDecFloat16getOpaqueDecFloat16 (unsigned index)
 Reads a Firebird 16-digit decimal floating-point column.
 
std::optional< BoostDecFloat16getBoostDecFloat16 (unsigned index)
 Reads a Boost-based 16-digit decimal floating-point column.
 
std::optional< OpaqueDecFloat34getOpaqueDecFloat34 (unsigned index)
 Reads a Firebird 34-digit decimal floating-point column.
 
std::optional< BoostDecFloat34getBoostDecFloat34 (unsigned index)
 Reads a Boost-based 34-digit decimal floating-point column.
 
std::optional< DategetDate (unsigned index)
 Reads a date column.
 
std::optional< OpaqueDategetOpaqueDate (unsigned index)
 Reads a raw date column in Firebird's representation.
 
std::optional< TimegetTime (unsigned index)
 Reads a time-of-day column without timezone.
 
std::optional< OpaqueTimegetOpaqueTime (unsigned index)
 Reads a raw time-of-day column in Firebird's representation.
 
std::optional< TimestampgetTimestamp (unsigned index)
 Reads a timestamp column without timezone.
 
std::optional< OpaqueTimestampgetOpaqueTimestamp (unsigned index)
 Reads a raw timestamp column in Firebird's representation.
 
std::optional< TimeTzgetTimeTz (unsigned index)
 Reads a time-of-day column with timezone.
 
std::optional< OpaqueTimeTzgetOpaqueTimeTz (unsigned index)
 Reads a raw time-of-day column with timezone in Firebird's representation.
 
std::optional< TimestampTzgetTimestampTz (unsigned index)
 Reads a timestamp-with-time-zone column.
 
std::optional< OpaqueTimestampTzgetOpaqueTimestampTz (unsigned index)
 Reads a raw timestamp-with-time-zone column in Firebird's representation.
 
std::optional< BlobIdgetBlobId (unsigned index)
 Reads a blob identifier column.
 
std::optional< std::string > getString (unsigned index)
 Reads a textual column, applying number-to-string conversions when needed.
 

Detailed Description

Prepares, executes, and fetches SQL statements against a Firebird attachment.

Definition at line 240 of file Statement.h.

Constructor & Destructor Documentation

◆ Statement() [1/2]

Statement::Statement ( Attachment attachment,
Transaction transaction,
std::string_view  sql,
const StatementOptions options = {} 
)
explicit

Prepares an SQL statement.

attachment supplies the database connection. transaction is used for statement preparation. sql is the text to prepare. options provides fine-grained prepare controls.

Definition at line 34 of file Statement.cpp.

◆ Statement() [2/2]

fbcpp::Statement::Statement ( Statement &&  o)
inlinenoexcept

Transfers ownership of an existing prepared statement.

Definition at line 256 of file Statement.h.

◆ ~Statement()

fbcpp::Statement::~Statement ( )
inlinenoexcept

Releases resources; ignores failures to keep destructor noexcept.

Definition at line 311 of file Statement.h.

Member Function Documentation

◆ clearParameters()

void fbcpp::Statement::clearParameters ( )
inline

Marks all bound parameters as null values.

Definition at line 480 of file Statement.h.

◆ execute()

bool Statement::execute ( Transaction transaction)

Executes a prepared statement using the supplied transaction.

Parameters
transactionTransaction that will own the execution context.
Returns
true when execution yields a record.

Definition at line 211 of file Statement.cpp.

◆ fetchAbsolute()

bool Statement::fetchAbsolute ( unsigned  position)

Positions the cursor on the given absolute row number.

Definition at line 273 of file Statement.cpp.

◆ fetchFirst()

bool Statement::fetchFirst ( )

Positions the cursor on the first row.

Definition at line 259 of file Statement.cpp.

◆ fetchLast()

bool Statement::fetchLast ( )

Positions the cursor on the last row.

Definition at line 266 of file Statement.cpp.

◆ fetchNext()

bool Statement::fetchNext ( )

Fetches the next row in the current result set.

Definition at line 245 of file Statement.cpp.

◆ fetchPrior()

bool Statement::fetchPrior ( )

Fetches the previous row in the current result set.

Definition at line 252 of file Statement.cpp.

◆ fetchRelative()

bool Statement::fetchRelative ( int  offset)

Moves the cursor by the requested relative offset.

Definition at line 282 of file Statement.cpp.

◆ free()

void Statement::free ( )

Releases the prepared handle and any associated result set.

Definition at line 183 of file Statement.cpp.

◆ get() [1/3]

template<Aggregate T>
T fbcpp::Statement::get ( )
inline

Retrieves all output columns into a user-defined aggregate struct.

Template Parameters
TAn aggregate type whose fields match the output column count and types.
Returns
The populated struct with values from the current row.
Exceptions
FbCppExceptionif field count mismatches output column count.
FbCppExceptionif a NULL value is encountered for a non-optional field.

Definition at line 2140 of file Statement.h.

◆ get() [2/3]

template<TupleLike T>
T fbcpp::Statement::get ( )
inline

Retrieves all output columns into a tuple-like type.

Template Parameters
TA tuple-like type (std::tuple, std::pair) whose elements match the output column count and types.
Returns
The populated tuple with values from the current row.
Exceptions
FbCppExceptionif element count mismatches output column count.
FbCppExceptionif a NULL value is encountered for a non-optional element.

Definition at line 2185 of file Statement.h.

◆ get() [3/3]

template<VariantLike V>
V fbcpp::Statement::get ( unsigned  index)
inline

Retrieves a column value as a user-defined variant type.

Template Parameters
VA std::variant type with possible C++ types. Use std::monostate for NULL.
Parameters
indexZero-based column index.
Returns
The variant with column value, or std::monostate if NULL.
Exceptions
FbCppExceptionif NULL but variant lacks std::monostate.
FbCppExceptionif SQL type cannot convert to any alternative.

Definition at line 2229 of file Statement.h.

◆ getBlobId()

std::optional< BlobId > fbcpp::Statement::getBlobId ( unsigned  index)
inline

Reads a blob identifier column.

Definition at line 2025 of file Statement.h.

◆ getBool()

std::optional< bool > fbcpp::Statement::getBool ( unsigned  index)
inline

Reads a boolean column from the current row.

Definition at line 1577 of file Statement.h.

◆ getBoostDecFloat16()

std::optional< BoostDecFloat16 > fbcpp::Statement::getBoostDecFloat16 ( unsigned  index)
inline

Reads a Boost-based 16-digit decimal floating-point column.

Definition at line 1746 of file Statement.h.

◆ getBoostDecFloat34()

std::optional< BoostDecFloat34 > fbcpp::Statement::getBoostDecFloat34 ( unsigned  index)
inline

Reads a Boost-based 34-digit decimal floating-point column.

Definition at line 1780 of file Statement.h.

◆ getBoostInt128()

std::optional< BoostInt128 > fbcpp::Statement::getBoostInt128 ( unsigned  index)
inline

Reads a Boost 128-bit integer column.

Definition at line 1683 of file Statement.h.

◆ getDate()

std::optional< Date > fbcpp::Statement::getDate ( unsigned  index)
inline

Reads a date column.

Definition at line 1790 of file Statement.h.

◆ getDouble()

std::optional< double > fbcpp::Statement::getDouble ( unsigned  index)
inline

Reads a double precision floating-point column.

Definition at line 1713 of file Statement.h.

◆ getFloat()

std::optional< float > fbcpp::Statement::getFloat ( unsigned  index)
inline

Reads a single precision floating-point column.

Definition at line 1704 of file Statement.h.

◆ getInputDescriptors()

const std::vector< Descriptor > & fbcpp::Statement::getInputDescriptors ( )
inlinenoexcept

Provides cached descriptors for each input column.

Definition at line 396 of file Statement.h.

◆ getInputMetadata()

FbRef< fb::IMessageMetadata > fbcpp::Statement::getInputMetadata ( )
inlinenoexcept

Returns the metadata describing prepared input parameters.

Definition at line 362 of file Statement.h.

◆ getInt16()

std::optional< std::int16_t > fbcpp::Statement::getInt16 ( unsigned  index)
inline

Reads a 16-bit signed integer column.

Definition at line 1600 of file Statement.h.

◆ getInt32()

std::optional< std::int32_t > fbcpp::Statement::getInt32 ( unsigned  index)
inline

Reads a 32-bit signed integer column.

Definition at line 1619 of file Statement.h.

◆ getInt64()

std::optional< std::int64_t > fbcpp::Statement::getInt64 ( unsigned  index)
inline

Reads a 64-bit signed integer column.

Definition at line 1638 of file Statement.h.

◆ getLegacyPlan()

std::string Statement::getLegacyPlan ( )

Retrieves the textual legacy plan if the server produced one.

Definition at line 197 of file Statement.cpp.

◆ getOpaqueDate()

std::optional< OpaqueDate > fbcpp::Statement::getOpaqueDate ( unsigned  index)
inline

Reads a raw date column in Firebird's representation.

Definition at line 1814 of file Statement.h.

◆ getOpaqueDecFloat16()

std::optional< OpaqueDecFloat16 > fbcpp::Statement::getOpaqueDecFloat16 ( unsigned  index)
inline

Reads a Firebird 16-digit decimal floating-point column.

Definition at line 1722 of file Statement.h.

◆ getOpaqueDecFloat34()

std::optional< OpaqueDecFloat34 > fbcpp::Statement::getOpaqueDecFloat34 ( unsigned  index)
inline

Reads a Firebird 34-digit decimal floating-point column.

Definition at line 1756 of file Statement.h.

◆ getOpaqueTime()

std::optional< OpaqueTime > fbcpp::Statement::getOpaqueTime ( unsigned  index)
inline

Reads a raw time-of-day column in Firebird's representation.

Definition at line 1861 of file Statement.h.

◆ getOpaqueTimestamp()

std::optional< OpaqueTimestamp > fbcpp::Statement::getOpaqueTimestamp ( unsigned  index)
inline

Reads a raw timestamp column in Firebird's representation.

Definition at line 1908 of file Statement.h.

◆ getOpaqueTimestampTz()

std::optional< OpaqueTimestampTz > fbcpp::Statement::getOpaqueTimestampTz ( unsigned  index)
inline

Reads a raw timestamp-with-time-zone column in Firebird's representation.

Definition at line 2002 of file Statement.h.

◆ getOpaqueTimeTz()

std::optional< OpaqueTimeTz > fbcpp::Statement::getOpaqueTimeTz ( unsigned  index)
inline

Reads a raw time-of-day column with timezone in Firebird's representation.

Definition at line 1955 of file Statement.h.

◆ getOutputDescriptors()

const std::vector< Descriptor > & fbcpp::Statement::getOutputDescriptors ( )
inlinenoexcept

Provides cached descriptors for each output column.

Definition at line 404 of file Statement.h.

◆ getOutputMetadata()

FbRef< fb::IMessageMetadata > fbcpp::Statement::getOutputMetadata ( )
inlinenoexcept

Returns the metadata describing columns produced by the statement.

Definition at line 370 of file Statement.h.

◆ getPlan()

std::string Statement::getPlan ( )

Retrieves the structured textual plan if the server produced one.

Definition at line 204 of file Statement.cpp.

◆ getResultSetHandle()

FbRef< fb::IResultSet > fbcpp::Statement::getResultSetHandle ( )
inlinenoexcept

Provides access to the underlying Firebird currently open result set handle, if any.

Returns
Smart pointer to the active result set interface.

Definition at line 354 of file Statement.h.

◆ getScaledBoostInt128()

std::optional< ScaledBoostInt128 > fbcpp::Statement::getScaledBoostInt128 ( unsigned  index)
inline

Reads a scaled Boost 128-bit integer column.

Definition at line 1693 of file Statement.h.

◆ getScaledInt16()

std::optional< ScaledInt16 > fbcpp::Statement::getScaledInt16 ( unsigned  index)
inline

Reads a scaled 16-bit signed integer column.

Definition at line 1609 of file Statement.h.

◆ getScaledInt32()

std::optional< ScaledInt32 > fbcpp::Statement::getScaledInt32 ( unsigned  index)
inline

Reads a scaled 32-bit signed integer column.

Definition at line 1628 of file Statement.h.

◆ getScaledInt64()

std::optional< ScaledInt64 > fbcpp::Statement::getScaledInt64 ( unsigned  index)
inline

Reads a scaled 64-bit signed integer column.

Definition at line 1647 of file Statement.h.

◆ getScaledOpaqueInt128()

std::optional< ScaledOpaqueInt128 > fbcpp::Statement::getScaledOpaqueInt128 ( unsigned  index)
inline

Reads a Firebird scaled 128-bit integer column.

Definition at line 1657 of file Statement.h.

◆ getStatementHandle()

FbRef< fb::IStatement > fbcpp::Statement::getStatementHandle ( )
inlinenoexcept

Provides direct access to the underlying Firebird statement handle.

Returns
Smart pointer to the low-level fb::IStatement interface.

Definition at line 345 of file Statement.h.

◆ getString()

std::optional< std::string > fbcpp::Statement::getString ( unsigned  index)
inline

Reads a textual column, applying number-to-string conversions when needed.

Definition at line 2052 of file Statement.h.

◆ getTime()

std::optional< Time > fbcpp::Statement::getTime ( unsigned  index)
inline

Reads a time-of-day column without timezone.

Definition at line 1837 of file Statement.h.

◆ getTimestamp()

std::optional< Timestamp > fbcpp::Statement::getTimestamp ( unsigned  index)
inline

Reads a timestamp column without timezone.

Definition at line 1884 of file Statement.h.

◆ getTimestampTz()

std::optional< TimestampTz > fbcpp::Statement::getTimestampTz ( unsigned  index)
inline

Reads a timestamp-with-time-zone column.

Definition at line 1978 of file Statement.h.

◆ getTimeTz()

std::optional< TimeTz > fbcpp::Statement::getTimeTz ( unsigned  index)
inline

Reads a time-of-day column with timezone.

Definition at line 1931 of file Statement.h.

◆ getType()

StatementType fbcpp::Statement::getType ( )
inlinenoexcept

Returns the type classification reported by the server.

Definition at line 378 of file Statement.h.

◆ isNull()

bool fbcpp::Statement::isNull ( unsigned  index)
inline

Reports whether the most recently fetched row has a null at the given column.

Definition at line 1564 of file Statement.h.

◆ isValid()

bool fbcpp::Statement::isValid ( )
inlinenoexcept

Returns whether the Statement object is valid.

Definition at line 336 of file Statement.h.

◆ operator=()

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

Transfers ownership of another prepared statement into this one.

The old handles are released via FbRef::operator=(FbRef&&). After the assignment, this is valid (with o's state) and o is invalid.

Definition at line 281 of file Statement.h.

◆ set() [1/34]

template<Aggregate T>
void fbcpp::Statement::set ( const T &  value)
inline

Sets all input parameters from fields of a user-defined aggregate struct.

Template Parameters
TAn aggregate type whose fields match the input parameter count.
Parameters
valueThe struct containing parameter values.
Exceptions
FbCppExceptionif field count mismatches input parameter count.

Definition at line 2162 of file Statement.h.

◆ set() [2/34]

template<TupleLike T>
void fbcpp::Statement::set ( const T &  value)
inline

Sets all input parameters from elements of a tuple-like type.

Template Parameters
TA tuple-like type (std::tuple, std::pair) whose elements match the input parameter count.
Parameters
valueThe tuple containing parameter values.
Exceptions
FbCppExceptionif element count mismatches input parameter count.

Definition at line 2207 of file Statement.h.

◆ set() [3/34]

void fbcpp::Statement::set ( unsigned  index,
BlobId  value 
)
inline

Convenience overload that binds a blob identifier.

Definition at line 1306 of file Statement.h.

◆ set() [4/34]

void fbcpp::Statement::set ( unsigned  index,
bool  value 
)
inline

Convenience overload that binds a boolean value.

Definition at line 1322 of file Statement.h.

◆ set() [5/34]

void fbcpp::Statement::set ( unsigned  index,
BoostDecFloat16  value 
)
inline

Convenience overload that binds a Boost 16-digit decimal floating-point value.

Definition at line 1429 of file Statement.h.

◆ set() [6/34]

void fbcpp::Statement::set ( unsigned  index,
BoostDecFloat34  value 
)
inline

Convenience overload that binds a Boost 34-digit decimal floating-point value.

Definition at line 1447 of file Statement.h.

◆ set() [7/34]

void fbcpp::Statement::set ( unsigned  index,
BoostInt128  value 
)
inline

Convenience overload that binds a Boost-provided 128-bit integer.

Definition at line 1387 of file Statement.h.

◆ set() [8/34]

template<VariantLike V>
void fbcpp::Statement::set ( unsigned  index,
const V &  value 
)
inline

Sets a parameter from a variant value.

Template Parameters
VA std::variant type.
Parameters
indexZero-based parameter index.
valueThe variant containing the value.

Definition at line 2264 of file Statement.h.

◆ set() [9/34]

void fbcpp::Statement::set ( unsigned  index,
Date  value 
)
inline

Convenience overload that binds a Firebird date value.

Definition at line 1456 of file Statement.h.

◆ set() [10/34]

void fbcpp::Statement::set ( unsigned  index,
double  value 
)
inline

Convenience overload that binds a double precision floating-point value.

Definition at line 1412 of file Statement.h.

◆ set() [11/34]

void fbcpp::Statement::set ( unsigned  index,
float  value 
)
inline

Convenience overload that binds a single precision floating-point value.

Definition at line 1404 of file Statement.h.

◆ set() [12/34]

void fbcpp::Statement::set ( unsigned  index,
OpaqueDate  value 
)
inline

Convenience overload that binds a Firebird date value.

Definition at line 1464 of file Statement.h.

◆ set() [13/34]

void fbcpp::Statement::set ( unsigned  index,
OpaqueDecFloat16  value 
)
inline

Convenience overload that binds a Firebird 16-digit decimal floating-point value.

Definition at line 1420 of file Statement.h.

◆ set() [14/34]

void fbcpp::Statement::set ( unsigned  index,
OpaqueDecFloat34  value 
)
inline

Convenience overload that binds a Firebird 34-digit decimal floating-point value.

Definition at line 1438 of file Statement.h.

◆ set() [15/34]

void fbcpp::Statement::set ( unsigned  index,
OpaqueInt128  value 
)
inline

Convenience overload that binds a Firebird 128-bit integer.

Definition at line 1378 of file Statement.h.

◆ set() [16/34]

void fbcpp::Statement::set ( unsigned  index,
OpaqueTime  value 
)
inline

Convenience overload that binds a Firebird time value.

Definition at line 1480 of file Statement.h.

◆ set() [17/34]

void fbcpp::Statement::set ( unsigned  index,
OpaqueTimestamp  value 
)
inline

Convenience overload that binds a Firebird timestamp value.

Definition at line 1496 of file Statement.h.

◆ set() [18/34]

void fbcpp::Statement::set ( unsigned  index,
OpaqueTimestampTz  value 
)
inline

Convenience overload that binds a Firebird timestamp with timezone value.

Definition at line 1528 of file Statement.h.

◆ set() [19/34]

void fbcpp::Statement::set ( unsigned  index,
OpaqueTimeTz  value 
)
inline

Convenience overload that binds a Firebird time with timezone value.

Definition at line 1512 of file Statement.h.

◆ set() [20/34]

void fbcpp::Statement::set ( unsigned  index,
ScaledBoostInt128  value 
)
inline

Convenience overload that binds a scaled Boost-provided 128-bit integer.

Definition at line 1395 of file Statement.h.

◆ set() [21/34]

void fbcpp::Statement::set ( unsigned  index,
ScaledInt16  value 
)
inline

Convenience overload that binds a scaled 16-bit signed integer.

Definition at line 1338 of file Statement.h.

◆ set() [22/34]

void fbcpp::Statement::set ( unsigned  index,
ScaledInt32  value 
)
inline

Convenience overload that binds a scaled 32-bit signed integer.

Definition at line 1354 of file Statement.h.

◆ set() [23/34]

void fbcpp::Statement::set ( unsigned  index,
ScaledInt64  value 
)
inline

Convenience overload that binds a scaled 64-bit signed integer.

Definition at line 1370 of file Statement.h.

◆ set() [24/34]

void fbcpp::Statement::set ( unsigned  index,
std::int16_t  value 
)
inline

Convenience overload that binds a 16-bit signed integer.

Definition at line 1330 of file Statement.h.

◆ set() [25/34]

void fbcpp::Statement::set ( unsigned  index,
std::int32_t  value 
)
inline

Convenience overload that binds a 32-bit signed integer.

Definition at line 1346 of file Statement.h.

◆ set() [26/34]

void fbcpp::Statement::set ( unsigned  index,
std::int64_t  value 
)
inline

Convenience overload that binds a 64-bit signed integer.

Definition at line 1362 of file Statement.h.

◆ set() [27/34]

void fbcpp::Statement::set ( unsigned  index,
std::nullopt_t   
)
inline

Convenience overload that binds a null value.

Definition at line 1298 of file Statement.h.

◆ set() [28/34]

void fbcpp::Statement::set ( unsigned  index,
std::optional< BlobId value 
)
inline

Convenience overload that binds an optional blob identifier.

Definition at line 1314 of file Statement.h.

◆ set() [29/34]

template<typename T >
void fbcpp::Statement::set ( unsigned  index,
std::optional< T >  value 
)
inline

Convenience template that forwards optional values to specialized overloads.

Definition at line 1545 of file Statement.h.

◆ set() [30/34]

void fbcpp::Statement::set ( unsigned  index,
std::string_view  value 
)
inline

Convenience overload that binds a textual value.

Definition at line 1536 of file Statement.h.

◆ set() [31/34]

void fbcpp::Statement::set ( unsigned  index,
Time  value 
)
inline

Convenience overload that binds a Firebird time value.

Definition at line 1472 of file Statement.h.

◆ set() [32/34]

void fbcpp::Statement::set ( unsigned  index,
Timestamp  value 
)
inline

Convenience overload that binds a Firebird timestamp value.

Definition at line 1488 of file Statement.h.

◆ set() [33/34]

void fbcpp::Statement::set ( unsigned  index,
TimestampTz  value 
)
inline

Convenience overload that binds a Firebird timestamp with timezone value.

Definition at line 1520 of file Statement.h.

◆ set() [34/34]

void fbcpp::Statement::set ( unsigned  index,
TimeTz  value 
)
inline

Convenience overload that binds a Firebird time with timezone value.

Definition at line 1504 of file Statement.h.

◆ setBlobId()

void fbcpp::Statement::setBlobId ( unsigned  index,
std::optional< BlobId optValue 
)
inline

Binds a blob identifier to the specified parameter or null.

Definition at line 1269 of file Statement.h.

◆ setBool()

void fbcpp::Statement::setBool ( unsigned  index,
std::optional< bool >  optValue 
)
inline

Binds a boolean parameter value or null.

Parameters
indexZero-based parameter index.
optValueBoolean value to assign, or empty to bind null.

Definition at line 509 of file Statement.h.

◆ setBoostDecFloat16()

void fbcpp::Statement::setBoostDecFloat16 ( unsigned  index,
std::optional< BoostDecFloat16 optValue 
)
inline

Binds a 16-digit decimal floating-point value using Boost.Multiprecision or null.

Definition at line 746 of file Statement.h.

◆ setBoostDecFloat34()

void fbcpp::Statement::setBoostDecFloat34 ( unsigned  index,
std::optional< BoostDecFloat34 optValue 
)
inline

Binds a 34-digit decimal floating-point value using Boost.Multiprecision or null.

Definition at line 792 of file Statement.h.

◆ setBoostInt128()

void fbcpp::Statement::setBoostInt128 ( unsigned  index,
std::optional< BoostInt128 optValue 
)
inline

Binds a 128-bit integer value expressed with Boost.Multiprecision or null.

Definition at line 657 of file Statement.h.

◆ setDate()

void fbcpp::Statement::setDate ( unsigned  index,
std::optional< Date optValue 
)
inline

Binds a date value or null.

Definition at line 807 of file Statement.h.

◆ setDouble()

void fbcpp::Statement::setDouble ( unsigned  index,
std::optional< double >  optValue 
)
inline

Binds a double precision floating-point value or null.

Definition at line 701 of file Statement.h.

◆ setFloat()

void fbcpp::Statement::setFloat ( unsigned  index,
std::optional< float >  optValue 
)
inline

Binds a single precision floating-point value or null.

Definition at line 687 of file Statement.h.

◆ setInt16()

void fbcpp::Statement::setInt16 ( unsigned  index,
std::optional< std::int16_t >  optValue 
)
inline

Binds a 16-bit signed integer value or null.

Definition at line 539 of file Statement.h.

◆ setInt32()

void fbcpp::Statement::setInt32 ( unsigned  index,
std::optional< std::int32_t >  optValue 
)
inline

Binds a 32-bit signed integer value or null.

Definition at line 568 of file Statement.h.

◆ setInt64()

void fbcpp::Statement::setInt64 ( unsigned  index,
std::optional< std::int64_t >  optValue 
)
inline

Binds a 64-bit signed integer value or null.

Definition at line 597 of file Statement.h.

◆ setNull()

void fbcpp::Statement::setNull ( unsigned  index)
inline

Marks the specified parameter as null.

Parameters
indexZero-based parameter index.

Definition at line 494 of file Statement.h.

◆ setOpaqueDate()

void fbcpp::Statement::setOpaqueDate ( unsigned  index,
std::optional< OpaqueDate optValue 
)
inline

Binds a raw date value in Firebird's representation or null.

Definition at line 838 of file Statement.h.

◆ setOpaqueDecFloat16()

void fbcpp::Statement::setOpaqueDecFloat16 ( unsigned  index,
std::optional< OpaqueDecFloat16 optValue 
)
inline

Binds a 16-digit decimal floating-point value in Firebird's representation or null.

Definition at line 715 of file Statement.h.

◆ setOpaqueDecFloat34()

void fbcpp::Statement::setOpaqueDecFloat34 ( unsigned  index,
std::optional< OpaqueDecFloat34 optValue 
)
inline

Binds a 34-digit decimal floating-point value in Firebird's representation or null.

Definition at line 761 of file Statement.h.

◆ setOpaqueInt128()

void fbcpp::Statement::setOpaqueInt128 ( unsigned  index,
std::optional< OpaqueInt128 optValue 
)
inline

Binds a raw 128-bit integer value in Firebird's representation or null.

Definition at line 626 of file Statement.h.

◆ setOpaqueTime()

void fbcpp::Statement::setOpaqueTime ( unsigned  index,
std::optional< OpaqueTime optValue 
)
inline

Binds a raw time-of-day value in Firebird's representation or null.

Definition at line 899 of file Statement.h.

◆ setOpaqueTimestamp()

void fbcpp::Statement::setOpaqueTimestamp ( unsigned  index,
std::optional< OpaqueTimestamp optValue 
)
inline

Binds a raw timestamp value in Firebird's representation or null.

Definition at line 960 of file Statement.h.

◆ setOpaqueTimestampTz()

void fbcpp::Statement::setOpaqueTimestampTz ( unsigned  index,
std::optional< OpaqueTimestampTz optValue 
)
inline

Binds a raw timestamp value with timezone in Firebird's representation or null.

Definition at line 1082 of file Statement.h.

◆ setOpaqueTimeTz()

void fbcpp::Statement::setOpaqueTimeTz ( unsigned  index,
std::optional< OpaqueTimeTz optValue 
)
inline

Binds a raw time-of-day value with timezone in Firebird's representation or null.

Definition at line 1021 of file Statement.h.

◆ setScaledBoostInt128()

void fbcpp::Statement::setScaledBoostInt128 ( unsigned  index,
std::optional< ScaledBoostInt128 optValue 
)
inline

Binds a scaled 128-bit integer value expressed with Boost.Multiprecision or null.

Definition at line 671 of file Statement.h.

◆ setScaledInt16()

void fbcpp::Statement::setScaledInt16 ( unsigned  index,
std::optional< ScaledInt16 optValue 
)
inline

Binds a scaled 16-bit signed integer value or null.

Definition at line 553 of file Statement.h.

◆ setScaledInt32()

void fbcpp::Statement::setScaledInt32 ( unsigned  index,
std::optional< ScaledInt32 optValue 
)
inline

Binds a scaled 32-bit signed integer value or null.

Definition at line 582 of file Statement.h.

◆ setScaledInt64()

void fbcpp::Statement::setScaledInt64 ( unsigned  index,
std::optional< ScaledInt64 optValue 
)
inline

Binds a scaled 64-bit signed integer value or null.

Definition at line 611 of file Statement.h.

◆ setString()

void fbcpp::Statement::setString ( unsigned  index,
std::optional< std::string_view >  optValue 
)
inline

Binds a textual parameter or null, performing direct conversions where supported.

Definition at line 1112 of file Statement.h.

◆ setTime()

void fbcpp::Statement::setTime ( unsigned  index,
std::optional< Time optValue 
)
inline

Binds a time-of-day value without timezone or null.

Definition at line 868 of file Statement.h.

◆ setTimestamp()

void fbcpp::Statement::setTimestamp ( unsigned  index,
std::optional< Timestamp optValue 
)
inline

Binds a timestamp value without timezone or null.

Definition at line 929 of file Statement.h.

◆ setTimestampTz()

void fbcpp::Statement::setTimestampTz ( unsigned  index,
std::optional< TimestampTz optValue 
)
inline

Binds a timestamp value with timezone or null.

Definition at line 1051 of file Statement.h.

◆ setTimeTz()

void fbcpp::Statement::setTimeTz ( unsigned  index,
std::optional< TimeTz optValue 
)
inline

Binds a time-of-day value with timezone or null.

Definition at line 990 of file Statement.h.


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