CMS 3D CMS Logo

Public Member Functions | Private Attributes

cond::DbScopedTransaction Class Reference

#include <DbScopedTransaction.h>

List of all members.

Public Member Functions

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

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

Definition at line 10 of file DbScopedTransaction.cc.

                                             {
  if(m_locallyActive) m_session.transaction().rollback();
}

Member Function Documentation

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

current transaction is active

Definition at line 39 of file DbScopedTransaction.cc.

Referenced by cond::impl::IOVImpl::refresh().

                                            {
  return m_session.transaction().isActive();
}
bool DbScopedTransaction::isLocallyActive ( ) const

query if locally has been activated

Definition at line 35 of file DbScopedTransaction.cc.

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

current transaction is readonly

Definition at line 43 of file DbScopedTransaction.cc.

Referenced by cond::impl::IOVImpl::refresh().

{
  /*if(m_locallyActive) */return m_session.transaction().isReadOnly();
  //return true;
}
bool DbScopedTransaction::rollback ( )

rollback transaction

Definition at line 28 of file DbScopedTransaction.cc.

References runTheMatrix::ret.

                                      {
  if(!m_locallyActive) return false;
  bool ret = m_session.transaction().rollback();
  m_locallyActive = false;
  return ret;
}
int DbScopedTransaction::start ( bool  readOnly = false)

Member Data Documentation

Definition at line 36 of file DbScopedTransaction.h.

Definition at line 35 of file DbScopedTransaction.h.