CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions
lumi::RevisionDML Class Reference

#include <RevisionDML.h>

Classes

class  Entry
 
class  HltEntry
 
class  LumiEntry
 
class  TrgEntry
 

Public Member Functions

void addEntry (coral::ISchema &schema, const std::string &datatableName, const Entry &entry, unsigned long long branch_id, const std::string &branchname)
 
void addRevision (coral::ISchema &schema, const std::string &datatableName, const Entry &revision, unsigned long long branch_id, std::string &branchname)
 
void bookNewEntry (coral::ISchema &schema, const std::string &datatableName, Entry &entry)
 
void bookNewRevision (coral::ISchema &schema, const std::string &datatableName, Entry &revision)
 
unsigned long long branchIdByName (coral::ISchema &schema, const std::string &branchName)
 
unsigned long long getEntryInBranchByName (coral::ISchema &schema, const std::string &datatableName, const std::string &entryname, const std::string &branchname)
 
void insertHltRunData (coral::ISchema &schema, const HltEntry &hltentry)
 
void insertLumiRunData (coral::ISchema &schema, const LumiEntry &lumientry)
 
void insertTrgRunData (coral::ISchema &schema, const TrgEntry &trgentry)
 

Detailed Description

Definition at line 9 of file RevisionDML.h.

Member Function Documentation

void lumi::RevisionDML::addEntry ( coral::ISchema &  schema,
const std::string &  datatableName,
const Entry entry,
unsigned long long  branch_id,
const std::string &  branchname 
)
  1. allocate and insert a new revision in the revisions table
  2. allocate and insert a new entry into the entry table with the new revision
  3. insert into data_rev table new data_id,revision_id mapping insert into revisions(revision_id,branch_id,branch_name,comment,ctime) values() insert into datatablename_entries (entry_id,revision_id) values() insert into datatablename_rev(data_id,revision_id) values()

Definition at line 61 of file RevisionDML.cc.

References lumi::RevisionDML::Entry::data_id, lumi::RevisionDML::Entry::entry_id, lumi::RevisionDML::Entry::entry_name, lumi::LumiNames::entryTableName(), nameDealer::entryTableName(), cmsPerfSuiteHarvest::now, lumi::RevisionDML::Entry::revision_id, lumi::LumiNames::revisionTableName(), lumi::LumiNames::revmapTableName(), and nameDealer::revmapTableName().

Referenced by lumi::Lumi2DB::writeAllLumiDataToSchema2(), lumi::HLTV32DB::writeHltDataToSchema2(), and lumi::TRGScalers2DB::writeTrgDataToSchema2().

65  {
66  coral::AttributeList revdata;
67  revdata.extend("REVISION_ID",typeid(unsigned long long));
68  revdata.extend("BRANCH_ID",typeid(unsigned long long));
69  revdata.extend("BRANCH_NAME",typeid(std::string));
70  revdata.extend("CTIME",typeid(coral::TimeStamp));
71  revdata["REVISION_ID"].data<unsigned long long>()=entry.revision_id;
72  revdata["BRANCH_ID"].data<unsigned long long>()=branchid;
73  revdata["BRANCH_NAME"].data<std::string>()=branchname;
74  revdata["CTIME"].data<coral::TimeStamp>()=coral::TimeStamp::now();
75  const std::string revTableName=lumi::LumiNames::revisionTableName();
76  schema.tableHandle(revTableName).dataEditor().insertRow(revdata);
77 
78  coral::AttributeList entrydata;
79  entrydata.extend("REVISION_ID",typeid(unsigned long long));
80  entrydata.extend("ENTRY_ID",typeid(unsigned long long));
81  entrydata.extend("NAME",typeid(std::string));
82  entrydata["REVISION_ID"].data<unsigned long long>()=entry.revision_id;
83  entrydata["ENTRY_ID"].data<unsigned long long>()=entry.entry_id;
84  entrydata["NAME"].data<std::string>()=entry.entry_name;
85  const std::string entryTableName=lumi::LumiNames::entryTableName(datatableName);
86  schema.tableHandle(entryTableName).dataEditor().insertRow(entrydata);
87 
88  coral::AttributeList revmapdata;
89  revmapdata.extend("REVISION_ID",typeid(unsigned long long));
90  revmapdata.extend("DATA_ID",typeid(unsigned long long));
91 
92  revmapdata["REVISION_ID"].data<unsigned long long>()=entry.revision_id;
93  revmapdata["DATA_ID"].data<unsigned long long>()=entry.data_id;
94 
95  const std::string revmapTableName=lumi::LumiNames::revmapTableName(datatableName);
96  schema.tableHandle(revmapTableName).dataEditor().insertRow(revmapdata);
97 }
def revmapTableName
Definition: nameDealer.py:100
static const std::string revmapTableName(const std::string &datatablename)
Definition: LumiNames.cc:62
static const std::string entryTableName(const std::string &datatablename)
Definition: LumiNames.cc:65
def entryTableName
Definition: nameDealer.py:103
static const std::string revisionTableName()
Definition: LumiNames.cc:38
void lumi::RevisionDML::addRevision ( coral::ISchema &  schema,
const std::string &  datatableName,
const Entry revision,
unsigned long long  branch_id,
std::string &  branchname 
)

