![]() |
fb-cpp 0.0.2
A modern C++ wrapper for the Firebird database API
|
Represents a Firebird request: a precompiled BLR (Binary Language Representation) program. More...
#include <Request.h>
Classes | |
| struct | MessageEntry |
| Associates a message number declared in the BLR with its format. More... | |
Public Member Functions | |
| Request (Attachment &attachment, std::span< const std::byte > blr, const std::vector< MessageEntry > &messages={}) | |
| Compiles a request from the given BLR for the attachment's database. | |
| Request (Request &&o) noexcept | |
| Move constructor. | |
| Request & | operator= (Request &&o) noexcept |
| Move assignment. | |
| Request (const Request &)=delete | |
| Request & | operator= (const Request &)=delete |
| ~Request () noexcept | |
| Releases resources; ignores failures to keep destructor noexcept. | |
| bool | isValid () noexcept |
| Returns whether the Request object is valid. | |
| Attachment & | getAttachment () noexcept |
| Returns the Attachment object reference used to create this Request. | |
| FbRef< fb::IRequest > | getHandle () noexcept |
| Returns the internal Firebird IRequest handle. | |
| RequestMessage & | getMessage (unsigned messageNumber) |
| Returns the message associated with a message number declared at construction time. | |
| void | free () |
| Releases the compiled request. | |
| void | start (Transaction &transaction, unsigned level=0) |
| Starts the execution of the request. | |
| void | startAndSend (Transaction &transaction, unsigned messageNumber, unsigned level=0) |
| Starts the execution of the request, sending it an input message. | |
| void | send (unsigned messageNumber, unsigned level=0) |
| Sends an input message to the running request. | |
| bool | receive (unsigned messageNumber, unsigned level=0) |
| Receives a record from the running request into the associated message. | |
| void | unwind (unsigned level=0) |
| Unwinds the running request. | |
Represents a Firebird request: a precompiled BLR (Binary Language Representation) program.
Requests bypass SQL entirely. The BLR is supplied by the caller - typically produced by gpre or hand-written - and declares its own messages with blr_message clauses. Describe each message you intend to access with a RequestMessageFormat (preferably generating its clause with buildBlrMessageClause) and pass both to the constructor; values are then read and written through typed accessors instead of raw buffers.
A request is executed with start or startAndSend. Records produced by the BLR body (blr_send nodes) are consumed with receive, which returns false when the request is finished. Input messages declared by the BLR body (blr_receive nodes) are delivered with send.
|
explicit |
Compiles a request from the given BLR for the attachment's database.
Definition at line 33 of file Request.cpp.
|
noexcept |
Move constructor.
A moved Request object becomes invalid.
Definition at line 57 of file Request.cpp.
|
inlinenoexcept |
| void fbcpp::request::Request::free | ( | ) |
Releases the compiled request.
Definition at line 91 of file Request.cpp.
|
inlinenoexcept |
Returns the Attachment object reference used to create this Request.
|
inlinenoexcept |
| RequestMessage & fbcpp::request::Request::getMessage | ( | unsigned | messageNumber | ) |
Returns the message associated with a message number declared at construction time.
Definition at line 78 of file Request.cpp.
|
inlinenoexcept |
| bool fbcpp::request::Request::receive | ( | unsigned | messageNumber, |
| unsigned | level = 0 |
||
| ) |
Receives a record from the running request into the associated message.
Returns false when the request has no more records.
Definition at line 140 of file Request.cpp.
| void fbcpp::request::Request::send | ( | unsigned | messageNumber, |
| unsigned | level = 0 |
||
| ) |
Sends an input message to the running request.
Definition at line 124 of file Request.cpp.
| void fbcpp::request::Request::start | ( | Transaction & | transaction, |
| unsigned | level = 0 |
||
| ) |
Starts the execution of the request.
Definition at line 99 of file Request.cpp.
| void fbcpp::request::Request::startAndSend | ( | Transaction & | transaction, |
| unsigned | messageNumber, | ||
| unsigned | level = 0 |
||
| ) |
Starts the execution of the request, sending it an input message.
Definition at line 107 of file Request.cpp.
| void fbcpp::request::Request::unwind | ( | unsigned | level = 0 | ) |
Unwinds the running request.
Definition at line 168 of file Request.cpp.