#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) |
Definition at line 9 of file RevisionDML.h.
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, nameDealer::entryTableName(), lumi::LumiNames::entryTableName(), cmsPerfSuiteHarvest::now, lumi::RevisionDML::Entry::revision_id, nameDealer::revisionTableName(), and nameDealer::revmapTableName().
Referenced by lumi::Lumi2DB::writeAllLumiDataToSchema2(), lumi::HLTV32DB::writeHltDataToSchema2(), and lumi::TRGScalers2DB::writeTrgDataToSchema2().
{ coral::AttributeList revdata; revdata.extend("REVISION_ID",typeid(unsigned long long)); revdata.extend("BRANCH_ID",typeid(unsigned long long)); revdata.extend("BRANCH_NAME",typeid(std::string)); revdata.extend("CTIME",typeid(coral::TimeStamp)); revdata["REVISION_ID"].data<unsigned long long>()=entry.revision_id; revdata["BRANCH_ID"].data<unsigned long long>()=branchid; revdata["BRANCH_NAME"].data<std::string>()=branchname; revdata["CTIME"].data<coral::TimeStamp>()=coral::TimeStamp::now(); const std::string revTableName=lumi::LumiNames::revisionTableName(); schema.tableHandle(revTableName).dataEditor().insertRow(revdata); coral::AttributeList entrydata; entrydata.extend("REVISION_ID",typeid(unsigned long long)); entrydata.extend("ENTRY_ID",typeid(unsigned long long)); entrydata.extend("NAME",typeid(std::string)); entrydata["REVISION_ID"].data<unsigned long long>()=entry.revision_id; entrydata["ENTRY_ID"].data<unsigned long long>()=entry.entry_id; entrydata["NAME"].data<std::string>()=entry.entry_name; const std::string entryTableName=lumi::LumiNames::entryTableName(datatableName); schema.tableHandle(entryTableName).dataEditor().insertRow(entrydata); coral::AttributeList revmapdata; revmapdata.extend("REVISION_ID",typeid(unsigned long long)); revmapdata.extend("DATA_ID",typeid(unsigned long long)); revmapdata["REVISION_ID"].data<unsigned long long>()=entry.revision_id; revmapdata["DATA_ID"].data<unsigned long long>()=entry.data_id; const std::string revmapTableName=lumi::LumiNames::revmapTableName(datatableName); schema.tableHandle(revmapTableName).dataEditor().insertRow(revmapdata); }
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(), and nameDealer::revmapTableName().
Referenced by lumi::Lumi2DB::writeAllLumiDataToSchema2(), lumi::HLTV32DB::writeHltDataToSchema2(), and lumi::TRGScalers2DB::writeTrgDataToSchema2().
{ coral::AttributeList revdata; revdata.extend("REVISION_ID",typeid(unsigned long long)); revdata.extend("BRANCH_ID",typeid(unsigned long long)); revdata.extend("BRANCH_NAME",typeid(std::string)); revdata.extend("CTIME",typeid(coral::TimeStamp)); revdata["REVISION_ID"].data<unsigned long long>()=revision.revision_id; revdata["BRANCH_ID"].data<unsigned long long>()=branchid; revdata["BRANCH_NAME"].data<std::string>()=branchname; revdata["CTIME"].data<coral::TimeStamp>()=coral::TimeStamp::now(); schema.tableHandle(lumi::LumiNames::revisionTableName()).dataEditor().insertRow(revdata); coral::AttributeList revmapdata; revmapdata.extend("REVISION_ID",typeid(unsigned long long)); revmapdata.extend("DATA_ID",typeid(unsigned long long)); revmapdata["REVISION_ID"].data<unsigned long long>()=revision.revision_id; revmapdata["DATA_ID"].data<unsigned long long>()=revision.data_id; const std::string revmapTableName=lumi::LumiNames::revmapTableName(datatableName); schema.tableHandle(revmapTableName).dataEditor().insertRow(revmapdata); }
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, nameDealer::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().
{ lumi::idDealer idg(schema); const std::string entrytableName=lumi::LumiNames::entryTableName(datatableName); entry.revision_id=idg.generateNextIDForTable(lumi::LumiNames::revisionTableName()); entry.data_id=idg.generateNextIDForTable(datatableName); entry.entry_id=idg.generateNextIDForTable(entrytableName); }
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().
{ lumi::idDealer idg(schema); revision.revision_id=idg.generateNextIDForTable(lumi::LumiNames::revisionTableName()); revision.data_id=idg.generateNextIDForTable(datatableName); }
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().
{ unsigned long long entry_id=0; coral::IQuery* qHandle=schema.newQuery(); qHandle->addToTableList( lumi::LumiNames::entryTableName(datatableName),"e"); qHandle->addToTableList( lumi::LumiNames::revisionTableName(),"r"); qHandle->addToOutputList("e.ENTRY_ID","entry_id"); coral::AttributeList qCondition; qCondition.extend("entryname",typeid(std::string)); qCondition.extend("branchname",typeid(std::string)); qCondition["entryname"].data<std::string>()=entryname; qCondition["branchname"].data<std::string>()=branchname; std::string qConditionStr("r.REVISION_ID=e.REVISION_ID and e.NAME=:entryname AND r.BRANCH_NAME=:branchname"); coral::AttributeList qResult; qResult.extend("entry_id",typeid(unsigned long long)); qHandle->defineOutput(qResult); qHandle->setCondition(qConditionStr,qCondition); coral::ICursor& cursor=qHandle->execute(); while(cursor.next()){ entry_id=cursor.currentRow()["entry_id"].data<unsigned long long>(); } delete qHandle; return entry_id; }
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().
{ coral::AttributeList hltrundata; hltrundata.extend("DATA_ID",typeid(unsigned long long)); hltrundata.extend("ENTRY_ID",typeid(unsigned long long)); hltrundata.extend("ENTRY_NAME",typeid(std::string)); hltrundata.extend("RUNNUM",typeid(unsigned int)); hltrundata.extend("SOURCE",typeid(std::string)); hltrundata.extend("NPATH",typeid(unsigned int)); hltrundata.extend("PATHNAMECLOB",typeid(std::string)); hltrundata["DATA_ID"].data<unsigned long long>()=hltentry.data_id; hltrundata["ENTRY_ID"].data<unsigned long long>()=hltentry.entry_id; hltrundata["ENTRY_NAME"].data<std::string>()=hltentry.entry_name; hltrundata["RUNNUM"].data<unsigned int>()=hltentry.runnumber; hltrundata["SOURCE"].data<std::string>()=hltentry.source; hltrundata["NPATH"].data<unsigned int>()=hltentry.npath; hltrundata["PATHNAMECLOB"].data<std::string>()=hltentry.pathnames; const std::string hltdataTableName=lumi::LumiNames::hltdataTableName(); schema.tableHandle(hltdataTableName).dataEditor().insertRow(hltrundata); }
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, lumi::LumiNames::lumidataTableName(), nameDealer::lumidataTableName(), dataDML::lumirundata, lumi::RevisionDML::LumiEntry::ncollidingbunches, lumi::RevisionDML::LumiEntry::runnumber, and lumi::RevisionDML::LumiEntry::source.
Referenced by lumi::Lumi2DB::writeAllLumiDataToSchema2().
{ coral::AttributeList lumirundata; lumirundata.extend("DATA_ID",typeid(unsigned long long)); lumirundata.extend("ENTRY_ID",typeid(unsigned long long)); lumirundata.extend("ENTRY_NAME",typeid(std::string)); lumirundata.extend("RUNNUM",typeid(unsigned int)); lumirundata.extend("SOURCE",typeid(std::string)); lumirundata.extend("NOMINALEGEV",typeid(float)); lumirundata.extend("NCOLLIDINGBUNCHES",typeid(unsigned int)); lumirundata["DATA_ID"].data<unsigned long long>()=lumientry.data_id; lumirundata["ENTRY_ID"].data<unsigned long long>()=lumientry.entry_id; lumirundata["ENTRY_NAME"].data<std::string>()=lumientry.entry_name; lumirundata["RUNNUM"].data<unsigned int>()=lumientry.runnumber; lumirundata["SOURCE"].data<std::string>()=lumientry.source; lumirundata["NOMINALEGEV"].data<float>()=lumientry.bgev; lumirundata["NCOLLIDINGBUNCHES"].data<unsigned int>()=lumientry.ncollidingbunches; const std::string lumidataTableName=lumi::LumiNames::lumidataTableName(); schema.tableHandle(lumidataTableName).dataEditor().insertRow(lumirundata); }
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, nameDealer::trgdataTableName(), lumi::LumiNames::trgdataTableName(), and dataDML::trgrundata.
Referenced by lumi::TRGScalers2DB::writeTrgDataToSchema2().
{ coral::AttributeList trgrundata; trgrundata.extend("DATA_ID",typeid(unsigned long long)); trgrundata.extend("ENTRY_ID",typeid(unsigned long long)); trgrundata.extend("ENTRY_NAME",typeid(std::string)); trgrundata.extend("RUNNUM",typeid(unsigned int)); trgrundata.extend("SOURCE",typeid(std::string)); trgrundata.extend("BITZERONAME",typeid(std::string)); trgrundata.extend("BITNAMECLOB",typeid(std::string)); trgrundata["DATA_ID"].data<unsigned long long>()=trgentry.data_id; trgrundata["ENTRY_ID"].data<unsigned long long>()=trgentry.entry_id; trgrundata["ENTRY_NAME"].data<std::string>()=trgentry.entry_name; trgrundata["RUNNUM"].data<unsigned int>()=trgentry.runnumber; trgrundata["SOURCE"].data<std::string>()=trgentry.source; trgrundata["BITZERONAME"].data<std::string>()=trgentry.bitzeroname; trgrundata["BITNAMECLOB"].data<std::string>()=trgentry.bitnames; const std::string trgdataTableName=lumi::LumiNames::trgdataTableName(); schema.tableHandle(trgdataTableName).dataEditor().insertRow(trgrundata); }