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 41 of file DbScopedTransaction.cc.

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

query if locally has been activated

Definition at line 37 of file DbScopedTransaction.cc.

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

current transaction is readonly

Definition at line 45 of file DbScopedTransaction.cc.

{
  return m_session.transaction().isReadOnly();
}
bool DbScopedTransaction::rollback ( )

rollback transaction

Definition at line 30 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.