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

Definition at line 14 of file idDealer.cc.

15  : m_schema(schema),
coral::ISchema & m_schema
Definition: idDealer.h:15
std::string m_idtablecolumnName
Definition: idDealer.h:16
static const std::string idTableColumnName()
Definition: LumiNames.cc:25
static const std::string idTableColumnType()
Definition: LumiNames.cc:26
std::string m_idtablecolumnType
Definition: idDealer.h:17

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.

References lumi::LumiNames::idTableName(), writeEcalDQMStatus::interval, submitPVResolutionJobs::q, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, and HLT_2022v15_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().

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 }
coral::ISchema & m_schema
Definition: idDealer.h:15
std::string m_idtablecolumnName
Definition: idDealer.h:16
static const std::string idTableName(const std::string &dataTableName)
Definition: LumiNames.cc:24

◆ getIDforTable()

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

Definition at line 18 of file idDealer.cc.

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

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 }
coral::ISchema & m_schema
Definition: idDealer.h:15
std::string m_idtablecolumnName
Definition: idDealer.h:16
static const std::string idTableName(const std::string &dataTableName)
Definition: LumiNames.cc:24

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.