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

Describes the fields of a Firebird request message. More...

#include <RequestMessageFormat.h>

Public Member Functions

RequestMessageFormataddBool (bool isNullable)
 Appends a boolean field, optionally nullable.
 
RequestMessageFormataddInt16 (bool isNullable)
 Appends a 16-bit signed integer field, optionally nullable.
 
RequestMessageFormataddScaledInt16 (bool isNullable, int scale)
 Appends a scaled 16-bit signed integer field, optionally nullable.
 
RequestMessageFormataddInt32 (bool isNullable)
 Appends a 32-bit signed integer field, optionally nullable.
 
RequestMessageFormataddScaledInt32 (bool isNullable, int scale)
 Appends a scaled 32-bit signed integer field, optionally nullable.
 
RequestMessageFormataddInt64 (bool isNullable)
 Appends a 64-bit signed integer field, optionally nullable.
 
RequestMessageFormataddScaledInt64 (bool isNullable, int scale)
 Appends a scaled 64-bit signed integer field, optionally nullable.
 
RequestMessageFormataddScaledOpaqueInt128 (bool isNullable, int scale)
 Appends a scaled 128-bit integer field in Firebird's representation, optionally nullable.
 
RequestMessageFormataddScaledBoostInt128 (bool isNullable, int scale)
 Appends a scaled 128-bit integer field expressed with Boost.Multiprecision, optionally nullable.
 
RequestMessageFormataddFloat (bool isNullable)
 Appends a single precision floating-point field, optionally nullable.
 
RequestMessageFormataddDouble (bool isNullable)
 Appends a double precision floating-point field, optionally nullable.
 
RequestMessageFormataddDecFloat16 (bool isNullable)
 Appends a 16-digit decimal floating-point field, optionally nullable.
 
RequestMessageFormataddDecFloat34 (bool isNullable)
 Appends a 34-digit decimal floating-point field, optionally nullable.
 
RequestMessageFormataddDate (bool isNullable)
 Appends a date field, optionally nullable.
 
RequestMessageFormataddTime (bool isNullable)
 Appends a time-of-day field without timezone, optionally nullable.
 
RequestMessageFormataddTimestamp (bool isNullable)
 Appends a timestamp field without timezone, optionally nullable.
 
RequestMessageFormataddTimeTz (bool isNullable)
 Appends a time-of-day field with timezone, optionally nullable.
 
RequestMessageFormataddTimestampTz (bool isNullable)
 Appends a timestamp field with timezone, optionally nullable.
 
RequestMessageFormataddBlobId (bool isNullable)
 Appends a blob identifier field, optionally nullable.
 
RequestMessageFormataddString (bool isNullable, unsigned length, std::optional< unsigned > charSetId={})
 Appends a variable-length string field with the given maximum length in bytes, optionally nullable.
 
unsigned getCount () const noexcept
 Returns the number of fields.
 
const std::vector< Descriptor > & getDescriptors () const noexcept
 Returns the descriptors of the appended fields, in declaration order.
 
unsigned getLength () const noexcept
 Returns the total message length in bytes.
 
unsigned getBlrFieldIndex (unsigned index) const
 Returns the index of the field inside the BLR message, which interleaves null indicators as extra entries.
 
std::vector< std::byte > buildBlrMessageClause (unsigned messageNumber) const
 Generates the blr_message clause describing this message.
 

Detailed Description

Describes the fields of a Firebird request message.

Firebird requests (compiled BLR programs) have no server-side message metadata: the layout of each message is defined by the blr_message clause declared inside the BLR itself. RequestMessageFormat is the client-side counterpart of such a clause. Fields are appended with typed add methods that compute the same offsets and alignments used by the engine when it parses blr_message, and buildBlrMessageClause() generates the actual clause bytes, so declarations and accessors cannot get out of sync.

Non-nullable fields occupy only their value bytes. Nullable fields reserve an additional 16-bit null indicator right after the value, exactly like DSQL messages do.

Definition at line 61 of file RequestMessageFormat.h.

Member Function Documentation

◆ addBlobId()

RequestMessageFormat & fbcpp::request::RequestMessageFormat::addBlobId ( bool  isNullable)
inline

Appends a blob identifier field, optionally nullable.

Definition at line 213 of file RequestMessageFormat.h.

◆ addBool()

RequestMessageFormat & fbcpp::request::RequestMessageFormat::addBool ( bool  isNullable)
inline

Appends a boolean field, optionally nullable.

Definition at line 67 of file RequestMessageFormat.h.

◆ addDate()

RequestMessageFormat & fbcpp::request::RequestMessageFormat::addDate ( bool  isNullable)
inline

Appends a date field, optionally nullable.

Definition at line 173 of file RequestMessageFormat.h.

◆ addDecFloat16()

RequestMessageFormat & fbcpp::request::RequestMessageFormat::addDecFloat16 ( bool  isNullable)
inline

Appends a 16-digit decimal floating-point field, optionally nullable.

Definition at line 157 of file RequestMessageFormat.h.

◆ addDecFloat34()

RequestMessageFormat & fbcpp::request::RequestMessageFormat::addDecFloat34 ( bool  isNullable)
inline

Appends a 34-digit decimal floating-point field, optionally nullable.

Definition at line 165 of file RequestMessageFormat.h.

◆ addDouble()

RequestMessageFormat & fbcpp::request::RequestMessageFormat::addDouble ( bool  isNullable)
inline

Appends a double precision floating-point field, optionally nullable.