1.insert a new revision into the revisions table 2.insert into data_id, revision_id pair to datatable_revmap insert into revisions(revision_id,branch_id,branch_name,ctime) values() insert into datatable_rev(data_id,revision_id) values())

Definition at line 99 of file RevisionDML.cc.

References lumi::RevisionDML::Entry::data_id, cmsPerfSuiteHarvest::now, lumi::RevisionDML::Entry::revision_id, lumi::LumiNames::revisionTableName(), lumi::LumiNames::revmapTableName(), and nameDealer::revmapTableName().

Referenced by lumi::Lumi2DB::writeAllLumiDataToSchema2(), lumi::HLTV32DB::writeHltDataToSchema2(), and lumi::TRGScalers2DB::writeTrgDataToSchema2().

103  {
104  coral::AttributeList revdata;
105  revdata.extend("REVISION_ID",typeid(unsigned long long));
106  revdata.extend("BRANCH_ID",typeid(unsigned long long));
107  revdata.extend("BRANCH_NAME",typeid(std::string));
108  revdata.extend("CTIME",typeid(coral::TimeStamp));
109  revdata["REVISION_ID"].data<unsigned long long>()=revision.revision_id;
110  revdata["BRANCH_ID"].data<unsigned long long>()=branchid;
111  revdata["BRANCH_NAME"].data<std::string>()=branchname;
112  revdata["CTIME"].data<coral::TimeStamp>()=coral::TimeStamp::now();
113  schema.tableHandle(lumi::LumiNames::revisionTableName()).dataEditor().insertRow(revdata);
114  coral::AttributeList revmapdata;
115  revmapdata.extend("REVISION_ID",typeid(unsigned long long));
116  revmapdata.extend("DATA_ID",typeid(unsigned long long));
117  revmapdata["REVISION_ID"].data<unsigned long long>()=revision.revision_id;
118  revmapdata["DATA_ID"].data<unsigned long long>()=revision.data_id;
119  const std::string revmapTableName=lumi::LumiNames::revmapTableName(datatableName);
120  schema.tableHandle(revmapTableName).dataEditor().insertRow(revmapdata);
121 }
def revmapTableName
Definition: nameDealer.py:100
static const std::string revmapTableName(const std::string &datatablename)
Definition: LumiNames.cc:62
static const std::string revisionTableName()
Definition: LumiNames.cc:38
void lumi::RevisionDML::bookNewEntry ( coral::ISchema &  schema,
const std::string &  datatableName,
Entry entry 
)

allocate new revision_id,entry_id,data_id

Definition at line 43 of file RevisionDML.cc.

References lumi::RevisionDML::Entry::data_id, lumi::RevisionDML::Entry::entry_id, lumi::LumiNames::entryTableName(), lumi::idDealer::generateNextIDForTable(), lumi::RevisionDML::Entry::revision_id, and lumi::LumiNames::revisionTableName().

Referenced by lumi::Lumi2DB::writeAllLumiDataToSchema2(), lumi::HLTV32DB::writeHltDataToSchema2(), and lumi::TRGScalers2DB::writeTrgDataToSchema2().

45  {
47  const std::string entrytableName=lumi::LumiNames::entryTableName(datatableName);
48  entry.revision_id=idg.generateNextIDForTable(lumi::LumiNames::revisionTableName());
49  entry.data_id=idg.generateNextIDForTable(datatableName);
50  entry.entry_id=idg.generateNextIDForTable(entrytableName);
51 }
static const std::string entryTableName(const std::string &datatablename)
Definition: LumiNames.cc:65
static const std::string revisionTableName()
Definition: LumiNames.cc:38
void lumi::RevisionDML::bookNewRevision ( coral::ISchema &  schema,
const std::string &  datatableName,
Entry revision 
)

allocate new revision_id,data_id

Definition at line 53 of file RevisionDML.cc.

References lumi::RevisionDML::Entry::data_id, lumi::idDealer::generateNextIDForTable(), lumi::RevisionDML::Entry::revision_id, and lumi::LumiNames::revisionTableName().

Referenced by lumi::Lumi2DB::writeAllLumiDataToSchema2(), lumi::HLTV32DB::writeHltDataToSchema2(), and lumi::TRGScalers2DB::writeTrgDataToSchema2().

