26 coral::ITable& table =
m_session.nominalSchema().tableHandle(
"SUPER_MASTER_TABLE");
27 coral::IQuery*
query = table.newQuery();
28 query->setRowCacheSize( 5 );
31 coral::AttributeList bindList;
32 bindList.extend<
int>(
"smtid");
33 bindList[0].data<
int>() = SuperMasterKey;
34 query->setCondition(
"SMT_ID = :smtid" , bindList );
37 coral::AttributeList attList;
38 attList.extend<
int>(
"SMT_L1_MASTER_TABLE_ID" );
39 attList.extend<std::string>(
"SMT_NAME" );
40 query->defineOutput(attList);
41 query->addToOutputList(
"SMT_L1_MASTER_TABLE_ID" );
42 query->addToOutputList(
"SMT_NAME" );
44 coral::ICursor& cursor =
query->execute();
46 if ( ! cursor.next() ) {
47 msg() <<
"MasterTableLoader >> No such SuperMaster key exists " << SuperMasterKey << std::endl;
50 throw std::runtime_error(
"MasterTableLoader >> SuperMasterKey not available" );
53 const coral::AttributeList& row = cursor.currentRow();
54 Lvl1MasterKey = row[
"SMT_L1_MASTER_TABLE_ID"].data<
int>();
55 menuName = row[
"SMT_NAME"].data<std::string>();
60 catch(
const coral::SchemaException& e ) {
61 msg() <<
"BunchGroupLoader >> SchemaException: " << e.what() << std::endl;
64 }
catch(
const std::exception& e ) {
65 msg() <<
"BunchGroupLoader >> Standard C++ exception: " << e.what() << std::endl;
69 msg() <<
"BunchGroupLoader >> Unknown C++ exception" << std::endl;
145 if ( !m.lvl1MasterTableId() ) {
146 int SuperMasterKey = m.superMasterTableId();
147 if(SuperMasterKey==0) {
148 msg() <<
"MasterTableLoader: Error loading Muctpi since no L1MasterKey nor a SMK is specified" << std::endl;
151 int Lvl1MasterKey(0);
152 std::string menuName{
""};
154 m.setLvl1MasterTableId(Lvl1MasterKey);
159 return muctpiLoader.
load(m);
160 }
catch (std::bad_cast& ex) {
161 msg() <<
"Caught exception in MasterTableLoader : "
162 << ex.what() << std::endl;
183 msg() <<
"MasterTableLoader loading mt_id for next run " << std::endl;
187 if ( !
m_session.transaction().isActive() )
190 coral::AttributeList emptyBindVariableList0;
191 coral::ITable& table0 =
m_session.nominalSchema().tableHandle(
"TRIGGER_NEXT_RUN");
192 coral::IQuery* query0 = table0.newQuery();
193 query0->setRowCacheSize( 5 );
195 std::string whereclause0=
"TNR_ID = 1";
197 query0->setCondition( whereclause0, emptyBindVariableList0 );
199 query0->addToOutputList(
"TNR_SUPER_MASTER_TABLE_ID" );
201 coral::ICursor& cursor0 = query0->execute();
203 if ( ! cursor0.next() ) {
204 msg() <<
"MasterTableLoader >> No Entry in NEXT_RUN Table " << std::endl;
207 throw std::runtime_error(
"MasterTableLoader >> no entry in NEXT_RUN table" );
210 const coral::AttributeList& row0 = cursor0.currentRow();
211 int supermastertableid = 0;
212 supermastertableid = row0[
"TNR_SUPER_MASTER_TABLE_ID"].data<
int>();
214 if ( cursor0.next() ) {
215 msg() <<
"MasterTableLoader >> More than one entry in NEXT_RUNtable" << std::endl;
218 throw std::runtime_error(
"MasterTableLoader >> More than one entry in NEXT_RUNtable" );
223 msg() <<
"MasterTableLoader>> getting data for super_mt_id = " << supermastertableid << std::endl;
225 coral::ITable& table =
m_session.nominalSchema().tableHandle(
"SUPER_MASTER_TABLE");
227 unique_ptr< coral::IQuery >
query( table.newQuery() );
228 query->setRowCacheSize( 5 );
229 coral::AttributeList emptyBindVariableList;
231 std::string os=
"SMT_ID = ";
232 std::ostringstream lStringOS;
233 lStringOS << supermastertableid;
234 os += lStringOS.str();
236 query->setCondition( os , emptyBindVariableList );
238 query->addToOutputList(
"SMT_L1_MASTER_TABLE_ID" );
240 coral::ICursor& cursor =
query->execute();
242 if ( ! cursor.next() ) {
243 msg() <<
"MasterTableLoader >> No such Super_Master_table exists " << supermastertableid << std::endl;
246 throw std::runtime_error(
"MasterTableLoader >> No such Super_Master_table exists " );
249 const coral::AttributeList& row = cursor.currentRow();
251 mt_id = row[
"SMT_L1_MASTER_TABLE_ID"].data<
int>();
253 if ( cursor.next() ) {
254 msg() <<
"MasterTableLoader >> More than one Super_Master_table exists "
255 << supermastertableid << std::endl;
256 throw std::runtime_error(
"MasterTableLoader >> More than one Super_Master_table exists " );
261 catch(
const coral::SchemaException& e )
263 msg() <<
"CTPConfigLoader >> SchemaException: "
264 << e.what() << std::endl;
268 catch(
const std::exception& e )
270 msg() <<
"CTPConfigLoader >> Standard C++ exception: " << e.what() << std::endl;
276 msg() <<
"CTPConfigLoader >> unknown C++ exception" << std::endl;