te::da::ScopedTransaction Class Reference

An utility class to coordinate transactions. More...

#include <ScopedTransaction.h>

Inheritance diagram for te::da::ScopedTransaction:

Public Member Functions

void commit ()
 It commits the transaction. More...
 
 ScopedTransaction (te::da::DataSourceTransactor &transactor)
 Constructor. More...
 
 ~ScopedTransaction ()
 Destructor. More...
 

Private Attributes

bool m_rollback
 A flag that indicates if the transaction may be aborted at the end. More...
 
te::da::DataSourceTransactorm_t
 A reference to the underlying transactor. More...
 

Detailed Description

An utility class to coordinate transactions.

This class can be used to create an object that automatically rollback a transaction when it goes out of scope.

When the client has finished performing operations it must explicitly call the commit method. This will inform ScopedTransaction to not rollback when it goes out of scope.

See also
DataSourceTransactor

Definition at line 56 of file ScopedTransaction.h.

Constructor & Destructor Documentation

te::da::ScopedTransaction::ScopedTransaction ( te::da::DataSourceTransactor transactor)

Constructor.

Parameters
transactorThe transactor that will be used to initiate a transaction.
te::da::ScopedTransaction::~ScopedTransaction ( )

Destructor.

Member Function Documentation

void te::da::ScopedTransaction::commit ( )

It commits the transaction.

Exceptions
Itthrows an exception if something goes wrong during transaction commitment.

Member Data Documentation

bool te::da::ScopedTransaction::m_rollback
private

A flag that indicates if the transaction may be aborted at the end.

Definition at line 80 of file ScopedTransaction.h.

te::da::DataSourceTransactor& te::da::ScopedTransaction::m_t
private

A reference to the underlying transactor.

Definition at line 79 of file ScopedTransaction.h.


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