CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
ora::Transaction Class Reference

#include <Transaction.h>

Public Member Functions

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

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.

4  :
6  m_localActive( false ){
7 }
DatabaseSession & m_session
Definition: Transaction.h:33
ora::Transaction::~Transaction ( )
virtual

Default destructor.

Definition at line 9 of file Transaction.cc.

9  {
10 }

Member Function Documentation

bool ora::Transaction::commit ( )

Commits the transaction.

Definition at line 22 of file Transaction.cc.

22  {
23  bool committed = false;
24  if(m_localActive){
26  m_localActive = false;
27  committed = true;
28  }
29  return committed;
30 }
DatabaseSession & m_session
Definition: Transaction.h:33
bool ora::Transaction::isActive ( bool  checkIfReadOnly = false) const

Checks if the transaction is active.

Definition at line 42 of file Transaction.cc.

42  {
43  if( !m_session.isConnected() ) return false;
44  return m_session.isTransactionActive( checkIfReadOnly );
45 }
bool isTransactionActive(bool checkIfReadOnly=false)
DatabaseSession & m_session
Definition: Transaction.h:33
bool ora::Transaction::rollback ( )

Rolls back the transaction.

Definition at line 32 of file Transaction.cc.

32  {
33  bool rolled = false;
34  if(m_localActive){
36  m_localActive = false;
37  rolled = true;
38  }
39  return rolled;
40 }
DatabaseSession & m_session
Definition: Transaction.h:33
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.

Referenced by Types.LuminosityBlockRange::cppID(), and Types.EventRange::cppID().

12  {
13  bool started = false;
14  if(!m_localActive){
15  m_session.startTransaction( readOnly );
16  m_localActive = true;
17  started = true;
18  }
19  return started;
20 }
void startTransaction(bool readOnly)
DatabaseSession & m_session
Definition: Transaction.h:33

Member Data Documentation

bool ora::Transaction::m_localActive
private

Definition at line 34 of file Transaction.h.

DatabaseSession& ora::Transaction::m_session
private

Definition at line 33 of file Transaction.h.