20 #include <CoralBase/Attribute.h>
21 #include <CoralBase/AttributeList.h>
23 #include "RelationalAccess/SchemaException.h"
24 #include "RelationalAccess/ITransaction.h"
25 #include "RelationalAccess/ITable.h"
26 #include "RelationalAccess/ICursor.h"
27 #include "RelationalAccess/IQuery.h"
28 #include "RelationalAccess/ISchema.h"
29 #include "RelationalAccess/ITableDescription.h"
41 msg() <<
"MuctpiLoader: Loading MuCTPi with ID = " << mTarget.
id() <<
" and Lvl1 masterId = " << mTarget.
lvl1MasterTableId() << std::endl;
48 std::unique_ptr<coral::IQuery> query0(
m_session.nominalSchema().tableHandle(
"L1_MASTER_TABLE").newQuery());
49 query0->setRowCacheSize( 5 );
53 bindList.extend<
long>(
"mtId");
54 std::string cond =
"L1MT_ID = :mtId";
56 query0->setCondition( cond, bindList );
60 attList.extend<
long>(
"L1MT_MUCTPI_INFO_ID" );
61 query0->defineOutput(attList);
62 query0->addToOutputList(
"L1MT_MUCTPI_INFO_ID" );
64 coral::ICursor& cursor0 = query0->execute();
66 if ( ! cursor0.next() ) {
67 msg() <<
"MuctpiLoader >> No such Master_Table exists " << mTarget.
lvl1MasterTableId() << std::endl;
69 throw std::runtime_error(
"MuctpiLoader >> Muctpi_Info not available" );
73 muctpi_id = row0[
"L1MT_MUCTPI_INFO_ID"].data<
long>();
75 if ( cursor0.next() ) {
76 msg() <<
"MuctpiLoader >> More than one Muctpi_Info exists for this master_table id"
79 throw std::runtime_error(
"MuctpiLoader >> Muctpi_Info not available" );
81 mTarget.
setId(muctpi_id);
84 std::unique_ptr<coral::IQuery>
query(
m_session.nominalSchema().tableHandle(
"L1_MUCTPI_INFO").newQuery());
85 query->setRowCacheSize( 5 );
89 bindList2.extend<
long>(
"miId");
90 std::string cond2 =
"L1MI_ID = :miId";
91 bindList2[0].data<
long>() = mTarget.
id();
92 query->setCondition( cond2, bindList2 );
96 attList.extend<
int>(
"L1MI_VERSION" );
97 attList.extend<std::string>(
"L1MI_NAME" );
98 attList.extend<
int>(
"L1MI_LOW_PT" );
99 attList.extend<
int>(
"L1MI_HIGH_PT" );
100 attList.extend<
int>(
"L1MI_MAX_CAND" );
101 attList.extend<
long>(
"L1MI_ID" );
102 query->defineOutput(attList);
104 query->addToOutputList(
"L1MI_VERSION" );
105 query->addToOutputList(
"L1MI_NAME" );
106 query->addToOutputList(
"L1MI_LOW_PT" );
107 query->addToOutputList(
"L1MI_HIGH_PT" );
108 query->addToOutputList(
"L1MI_MAX_CAND" );
109 query->addToOutputList(
"L1MI_ID" );
110 query->addToOrderList(
"L1MI_ID" );
114 msg() <<
"MuctpiLoader >> No such Muctpi_info exists " << mTarget.
id() << std::endl;
116 throw std::runtime_error(
"MuctpiLoader >> Muctpi not available" );
120 std::string
name =
row[
"L1MI_NAME"].data<std::string>();
121 int version =
row[
"L1MI_VERSION"].data<
int>();
122 int low_pt =
row[
"L1MI_LOW_PT"].data<
int>();
123 int high_pt =
row[
"L1MI_HIGH_PT"].data<
int>();
124 int max_cand =
row[
"L1MI_MAX_CAND"].data<
int>();
127 msg() <<
"MuctpiLoader >> More than one Muctpi exists " << mTarget.
id() << std::endl;
129 throw std::runtime_error(
"MuctpiLoader >> Muctpi not available" );
141 }
catch(
const coral::SchemaException&
e ) {
142 msg() <<
"MuctpiLoader >> SchemaException: " <<
e.what() << std::endl;
146 msg() <<
"MuctpiLoader >> Standard C++ exception: " <<
e.what() << std::endl;
151 msg() <<
"MuctpiLoader >> unknown C++ exception" << std::endl;