1 #ifndef CondTools_L1Trigger_OMDSReader_h
2 #define CondTools_L1Trigger_OMDSReader_h
27 #include "RelationalAccess/IQuery.h"
28 #include "CoralBase/AttributeList.h"
29 #include "CoralBase/AttributeSpecification.h"
30 #include "CoralBase/Attribute.h"
32 #include "RelationalAccess/ITable.h"
33 #include "RelationalAccess/IView.h"
34 #include "RelationalAccess/ISchema.h"
35 #include "RelationalAccess/ISessionProxy.h"
36 #include "RelationalAccess/ICursor.h"
201 coral::ISchema& schema = schemaName.empty() ? coralSession.nominalSchema() : coralSession.schema(schemaName);
206 std::shared_ptr<coral::IQuery>
query(
table.newQuery());
209 std::vector<std::string>::const_iterator it =
columnNames.begin();
211 for (; it !=
end; ++it) {
212 query->addToOutputList(*it);
216 if (!conditionLHS.empty() && conditionRHS.
numberRows() == 1) {
217 if (!conditionRHSName.empty()) {
219 coral::AttributeList attList;
220 attList.extend(conditionRHSName,
typeid(
T));
223 attList[conditionRHSName].data<
T>() =
tmp;
225 query->setCondition(conditionLHS +
" = :" + conditionRHSName, attList);
229 query->setCondition(conditionLHS +
" = :" + conditionRHS.
columnNames().front(),
234 coral::ICursor& cursor =
query->execute();
238 std::vector<coral::AttributeList> atts;
239 while (cursor.next()) {
240 atts.push_back(cursor.currentRow());
255 return basicQueryGenericKey<T>(
columnNames, schemaName,
tableName, conditionLHS, conditionRHS, conditionRHSName);
260 std::vector<std::string>
names;
261 names.push_back(
"dummy");
263 coral::AttributeList attList;
264 attList.extend(
"dummy",
typeid(
T));
265 attList[
"dummy"].data<
T>() =
data;
267 std::vector<coral::AttributeList> atts;
268 atts.push_back(attList);
281 T& outputVariable)
const {
283 if (rowNumber < 0 || rowNumber >= numberRows())
285 const coral::AttributeList& row = m_attributeLists[rowNumber];
286 if (row[columnName].isNull())
288 outputVariable = row[columnName].template data<T>();
294 return fillVariableFromRow(0, outputVariable);
300 if (rowNumber < 0 || rowNumber >= numberRows() || m_columnNames.size() != 1)
302 const coral::AttributeList& row = m_attributeLists[rowNumber];
303 if (row[m_columnNames.front()].isNull())
305 outputVariable = row[m_columnNames.front()].template data<T>();