CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Transaction.cc
Go to the documentation of this file.
2 #include "DatabaseSession.h"
3 
5  m_session( session ),
6  m_localActive( false ){
7 }
8 
10 }
11 
12 bool ora::Transaction::start( bool readOnly ){
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 }
21 
23  bool committed = false;
24  if(m_localActive){
25  m_session.commitTransaction();
26  m_localActive = false;
27  committed = true;
28  }
29  return committed;
30 }
31 
33  bool rolled = false;
34  if(m_localActive){
35  m_session.rollbackTransaction();
36  m_localActive = false;
37  rolled = true;
38  }
39  return rolled;
40 }
41 
42 bool ora::Transaction::isActive( bool checkIfReadOnly ) const {
43  if( !m_session.isConnected() ) return false;
44  return m_session.isTransactionActive( checkIfReadOnly );
45 }
46 
bool isActive(bool checkIfReadOnly=false) const
Checks if the transaction is active.
Definition: Transaction.cc:42
bool start(bool readOnly=true)
Starts a new transaction. Returns the success of the operation.
Definition: Transaction.cc:12
virtual ~Transaction()
Default destructor.
Definition: Transaction.cc:9
bool rollback()
Rolls back the transaction.
Definition: Transaction.cc:32
bool commit()
Commits the transaction.
Definition: Transaction.cc:22
Transaction(DatabaseSession &session)
Definition: Transaction.cc:4