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
cond::DbTransaction Class Reference

#include <DbTransaction.h>

Public Member Functions

int commit ()
 commit transaction. More...
 
 DbTransaction (ora::Transaction &dbTrans, bool owned=true)
 
bool forceCommit ()
 force the commit, regardless to the transaction clients More...
 
int isActive () const
 current transaction is active More...
 
bool isReadOnly () const
 current transaction is readonly More...
 
bool rollback ()
 rollback transaction More...
 
int start (bool readOnly=false)
 start transaction More...
 
 ~DbTransaction ()
 

Private Attributes

int m_clients
 
ora::Transactionm_dbTrans
 
bool m_owned
 
bool m_readOnly
 

Detailed Description

Definition at line 19 of file DbTransaction.h.

Constructor & Destructor Documentation

DbTransaction::DbTransaction ( ora::Transaction dbTrans,
bool  owned = true 
)

Definition at line 8 of file DbTransaction.cc.

8  :
9  m_dbTrans( dbTrans ),m_readOnly(true),m_clients(0),m_owned(owned ){
10 }
ora::Transaction & m_dbTrans
Definition: DbTransaction.h:38
DbTransaction::~DbTransaction ( )

Definition at line 12 of file DbTransaction.cc.

12  {
13  if( m_owned ) rollback();
14 }
bool rollback()
rollback transaction

Member Function Documentation

int DbTransaction::commit ( )
bool DbTransaction::forceCommit ( )

force the commit, regardless to the transaction clients

Definition at line 39 of file DbTransaction.cc.

39  {
40  bool doCommit = false;
41  if(m_clients){
42  m_dbTrans.commit();
43  doCommit = true;
44  }
45  m_clients = 0;
46  return doCommit;
47 }
bool commit()
Commits the transaction.
Definition: Transaction.cc:22
ora::Transaction & m_dbTrans
Definition: DbTransaction.h:38
int DbTransaction::isActive ( ) const

current transaction is active

Definition at line 59 of file DbTransaction.cc.

Referenced by cond::persistency::OraTransaction::isActive().

59  {
60  if(!m_dbTrans.isActive()) return 0;
61  return m_clients;
62 }
bool isActive(bool checkIfReadOnly=false) const
Checks if the transaction is active.
Definition: Transaction.cc:42
ora::Transaction & m_dbTrans
Definition: DbTransaction.h:38
bool DbTransaction::isReadOnly ( ) const

current transaction is readonly

Definition at line 64 of file DbTransaction.cc.

65 {
66  return m_dbTrans.isActive( true );
67 }
bool isActive(bool checkIfReadOnly=false) const
Checks if the transaction is active.
Definition: Transaction.cc:42
ora::Transaction & m_dbTrans
Definition: DbTransaction.h:38
bool DbTransaction::rollback ( )

rollback transaction

Definition at line 49 of file DbTransaction.cc.

Referenced by cond::persistency::OraTransaction::rollback().

49  {
50  bool doRollBack = false;
51  if(m_clients){
53  doRollBack = true;
54  }
55  m_clients = 0;
56  return doRollBack;
57 }
bool rollback()
Rolls back the transaction.
Definition: Transaction.cc:32
ora::Transaction & m_dbTrans
Definition: DbTransaction.h:38
int DbTransaction::start ( bool  readOnly = false)

start transaction

Definition at line 16 of file DbTransaction.cc.

Referenced by progressbar.ProgressBar::__next__(), cond::BasePayloadProxy::BasePayloadProxy(), cond::persistency::checkBackendType(), l1t::OMDSReader::connect(), Types.LuminosityBlockRange::cppID(), Types.EventRange::cppID(), cond::ExportIOVUtilities::execute(), cond::AlignSplitIOV::execute(), FillInfoPopConSourceHandler::getNewObjects(), DTLVStatusHandler::getNewObjects(), DTHVStatusHandler::getNewObjects(), cond::RDBMS::globalTag(), cond::KeyList::load(), cond::BasePayloadProxy::loadIov(), cond::BasePayloadProxy::loadTag(), cond::BasePayloadProxy::make(), l1t::OMDSReader::OMDSReader(), cond::PayLoadInspector< DataT >::plot(), cond::BasePayloadProxy::refresh(), cond::CondDB::startReadOnlyTransaction(), cond::persistency::SessionImpl::startTransaction(), cond::CondDB::startTransaction(), cond::PayLoadInspector< DataT >::summary(), and cond::PayLoadInspector< DataT >::trend_plot().

16  {
17  if(!m_clients){
18  m_dbTrans.start( readOnly );
19  m_readOnly = readOnly;
20  } else {
21  if(readOnly != m_readOnly)
22  return -1;
23  }
24  ++m_clients;
25  return m_clients;
26 }
bool start(bool readOnly=true)
Starts a new transaction. Returns the success of the operation.
Definition: Transaction.cc:12
ora::Transaction & m_dbTrans
Definition: DbTransaction.h:38

Member Data Documentation

int cond::DbTransaction::m_clients
private

Definition at line 40 of file DbTransaction.h.

ora::Transaction& cond::DbTransaction::m_dbTrans
private

Definition at line 38 of file DbTransaction.h.

bool cond::DbTransaction::m_owned
private

Definition at line 41 of file DbTransaction.h.

bool cond::DbTransaction::m_readOnly
private

Definition at line 39 of file DbTransaction.h.