27 {
28
29 msg() <<
"PrioritySetLoader started loading data via MasterID = " << psTarget.lvl1MasterTableId() << std::endl;
30 try {
31
33
34 coral::IQuery* Query =
m_session.nominalSchema().newQuery();
35
36
37 Query->addToTableList ( "L1_TRIGGER_ITEM", "TI" );
38 Query->addToTableList ( "L1_TM_TO_TI", "TMTI");
39 Query->addToTableList ( "L1_MASTER_TABLE", "MT" );
40
41
42 coral::AttributeList bindList;
43 bindList.extend<int>("mtId");
44 bindList[0].data<int>() = psTarget.lvl1MasterTableId();
45 std::string theCondition = "";
46 theCondition += std::string( " MT.L1MT_ID = :mtId" );
47 theCondition += std::string( " AND MT.L1MT_TRIGGER_MENU_ID = TMTI.L1TM2TI_TRIGGER_MENU_ID" );
48 theCondition += std::string( " AND TMTI.L1TM2TI_TRIGGER_ITEM_ID = TI.L1TI_ID" );
49 Query->setCondition( theCondition, bindList );
50
51
52 coral::AttributeList attList;
53 attList.extend<long>( "TI.L1TI_CTP_ID" );
54 attList.extend<std::string>( "TI.L1TI_PRIORITY" );
55 Query->defineOutput(attList);
56 Query->addToOutputList( "TI.L1TI_CTP_ID" );
57 Query->addToOutputList( "TI.L1TI_PRIORITY" );
58
59
60 std::string theOrder = "";
61 theOrder += " TI.L1TI_CTP_ID";
62
63 Query->addToOrderList( theOrder );
64
65
66 coral::ICursor& Cursor = Query->execute();
68 while (Cursor.next()) {
69 const coral::AttributeList&
row = Cursor.currentRow();
71 row.toOutputStream(
msg() ) << std::endl;
72 long ctp_id =
row[
"TI.L1TI_CTP_ID"].data<
long>();
73 prio.at(ctp_id) =
row[
"TI.L1TI_PRIORITY"].data<std::string>();
74 }
75 psTarget.setPriorities( prio );
76 delete Query;
78 return true;
79 } catch (const coral::SchemaException& e) {
80 msg() <<
"PrioritySetLoader >> SchemaException: "
81 <<
e.what() << std::endl;
83 return false;
84 } catch (const std::exception& e) {
85 msg() <<
"PrioritySetLoader >> Standard C++ exception: " <<
e.what() << std::endl;
87 return false;
88 } catch (...) {
89 msg() <<
"PrioritySetLoader >> unknown C++ exception" << std::endl;
91 return false;
92
93 }
94
95}
virtual int verbose() const override
void commitSession()
commit session if not already done
void startSession()
start session if not already active
static const unsigned int N_PRIORITIES
MsgStreamTC & msg() const
The standard message stream.
row
Appending html table to final .html summary file.