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) m_session.transaction().rollback();
12 }
13 
15  if(m_locallyActive) return -1;
16  int ret = m_session.transaction().start( readOnly );
17  m_locallyActive = true;
18  return ret;
19 }
20 
22  if(!m_locallyActive) return -1;
23  int ret = m_session.transaction().commit();
24  m_locallyActive = false;
25  return ret;
26 }
27 
29  if(!m_locallyActive) return false;
30  bool ret = m_session.transaction().rollback();
31  m_locallyActive = false;
32  return ret;
33 }
34 
36  return m_locallyActive;
37 }
38 
40  return m_session.transaction().isActive();
41 }
42 
44 {
45  /*if(m_locallyActive) */return m_session.transaction().isReadOnly();
46  //return true;
47 }
48 
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...