test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

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

Definition at line 14 of file idDealer.cc.

15 }
coral::ISchema & m_schema
Definition: idDealer.h:14
std::string m_idtablecolumnName
Definition: idDealer.h:15
static const std::string idTableColumnName()
Definition: LumiNames.cc:71
static const std::string idTableColumnType()
Definition: LumiNames.cc:74
std::string m_idtablecolumnType
Definition: idDealer.h:16

Member Function Documentation

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

Definition at line 31 of file idDealer.cc.

References lumi::LumiNames::idTableName(), python.IdGenerator::idtableName, idDealer::inputData, MergeJob_cfg::interval, lumiQueryAPI::q, alignCSCRings::r, contentValuesCheck::ss, and AlCaHLTBitMon_QueryRunRegistry::string.

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().

31  {
33  coral::IQuery* q=m_schema.tableHandle(idtableName).newQuery();
34  q->addToOutputList(m_idtablecolumnName);
35  unsigned long long r=0;
36  coral::AttributeList myresult;
37  myresult.extend(m_idtablecolumnName,typeid(unsigned long long));
38  q->defineOutput(myresult);
39  q->setForUpdate(); //lock it
40  coral::ICursor& cursor=q->execute();
41  while ( cursor.next() ){
42  const coral::AttributeList& row = cursor.currentRow();
43  r = row[m_idtablecolumnName].data<unsigned long long>();
44  }
45  coral::ITableDataEditor& dataEditor=m_schema.tableHandle(idtableName).dataEditor();
46  coral::AttributeList inputData;
47  //inputData.extend("interval",typeid(unsigned int));
48  //inputData["interval"].data<unsigned int>()=interval;
49  //dataEditor.updateRows(m_idtablecolumnName+"="+m_idtablecolumnName+"+1","",inputData);
50  std::stringstream ss;
51  ss<<interval;
52  dataEditor.updateRows(m_idtablecolumnName+"="+m_idtablecolumnName+"+"+ss.str(),"",inputData);
53  delete q;
54  return r+interval;
55 }
tuple interval
Definition: MergeJob_cfg.py:20
coral::ISchema & m_schema
Definition: idDealer.h:14
std::string m_idtablecolumnName
Definition: idDealer.h:15
static const std::string idTableName(const std::string &dataTableName)
Definition: LumiNames.cc:68
tuple inputData
Definition: idDealer.py:72
unsigned long long lumi::idDealer::getIDforTable ( const std::string &  tableName)

Definition at line 16 of file idDealer.cc.

References lumi::LumiNames::idTableName(), python.IdGenerator::idtableName, lumiQueryAPI::q, query::result, and AlCaHLTBitMon_QueryRunRegistry::string.

16  {
18  coral::IQuery* q=m_schema.tableHandle(idtableName).newQuery();
19  q->addToOutputList(m_idtablecolumnName);
20  q->setForUpdate(); //lock it
21  coral::ICursor& cursor=q->execute();
22  unsigned long long result=0;
23  while ( cursor.next() ){
24  const coral::AttributeList& row = cursor.currentRow();
25  result = row[m_idtablecolumnName].data<unsigned long long>();
26  }
27  cursor.close();
28  delete q;
29  return result;
30 }
coral::ISchema & m_schema
Definition: idDealer.h:14
std::string m_idtablecolumnName
Definition: idDealer.h:15
tuple result
Definition: query.py:137
static const std::string idTableName(const std::string &dataTableName)
Definition: LumiNames.cc:68

Member Data Documentation

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

Definition at line 15 of file idDealer.h.

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

Definition at line 16 of file idDealer.h.

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

Definition at line 14 of file idDealer.h.