ATLAS Offline Software
Database
CoraCool
src
CoraCoolSequence.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#ifndef CORACOOL_CORACOOLSEQUENCE_H
6
#define CORACOOL_CORACOOLSEQUENCE_H
7
// CoraCoolSequence.h
8
// class to implement a sequence table to generate primary and foreign keys
9
// using an auxillary table with SELECT ... FOR UPDATE semantics
10
// table is called <dbname>_CORACOOLKEYS with one row per sequence
11
// Richard Hawkings, started 24/10/06
12
13
#include <string>
14
15
class
CoraCoolSequence
{
16
public
:
17
// access a sequence - try to create required tables if create set
18
// assumes a database transaction is already active
19
CoraCoolSequence
(
const
std::string&
dbname
,
const
std::string& seqname,
20
coral::ISessionProxy*
proxy
,
bool
create=
false
);
21
22
// fetch the next value in the sequence, reserving inc values
23
// assumes a database transaction is already active
24
// locks the corresponding table rows until the transaction is committed
25
int
fetch
(
const
int
inc=1);
26
27
// query to find the current value (which is not yet used), but no increment
28
// must be followed by a fetch if this key value is actually used
29
bool
querySeq
(
int
& keyval,
bool
update
=
false
,
bool
gettable=
false
);
30
31
// drop the current sequence from the table
32
// assumes a transaction is already active
33
// after this, the current sequence object is invalid and will not work
34
bool
dropSeq
();
35
36
private
:
37
// hide default constructor
38
CoraCoolSequence
();
39
40
std::string
m_dbname
;
// the parent COOL database instance
41
std::string
m_seqname
;
// name of the sequence
42
coral::ISessionProxy*
m_proxy
;
// pointer to CORAL session
43
coral::ITable*
m_table
;
// pointer to the sequence table
44
};
45
46
#endif // CORACOOL_CORACOOLSEQUENCE_H
CaloNoise_fillDB.dbname
dbname
Definition:
CaloNoise_fillDB.py:43
StateLessPT_NewConfig.proxy
proxy
Definition:
StateLessPT_NewConfig.py:392
CoraCoolSequence::querySeq
bool querySeq(int &keyval, bool update=false, bool gettable=false)
Definition:
CoraCoolSequence.cxx:96
CoraCoolSequence::dropSeq
bool dropSeq()
Definition:
CoraCoolSequence.cxx:124
CoraCoolSequence::fetch
int fetch(const int inc=1)
Definition:
CoraCoolSequence.cxx:73
CoraCoolSequence::m_dbname
std::string m_dbname
Definition:
CoraCoolSequence.h:40
CoraCoolSequence
Definition:
CoraCoolSequence.h:15
CoraCoolSequence::m_proxy
coral::ISessionProxy * m_proxy
Definition:
CoraCoolSequence.h:42
CoraCoolSequence::m_seqname
std::string m_seqname
Definition:
CoraCoolSequence.h:41
CoraCoolSequence::m_table
coral::ITable * m_table
Definition:
CoraCoolSequence.h:43
CoraCoolSequence::CoraCoolSequence
CoraCoolSequence()
WriteBchToCool.update
update
Definition:
WriteBchToCool.py:67
Generated on Fri Jan 10 2025 21:08:32 for ATLAS Offline Software by
1.8.18