Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
CondCore
DBCommon
src
DbTransaction.cc
Go to the documentation of this file.
1
// local includes
2
#include "
CondCore/DBCommon/interface/DbTransaction.h
"
3
#include "
CondCore/ORA/interface/Transaction.h
"
4
// coral & pool includes
5
#include "RelationalAccess/ISessionProxy.h"
6
#include "RelationalAccess/ITransaction.h"
7
8
cond::DbTransaction::DbTransaction
(
ora::Transaction
& dbTrans,
bool
owned ):
9
m_dbTrans( dbTrans ),m_readOnly(
true
),m_clients(0),m_owned(owned ){
10
}
11
12
cond::DbTransaction::~DbTransaction
(){
13
if
( m_owned ) rollback();
14
}
15
16
int
cond::DbTransaction::start
(
bool
readOnly){
17
if
(!m_clients){
18
m_dbTrans.start( readOnly );
19
m_readOnly = readOnly;
20
}
else
{
21
if
(readOnly != m_readOnly)
22
return
-1;
23
}
24
++m_clients;
25
return
m_clients;
26
}
27
28
int
cond::DbTransaction::commit
(){
29
if
(!m_clients)
return
-1;
30
else
{
31
--m_clients;
32
if
(m_clients == 0){
33
m_dbTrans.commit();
34
}
35
}
36
return
m_clients;
37
}
38
39
bool
cond::DbTransaction::forceCommit
(){
40
bool
doCommit =
false
;
41
if
(m_clients){
42
m_dbTrans.commit();
43
doCommit =
true
;
44
}
45
m_clients = 0;
46
return
doCommit;
47
}
48
49
bool
cond::DbTransaction::rollback
(){
50
bool
doRollBack =
false
;
51
if
(m_clients){
52
m_dbTrans.rollback();
53
doRollBack =
true
;
54
}
55
m_clients = 0;
56
return
doRollBack;
57
}
58
59
int
cond::DbTransaction::isActive
()
const
{
60
if
(!m_dbTrans.isActive())
return
0;
61
return
m_clients;
62
}
63
64
bool
cond::DbTransaction::isReadOnly
()
const
65
{
66
return
m_dbTrans.isActive(
true
);
67
}
68
cond::DbTransaction::rollback
bool rollback()
rollback transaction
Definition:
DbTransaction.cc:49
cond::DbTransaction::isActive
int isActive() const
current transaction is active
Definition:
DbTransaction.cc:59
cond::DbTransaction::~DbTransaction
~DbTransaction()
Definition:
DbTransaction.cc:12
cond::DbTransaction::commit
int commit()
commit transaction.
Definition:
DbTransaction.cc:28
funct::true
true
Definition:
Factorize.h:183
cond::DbTransaction::start
int start(bool readOnly=false)
start transaction
Definition:
DbTransaction.cc:16
cond::DbTransaction::forceCommit
bool forceCommit()
force the commit, regardless to the transaction clients
Definition:
DbTransaction.cc:39
ora::Transaction
Definition:
Transaction.h:12
DbTransaction.h
cond::DbTransaction::DbTransaction
DbTransaction(ora::Transaction &dbTrans, bool owned=true)
Definition:
DbTransaction.cc:8
cond::DbTransaction::isReadOnly
bool isReadOnly() const
current transaction is readonly
Definition:
DbTransaction.cc:64
Transaction.h
Generated for CMSSW Reference Manual by
1.8.5