55  {
57  revision.revision_id=idg.generateNextIDForTable(lumi::LumiNames::revisionTableName());
58  revision.data_id=idg.generateNextIDForTable(datatableName);
59 }
static const std::string revisionTableName()
Definition: LumiNames.cc:38
unsigned long long lumi::RevisionDML::branchIdByName ( coral::ISchema &  schema,
const std::string &  branchName 
)

select revision_id from revisions where name=:branchName

unsigned long long lumi::RevisionDML::getEntryInBranchByName ( coral::ISchema &  schema,
const std::string &  datatableName,
const std::string &  entryname,
const std::string &  branchname 
)

select e.entry_id from entrytabl e,revisiontable r where r.revision_id=e.revision_id and e.name=:entryname and r.branch_name=:branchname

Definition at line 14 of file RevisionDML.cc.

References lumi::LumiNames::entryTableName(), and lumi::LumiNames::revisionTableName().

Referenced by lumi::Lumi2DB::writeAllLumiDataToSchema2(), lumi::HLTV32DB::writeHltDataToSchema2(), and lumi::TRGScalers2DB::writeTrgDataToSchema2().

17  {
18  unsigned long long entry_id=0;
19  coral::IQuery* qHandle=schema.newQuery();
20  qHandle->addToTableList( lumi::LumiNames::entryTableName(datatableName),"e");
21  qHandle->addToTableList( lumi::LumiNames::revisionTableName(),"r");
22  qHandle->addToOutputList("e.ENTRY_ID","entry_id");
23 
24  coral::AttributeList qCondition;
25  qCondition.extend("entryname",typeid(std::string));
26  qCondition.extend("branchname",typeid(std::string));
27  qCondition["entryname"].data<std::string>()=entryname;
28  qCondition["branchname"].data<std::string>()=branchname;
29  std::string qConditionStr("r.REVISION_ID=e.REVISION_ID and e.NAME=:entryname AND r.BRANCH_NAME=:branchname");
30 
31  coral::AttributeList qResult;
32  qResult.extend("entry_id",typeid(unsigned long long));
33  qHandle->defineOutput(qResult);
34  qHandle->setCondition(qConditionStr,qCondition);
35  coral::ICursor& cursor=qHandle->execute();
36  while(cursor.next()){
37  entry_id=cursor.currentRow()["entry_id"].data<unsigned long long>();
38  }
39  delete qHandle;
40  return entry_id;
41 }
static const std::string entryTableName(const std::string &datatablename)
Definition: LumiNames.cc:65
static const std::string revisionTableName()
Definition: LumiNames.cc:38
void lumi::RevisionDML::insertHltRunData ( coral::ISchema &  schema,
const HltEntry hltentry 
)

Definition at line 165 of file RevisionDML.cc.

References lumi::RevisionDML::Entry::data_id, lumi::RevisionDML::Entry::entry_id, lumi::RevisionDML::Entry::entry_name, lumi::LumiNames::hltdataTableName(), nameDealer::hltdataTableName(), dataDML::hltrundata, lumi::RevisionDML::HltEntry::npath, lumi::RevisionDML::HltEntry::pathnames, lumi::RevisionDML::HltEntry::runnumber, and lumi::RevisionDML::HltEntry::source.

Referenced by lumi::HLTV32DB::writeHltDataToSchema2().

166  {
167  coral::AttributeList hltrundata;
168  hltrundata.extend("DATA_ID",typeid(unsigned long long));
169  hltrundata.extend("ENTRY_ID",typeid(unsigned long long));
170  hltrundata.extend("ENTRY_NAME",typeid(std::string));
171  hltrundata.extend("RUNNUM",typeid(unsigned int));
172  hltrundata.extend("SOURCE",typeid(std::string));
173  hltrundata.extend("NPATH",typeid(unsigned int));
174  hltrundata.extend("PATHNAMECLOB",typeid(std::string));
175  hltrundata["DATA_ID"].data<unsigned long long>()=hltentry.data_id;
176  hltrundata["ENTRY_ID"].data<unsigned long long>()=hltentry.entry_id;
177  hltrundata["ENTRY_NAME"].data<std::string>()=hltentry.entry_name;
178  hltrundata["RUNNUM"].data<unsigned int>()=hltentry.runnumber;
179  hltrundata["SOURCE"].data<std::string>()=hltentry.source;
180  hltrundata["NPATH"].data<unsigned int>()=hltentry.npath;
181  hltrundata["PATHNAMECLOB"].data<std::string>()=hltentry.pathnames;
183  schema.tableHandle(hltdataTableName).dataEditor().insertRow(hltrundata);
184 }
list hltrundata
Definition: dataDML.py:2363
static const std::string hltdataTableName()
Definition: LumiNames.cc:56
def hltdataTableName
Definition: nameDealer.py:58
void lumi::RevisionDML::insertLumiRunData ( coral::ISchema &  schema,
const LumiEntry lumientry 
)