Definition at line 149 of file RequestMessageFormat.h.

◆ addFloat()

RequestMessageFormat & fbcpp::request::RequestMessageFormat::addFloat ( bool  isNullable)
inline

Appends a single precision floating-point field, optionally nullable.

Definition at line 141 of file RequestMessageFormat.h.

◆ addInt16()

RequestMessageFormat & fbcpp::request::RequestMessageFormat::addInt16 ( bool  isNullable)
inline

Appends a 16-bit signed integer field, optionally nullable.

Definition at line 75 of file RequestMessageFormat.h.

◆ addInt32()

RequestMessageFormat & fbcpp::request::RequestMessageFormat::addInt32 ( bool  isNullable)
inline

Appends a 32-bit signed integer field, optionally nullable.

Definition at line 91 of file RequestMessageFormat.h.

◆ addInt64()

RequestMessageFormat & fbcpp::request::RequestMessageFormat::addInt64 ( bool  isNullable)
inline

Appends a 64-bit signed integer field, optionally nullable.

Definition at line 107 of file RequestMessageFormat.h.

◆ addScaledBoostInt128()

RequestMessageFormat & fbcpp::request::RequestMessageFormat::addScaledBoostInt128 ( bool  isNullable,
int  scale 
)
inline

Appends a scaled 128-bit integer field expressed with Boost.Multiprecision, optionally nullable.

Definition at line 132 of file RequestMessageFormat.h.

◆ addScaledInt16()

RequestMessageFormat & fbcpp::request::RequestMessageFormat::addScaledInt16 ( bool  isNullable,
int  scale 
)
inline

Appends a scaled 16-bit signed integer field, optionally nullable.

Definition at line 83 of file RequestMessageFormat.h.

◆ addScaledInt32()

RequestMessageFormat & fbcpp::request::RequestMessageFormat::addScaledInt32 ( bool  isNullable,
int  scale 
)
inline

Appends a scaled 32-bit signed integer field, optionally nullable.

Definition at line 99 of file RequestMessageFormat.h.

◆ addScaledInt64()

RequestMessageFormat & fbcpp::request::RequestMessageFormat::addScaledInt64 ( bool  isNullable,
int  scale 
)
inline

Appends a scaled 64-bit signed integer field, optionally nullable.

Definition at line 115 of file RequestMessageFormat.h.

◆ addScaledOpaqueInt128()

RequestMessageFormat & fbcpp::request::RequestMessageFormat::addScaledOpaqueInt128 ( bool  isNullable,
int  scale 
)
inline

Appends a scaled 128-bit integer field in Firebird's representation, optionally nullable.

Definition at line 123 of file RequestMessageFormat.h.

◆ addString()

RequestMessageFormat & fbcpp::request::RequestMessageFormat::addString ( bool  isNullable,
unsigned  length,
std::optional< unsigned >  charSetId = {} 
)
inline

Appends a variable-length string field with the given maximum length in bytes, optionally nullable.

When charSetId is not given, the connection character set is used.

Definition at line 222 of file RequestMessageFormat.h.

◆ addTime()

RequestMessageFormat & fbcpp::request::RequestMessageFormat::addTime ( bool  isNullable)
inline

Appends a time-of-day field without timezone, optionally nullable.

Definition at line 181 of file RequestMessageFormat.h.

◆ addTimestamp()

RequestMessageFormat & fbcpp::request::RequestMessageFormat::addTimestamp ( bool  isNullable)
inline

Appends a timestamp field without timezone, optionally nullable.

Definition at line 189 of file RequestMessageFormat.h.

◆ addTimestampTz()

RequestMessageFormat & fbcpp::request::RequestMessageFormat::addTimestampTz ( bool  isNullable)
inline

Appends a timestamp field with timezone, optionally nullable.

Definition at line 205 of file RequestMessageFormat.h.

◆ addTimeTz()

RequestMessageFormat & fbcpp::request::RequestMessageFormat::addTimeTz ( bool  isNullable)
inline

Appends a time-of-day field with timezone, optionally nullable.

Definition at line 197 of file RequestMessageFormat.h.

◆ buildBlrMessageClause()

std::vector< std::byte > fbcpp::request::RequestMessageFormat::buildBlrMessageClause ( unsigned  messageNumber) const

Generates the blr_message clause describing this message.

Embed the returned bytes in your BLR before the body statements.

Definition at line 72 of file RequestMessageFormat.cpp.

◆ getBlrFieldIndex()

unsigned fbcpp::request::RequestMessageFormat::getBlrFieldIndex ( unsigned  index) const
inline

Returns the index of the field inside the BLR message, which interleaves null indicators as extra entries.

Use it to write blr_parameter references for non-nullable fields and blr_parameter2 references for nullable fields, whose null indicator is the next entry.

Definition at line 261 of file RequestMessageFormat.h.

◆ getCount()

unsigned fbcpp::request::RequestMessageFormat::getCount ( ) const
inlinenoexcept

Returns the number of fields.

Definition at line 235 of file RequestMessageFormat.h.

◆ getDescriptors()

const std::vector< Descriptor > & fbcpp::request::RequestMessageFormat::getDescriptors ( ) const
inlinenoexcept

Returns the descriptors of the appended fields, in declaration order.

Definition at line 243 of file RequestMessageFormat.h.

◆ getLength()

unsigned fbcpp::request::RequestMessageFormat::getLength ( ) const
inlinenoexcept

Returns the total message length in bytes.

Definition at line 251 of file RequestMessageFormat.h.


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