select paths.name,stringparamvalues.value from stringparamvalues,paths,parameters,superidparameterassoc,modules,moduletemplates,pathmoduleassoc,configurationpathassoc,configurations where parameters.paramid=stringparamvalues.paramid and superidparameterassoc.paramid=parameters.paramid and modules.superid=superidparameterassoc.superid and moduletemplates.superid=modules.templateid and pathmoduleassoc.moduleid=modules.superid and paths.pathid=pathmoduleassoc.pathid and configurationpathassoc.pathid=paths.pathid and configurations.configid=configurationpathassoc.configid and moduletemplates.name='HLTLevel1GTSeed' and parameters.name='L1SeedsLogicalExpression' and configurations.configid=1905;
47 std::string runsessiontable(
"RUNSESSION_PARAMETER");
50 coral::ConnectionService*
svc=
new coral::ConnectionService;
56 coral::ISessionProxy* srcsession=svc->connect(
m_source, coral::ReadOnly);
57 coral::ITypeConverter& tpc=srcsession->typeConverter();
58 tpc.setCppTypeForSqlType(
"unsigned int",
"NUMBER(38)");
63 std::vector< std::pair<std::string,std::string> > hlt2l1map;
64 hlt2l1map.reserve(200);
66 srcsession->transaction().start(
true);
67 coral::ISchema& runinfoSchemaHandle=srcsession->schema(runinfoschema);
68 if( !runinfoSchemaHandle.existsTable(runsessiontable) ){
69 throw lumi::Exception(
"missing runsession table",
"retrieveData",
"HLTConf2DB");
71 coral::AttributeList rfBindVariableList;
72 rfBindVariableList.extend(
"name",
typeid(
std::string));
73 rfBindVariableList.extend(
"runnumber",
typeid(
unsigned int));
75 rfBindVariableList[
"runnumber"].data<
unsigned int>()=
runnumber;
76 coral::IQuery* kq=runinfoSchemaHandle.newQuery();
77 coral::AttributeList runinfoOut;
78 runinfoOut.extend(
"STRING_VALUE",
typeid(
std::string));
79 kq->addToTableList(runsessiontable);
80 kq->setCondition(
"NAME = :name AND RUNNUMBER = :runnumber",rfBindVariableList);
81 kq->addToOutputList(
"STRING_VALUE");
82 kq->defineOutput(runinfoOut);
83 coral::ICursor& kcursor=kq->execute();
85 while( kcursor.next() ){
86 const coral::AttributeList& row=kcursor.currentRow();
90 if( s==0||
hltkey.empty() ){
93 srcsession->transaction().rollback();
99 srcsession->transaction().rollback();
103 std::cout<<
"source runinfo database problem "<<er.what()<<std::endl;
104 srcsession->transaction().rollback();
109 coral::ISchema& confSchemaHandle=srcsession->nominalSchema();
112 if( !confSchemaHandle.existsTable(
"PATHS") || !confSchemaHandle.existsTable(
"STRINGPARAMVALUES") || !confSchemaHandle.existsTable(
"PARAMETERS") || !confSchemaHandle.existsTable(
"SUPERIDPARAMETERASSOC") || !confSchemaHandle.existsTable(
"MODULES") || !confSchemaHandle.existsTable(
"MODULETEMPLATES") || !confSchemaHandle.existsTable(
"PATHMODULEASSOC") || !confSchemaHandle.existsTable(
"CONFIGURATIONPATHASSOC") || !confSchemaHandle.existsTable(
"CONFIGURATIONS") ){
113 throw lumi::Exception(
"missing hlt conf tables" ,
"retrieveData",
"HLTConf2DB");
115 coral::AttributeList q1BindVariableList;
116 q1BindVariableList.extend(
"hltseed",
typeid(
std::string));
117 q1BindVariableList.extend(
"l1seedexpr",
typeid(
std::string));
118 q1BindVariableList.extend(
"hltkey",
typeid(
std::string));
122 coral::IQuery*
q1=confSchemaHandle.newQuery();
123 q1->addToOutputList(
"PATHS.NAME",
"hltpath");
124 q1->addToOutputList(
"STRINGPARAMVALUES.VALUE",
"l1expression");
126 q1->addToTableList(
"PATHS");
127 q1->addToTableList(
"STRINGPARAMVALUES");
128 q1->addToTableList(
"PARAMETERS");
129 q1->addToTableList(
"SUPERIDPARAMETERASSOC");
130 q1->addToTableList(
"MODULES");
131 q1->addToTableList(
"MODULETEMPLATES");
132 q1->addToTableList(
"PATHMODULEASSOC");
133 q1->addToTableList(
"CONFIGURATIONPATHASSOC");
134 q1->addToTableList(
"CONFIGURATIONS");
136 q1->setCondition(
"PARAMETERS.PARAMID=STRINGPARAMVALUES.PARAMID and SUPERIDPARAMETERASSOC.PARAMID=PARAMETERS.PARAMID and MODULES.SUPERID=SUPERIDPARAMETERASSOC.SUPERID and MODULETEMPLATES.SUPERID=MODULES.TEMPLATEID and PATHMODULEASSOC.MODULEID=MODULES.SUPERID and PATHS.PATHID=PATHMODULEASSOC.PATHID and CONFIGURATIONPATHASSOC.PATHID=PATHS.PATHID and CONFIGURATIONS.CONFIGID=CONFIGURATIONPATHASSOC.CONFIGID and MODULETEMPLATES.NAME = :hltseed and PARAMETERS.NAME = :l1seedexpr and CONFIGURATIONS.CONFIGDESCRIPTOR = :hltkey",q1BindVariableList);
141 coral::ICursor& cursor1=q1->execute();
142 while( cursor1.next() ){
143 const coral::AttributeList& row=cursor1.currentRow();
146 hlt2l1map.push_back(std::make_pair(hltpath,l1expression));
151 std::cout<<
"database problem with source hlt confdb"<<er.what()<<std::endl;
152 srcsession->transaction().rollback();
156 srcsession->transaction().commit();
158 std::vector< std::pair<std::string,std::string> >::const_iterator mIt;
159 std::vector< std::pair<std::string,std::string> >::const_iterator mBeg=hlt2l1map.begin();
160 std::vector< std::pair<std::string,std::string> >::const_iterator mEnd=hlt2l1map.end();
162 coral::ISessionProxy* destsession=svc->connect(
m_dest, coral::Update);
165 destsession->transaction().start(
true);
166 bool hltkeyExists=
false;
167 coral::AttributeList kQueryBindList;
168 kQueryBindList.extend(
"hltkey",
typeid(
std::string));
170 kQuery->setCondition(
"HLTKEY =:hltkey",kQueryBindList);
172 coral::ICursor& kResult=kQuery->execute();
173 while( kResult.next() ){
177 std::cout<<
"hltkey "<<
hltkey<<
" already registered , do nothing"<<std::endl;
178 destsession->transaction().commit();
183 destsession->transaction().commit();
184 destsession->transaction().start(
false);
185 coral::ISchema& destschema=destsession->nominalSchema();
187 coral::AttributeList hltconfData;
191 coral::IBulkOperation* hltconfInserter=hltconftable.dataEditor().bulkInsert(hltconfData,200);
195 for(mIt=mBeg; mIt!=mEnd; ++mIt ){
196 hltpathname=mIt->first;
197 l1seedname=mIt->second;
198 hltconfInserter->processNextIteration();
201 hltconfInserter->flush();
202 delete hltconfInserter;
203 destsession->transaction().commit();
205 std::cout<<
"database problem "<<er.what()<<std::endl;
206 destsession->transaction().rollback();
static const std::string trghltMapTableName()