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

Represents a transaction in a Firebird database. More...

#include <Transaction.h>

Public Member Functions

 Transaction (Attachment &attachment, const TransactionOptions &options={})
 Constructs a Transaction object that starts a transaction in the specified Attachment using the specified options.
 
 Transaction (Attachment &attachment, std::string_view setTransactionCmd)
 Constructs a Transaction object that starts a transaction specified by a SET TRANSACTION command.
 
 Transaction (Transaction &&o) noexcept
 Move constructor.
 
Transactionoperator= (Transaction &&)=delete
 
 Transaction (const Transaction &)=delete
 
Transactionoperator= (const Transaction &)=delete
 
 ~Transaction () noexcept
 Rolls back the transaction if it is still active.
 
bool isValid () noexcept
 Returns whether the Transaction object is valid.
 
FbRef< fb::ITransaction > getHandle () noexcept
 Returns the internal Firebird ITransaction handle.
 
void commit ()
 Commits the transaction.
 
void commitRetaining ()
 Commits the transaction while maintains it active.
 
void rollback ()
 Rolls back the transaction.
 
void rollbackRetaining ()
 Rolls back the transaction while maintains it active.
 

Detailed Description

Represents a transaction in a Firebird database.

The Transaction must exist and remain valid while there are other objects using it, such as Statement. If a Transaction object is destroyed before being committed or rolled back, it will be automatically rolled back.

Definition at line 276 of file Transaction.h.

Constructor & Destructor Documentation

◆ Transaction() [1/3]

Transaction::Transaction ( Attachment attachment,
const TransactionOptions options = {} 
)
explicit

Constructs a Transaction object that starts a transaction in the specified Attachment using the specified options.

Definition at line 35 of file Transaction.cpp.

◆ Transaction() [2/3]

Transaction::Transaction ( Attachment attachment,
std::string_view  setTransactionCmd 
)
explicit

Constructs a Transaction object that starts a transaction specified by a SET TRANSACTION command.

Definition at line 144 of file Transaction.cpp.

◆ Transaction() [3/3]

fbcpp::Transaction::Transaction ( Transaction &&  o)
inlinenoexcept

Move constructor.

A moved Transaction object becomes invalid.

Definition at line 297 of file Transaction.h.

◆ ~Transaction()

fbcpp::Transaction::~Transaction ( )
inlinenoexcept

Rolls back the transaction if it is still active.

Definition at line 311 of file Transaction.h.

Member Function Documentation

◆ commit()

void Transaction::commit ( )

Commits the transaction.

Definition at line 169 of file Transaction.cpp.

◆ commitRetaining()

void Transaction::commitRetaining ( )

Commits the transaction while maintains it active.

Definition at line 180 of file Transaction.cpp.

◆ getHandle()

FbRef< fb::ITransaction > fbcpp::Transaction::getHandle ( )
inlinenoexcept

Returns the internal Firebird ITransaction handle.

Definition at line 338 of file Transaction.h.

◆ isValid()

bool fbcpp::Transaction::isValid ( )
inlinenoexcept

Returns whether the Transaction object is valid.

Definition at line 330 of file Transaction.h.

◆ rollback()

void Transaction::rollback ( )

Rolls back the transaction.

Definition at line 157 of file Transaction.cpp.

◆ rollbackRetaining()

void Transaction::rollbackRetaining ( )

Rolls back the transaction while maintains it active.

Definition at line 190 of file Transaction.cpp.


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