CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
lumi::idDealer Class Reference

#include <idDealer.h>

Public Member Functions

unsigned long long generateNextIDForTable (const std::string &tableName, unsigned int interval=1)
 
unsigned long long getIDforTable (const std::string &tableName)
 
 idDealer (coral::ISchema &schema)
 

Private Attributes

std::string m_idtablecolumnName
 
std::string m_idtablecolumnType
 
coral::ISchema & m_schema
 

Detailed Description

Definition at line 8 of file idDealer.h.

Constructor & Destructor Documentation

◆ idDealer()

lumi::idDealer::idDealer ( coral::ISchema &  schema)
explicit

Member Function Documentation

◆ generateNextIDForTable()

unsigned long long lumi::idDealer::generateNextIDForTable ( const std::string &  tableName,
unsigned int  interval = 1 
)

Definition at line 33 of file idDealer.cc.

33  {
35  coral::IQuery* q = m_schema.tableHandle(idtableName).newQuery();
36  q->addToOutputList(m_idtablecolumnName);
37  unsigned long long r = 0;
38  coral::AttributeList myresult;
39  myresult.extend(m_idtablecolumnName, typeid(unsigned long long));
40  q->defineOutput(myresult);
41  q->setForUpdate(); //lock it
42  coral::ICursor& cursor = q->execute();
43  while (cursor.next()) {
44  const coral::AttributeList& row = cursor.currentRow();
45  r = row[m_idtablecolumnName].data<unsigned long long>();
46  }
47  coral::ITableDataEditor& dataEditor = m_schema.tableHandle(idtableName).dataEditor();
48  coral::AttributeList inputData;
49  //inputData.extend("interval",typeid(unsigned int));
50  //inputData["interval"].data<unsigned int>()=interval;
51  //dataEditor.updateRows(m_idtablecolumnName+"="+m_idtablecolumnName+"+1","",inputData);
52  std::stringstream ss;
53  ss << interval;
54  dataEditor.updateRows(m_idtablecolumnName + "=" + m_idtablecolumnName + "+" + ss.str(), "", inputData);
55  delete q;
56  return r + interval;
57 }

References lumi::LumiNames::idTableName(), readEcalDQMStatus::interval, submitPVResolutionJobs::q, alignCSCRings::r, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, and HLT_Fake1_cff::tableName.

Referenced by lumi::RevisionDML::bookNewEntry(), lumi::RevisionDML::bookNewRevision(), lumi::HLTDummy2DB::retrieveData(), lumi::TRGDummy2DB::retrieveData(), lumi::LumiDummy2DB::retrieveData(), lumi::TRGWBM2DB::retrieveData(), lumi::Lumi2DB::writeAllLumiData(), lumi::HLTV32DB::writeHltData(), and lumi::TRGScalers2DB::writeTrgData().

◆ getIDforTable()

unsigned long long lumi::idDealer::getIDforTable ( const std::string &  tableName)

Definition at line 18 of file idDealer.cc.

18  {
20  coral::IQuery* q = m_schema.tableHandle(idtableName).newQuery();
21  q->addToOutputList(m_idtablecolumnName);
22  q->setForUpdate(); //lock it
23  coral::ICursor& cursor = q->execute();
24  unsigned long long result = 0;
25  while (cursor.next()) {
26  const coral::AttributeList& row = cursor.currentRow();
27  result = row[m_idtablecolumnName].data<unsigned long long>();
28  }
29  cursor.close();
30  delete q;
31  return result;
32 }

References lumi::LumiNames::idTableName(), submitPVResolutionJobs::q, mps_fire::result, AlCaHLTBitMon_QueryRunRegistry::string, and HLT_Fake1_cff::tableName.

Member Data Documentation

◆ m_idtablecolumnName

std::string lumi::idDealer::m_idtablecolumnName
private

Definition at line 16 of file idDealer.h.

◆ m_idtablecolumnType

std::string lumi::idDealer::m_idtablecolumnType
private

Definition at line 17 of file idDealer.h.

◆ m_schema

coral::ISchema& lumi::idDealer::m_schema
private

Definition at line 15 of file idDealer.h.

lumi::idDealer::m_idtablecolumnType
std::string m_idtablecolumnType
Definition: idDealer.h:17
HLT_Fake1_cff.tableName
tableName
Definition: HLT_Fake1_cff.py:10
lumi::LumiNames::idTableColumnType
static const std::string idTableColumnType()
Definition: LumiNames.cc:26
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
lumi::LumiNames::idTableName
static const std::string idTableName(const std::string &dataTableName)
Definition: LumiNames.cc:24
lumi::idDealer::m_schema
coral::ISchema & m_schema
Definition: idDealer.h:15
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
readEcalDQMStatus.interval
interval
Definition: readEcalDQMStatus.py:18
submitPVResolutionJobs.q
q
Definition: submitPVResolutionJobs.py:84
alignCSCRings.r
r
Definition: alignCSCRings.py:93
lumi::idDealer::m_idtablecolumnName
std::string m_idtablecolumnName
Definition: idDealer.h:16
lumi::LumiNames::idTableColumnName
static const std::string idTableColumnName()
Definition: LumiNames.cc:25
mps_fire.result
result
Definition: mps_fire.py:311