CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DbScopedTransaction.cc
Go to the documentation of this file.
1 // local includes
5 
7  m_session(session),m_locallyActive(false){
8 }
9 
11  if(m_locallyActive) {
12  m_session.transaction().rollback();
13  }
14 }
15 
17  if(m_locallyActive) return -1;
18  int ret = m_session.transaction().start( readOnly );
19  m_locallyActive = true;
20  return ret;
21 }
22 
24  if(!m_locallyActive) return -1;
25  int ret = m_session.transaction().commit();
26  m_locallyActive = false;
27  return ret;
28 }
29 
31  if(!m_locallyActive) return false;
32  bool ret = m_session.transaction().rollback();
33  m_locallyActive = false;
34  return ret;
35 }
36 
38  return m_locallyActive;
39 }
40 
42  return m_session.transaction().isActive();
43 }
44 
46 {
47  return m_session.transaction().isReadOnly();
48 }
49 
bool rollback()
rollback transaction
DbScopedTransaction(cond::DbSession &session)
bool isReadOnly() const
current transaction is readonly
int isActive() const
current transaction is active
int start(bool readOnly=false)
start transaction
bool isLocallyActive() const
query if locally has been activated
int commit()
commit transaction. Will disconnect from database if connection timeout==0 or connectted time close t...