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::DbScopedTransaction Class Reference

#include <DbScopedTransaction.h>

Public Member Functions

int commit ()
 commit transaction. Will disconnect from database if connection timeout==0 or connectted time close to the threshold More...
 
 DbScopedTransaction (cond::DbSession &session)
 
int isActive () const
 current transaction is active More...
 
bool isLocallyActive () const
 query if locally has been activated More...
 
bool isReadOnly () const
 current transaction is readonly More...
 
bool rollback ()
 rollback transaction More...
 
int start (bool readOnly=false)
 start transaction More...
 
 ~DbScopedTransaction ()
 

Private Attributes

bool m_locallyActive
 
cond::DbSessionm_session
 

Detailed Description

Definition at line 17 of file DbScopedTransaction.h.

Constructor & Destructor Documentation

DbScopedTransaction::DbScopedTransaction ( cond::DbSession session)
explicit

Definition at line 6 of file DbScopedTransaction.cc.

6  :
7  m_session(session),m_locallyActive(false){
8 }
DbScopedTransaction::~DbScopedTransaction ( )

Definition at line 10 of file DbScopedTransaction.cc.

10  {
11  if(m_locallyActive) {
13  }
14 }
bool rollback()
rollback transaction
DbTransaction & transaction()
Definition: DbSession.cc:208

Member Function Documentation

int DbScopedTransaction::commit ( )
int DbScopedTransaction::isActive ( ) const

current transaction is active

Definition at line 41 of file DbScopedTransaction.cc.

41  {
42  return m_session.transaction().isActive();
43 }
DbTransaction & transaction()
Definition: DbSession.cc:208
int isActive() const
current transaction is active
bool DbScopedTransaction::isLocallyActive ( ) const

query if locally has been activated

Definition at line 37 of file DbScopedTransaction.cc.

37  {
38  return m_locallyActive;
39 }
bool DbScopedTransaction::isReadOnly ( ) const

current transaction is readonly

Definition at line 45 of file DbScopedTransaction.cc.

46 {
47  return m_session.transaction().isReadOnly();
48 }
DbTransaction & transaction()
Definition: DbSession.cc:208
bool isReadOnly() const
current transaction is readonly
bool DbScopedTransaction::rollback ( )

rollback transaction

Definition at line 30 of file DbScopedTransaction.cc.

References run_regression::ret.

30  {
31  if(!m_locallyActive) return false;
32  bool ret = m_session.transaction().rollback();
33  m_locallyActive = false;
34  return ret;
35 }
bool rollback()
rollback transaction
DbTransaction & transaction()
Definition: DbSession.cc:208
int DbScopedTransaction::start ( bool  readOnly = false)

Member Data Documentation

bool cond::DbScopedTransaction::m_locallyActive
private

Definition at line 36 of file DbScopedTransaction.h.

cond::DbSession& cond::DbScopedTransaction::m_session
private

Definition at line 35 of file DbScopedTransaction.h.