Definition at line 123 of file RevisionDML.cc.

References lumi::RevisionDML::LumiEntry::bgev, lumi::RevisionDML::Entry::data_id, lumi::RevisionDML::Entry::entry_id, lumi::RevisionDML::Entry::entry_name, nameDealer::lumidataTableName(), lumi::LumiNames::lumidataTableName(), dataDML::lumirundata, lumi::RevisionDML::LumiEntry::ncollidingbunches, lumi::RevisionDML::LumiEntry::runnumber, and lumi::RevisionDML::LumiEntry::source.

Referenced by lumi::Lumi2DB::writeAllLumiDataToSchema2().

124  {
125  coral::AttributeList lumirundata;
126  lumirundata.extend("DATA_ID",typeid(unsigned long long));
127  lumirundata.extend("ENTRY_ID",typeid(unsigned long long));
128  lumirundata.extend("ENTRY_NAME",typeid(std::string));
129  lumirundata.extend("RUNNUM",typeid(unsigned int));
130  lumirundata.extend("SOURCE",typeid(std::string));
131  lumirundata.extend("NOMINALEGEV",typeid(float));
132  lumirundata.extend("NCOLLIDINGBUNCHES",typeid(unsigned int));
133  lumirundata["DATA_ID"].data<unsigned long long>()=lumientry.data_id;
134  lumirundata["ENTRY_ID"].data<unsigned long long>()=lumientry.entry_id;
135  lumirundata["ENTRY_NAME"].data<std::string>()=lumientry.entry_name;
136  lumirundata["RUNNUM"].data<unsigned int>()=lumientry.runnumber;
137  lumirundata["SOURCE"].data<std::string>()=lumientry.source;
138  lumirundata["NOMINALEGEV"].data<float>()=lumientry.bgev;
139  lumirundata["NCOLLIDINGBUNCHES"].data<unsigned int>()=lumientry.ncollidingbunches;
141  schema.tableHandle(lumidataTableName).dataEditor().insertRow(lumirundata);
142 }
list lumirundata
Definition: dataDML.py:2353
def lumidataTableName
Definition: nameDealer.py:19
static const std::string lumidataTableName()
Definition: LumiNames.cc:41
void lumi::RevisionDML::insertTrgRunData ( coral::ISchema &  schema,
const TrgEntry trgentry 
)

Definition at line 144 of file RevisionDML.cc.

References lumi::RevisionDML::TrgEntry::bitnames, lumi::RevisionDML::TrgEntry::bitzeroname, lumi::RevisionDML::Entry::data_id, lumi::RevisionDML::Entry::entry_id, lumi::RevisionDML::Entry::entry_name, lumi::RevisionDML::TrgEntry::runnumber, lumi::RevisionDML::TrgEntry::source, lumi::LumiNames::trgdataTableName(), nameDealer::trgdataTableName(), and dataDML::trgrundata.

Referenced by lumi::TRGScalers2DB::writeTrgDataToSchema2().

145  {
146  coral::AttributeList trgrundata;
147  trgrundata.extend("DATA_ID",typeid(unsigned long long));
148  trgrundata.extend("ENTRY_ID",typeid(unsigned long long));
149  trgrundata.extend("ENTRY_NAME",typeid(std::string));
150  trgrundata.extend("RUNNUM",typeid(unsigned int));
151  trgrundata.extend("SOURCE",typeid(std::string));
152  trgrundata.extend("BITZERONAME",typeid(std::string));
153  trgrundata.extend("BITNAMECLOB",typeid(std::string));
154  trgrundata["DATA_ID"].data<unsigned long long>()=trgentry.data_id;
155  trgrundata["ENTRY_ID"].data<unsigned long long>()=trgentry.entry_id;
156  trgrundata["ENTRY_NAME"].data<std::string>()=trgentry.entry_name;
157  trgrundata["RUNNUM"].data<unsigned int>()=trgentry.runnumber;
158  trgrundata["SOURCE"].data<std::string>()=trgentry.source;
159  trgrundata["BITZERONAME"].data<std::string>()=trgentry.bitzeroname;
160  trgrundata["BITNAMECLOB"].data<std::string>()=trgentry.bitnames;
162  schema.tableHandle(trgdataTableName).dataEditor().insertRow(trgrundata);
163 }
static const std::string trgdataTableName()
Definition: LumiNames.cc:50
def trgdataTableName
Definition: nameDealer.py:46
list trgrundata
Definition: dataDML.py:2358