CMS 3D CMS Logo

Public Member Functions | Private Attributes

ora::Transaction Class Reference

#include <Transaction.h>

List of all members.

Public Member Functions

bool commit ()
 Commits the transaction.
bool isActive (bool checkIfReadOnly=false) const
 Checks if the transaction is active.
bool rollback ()
 Rolls back the transaction.
bool start (bool readOnly=true)
 Starts a new transaction. Returns the success of the operation.
 Transaction (DatabaseSession &session)
virtual ~Transaction ()
 Default destructor.

Private Attributes

bool m_localActive
DatabaseSessionm_session

Detailed Description

Definition at line 12 of file Transaction.h.


Constructor & Destructor Documentation

ora::Transaction::Transaction ( DatabaseSession session) [explicit]

Definition at line 4 of file Transaction.cc.

                                                   :
  m_session( session ),
  m_localActive( false ){
}
ora::Transaction::~Transaction ( ) [virtual]

Default destructor.

Definition at line 9 of file Transaction.cc.

                             {
}

Member Function Documentation

bool ora::Transaction::commit ( )

Commits the transaction.

Definition at line 22 of file Transaction.cc.

                           {
  bool committed = false;
  if(m_localActive){
    m_session.commitTransaction();
    m_localActive = false;
    committed = true;
  }
  return committed;
}
bool ora::Transaction::isActive ( bool  checkIfReadOnly = false) const

Checks if the transaction is active.

Definition at line 42 of file Transaction.cc.

                                                          {
  if( !m_session.isConnected() ) return false;
  return m_session.isTransactionActive( checkIfReadOnly );
}
bool ora::Transaction::rollback ( )

Rolls back the transaction.

Definition at line 32 of file Transaction.cc.

                             {
  bool rolled = false;
  if(m_localActive){
    m_session.rollbackTransaction();
    m_localActive = false;
    rolled = true;
  }
  return rolled;
}
bool ora::Transaction::start ( bool  readOnly = true)

Starts a new transaction. Returns the success of the operation.

Definition at line 12 of file Transaction.cc.

                                         {
  bool started = false;
  if(!m_localActive){
    m_session.startTransaction( readOnly );
    m_localActive = true;
    started = true;
  }
  return started;
}

Member Data Documentation

Definition at line 34 of file Transaction.h.

Definition at line 33 of file Transaction.h.