6#include <CoralBase/Attribute.h>
7#include <CoralBase/AttributeList.h>
15 DBLoader(
"MCKLoader", sm, sm.sessionMgr().createSession())
22 unique_ptr< coral::IQuery > q;
27 unique_ptr< coral::IQuery > qtmp(
m_session.nominalSchema().tableHandle(
"MCK_TO_SMK_LINK").newQuery() );
30 catch(coral::TableNotExistingException & ex) {
35 std::string theCondition =
"SMK_LINK_SMK = :smId";
36 theCondition += string(
" AND SMK_LINK_ACTIVE_MCK = 1" );
38 coral::AttributeList bindings;
39 bindings.extend<
int>(
"smId");
40 bindings[0].data<
int>() = smk;
42 q->setCondition( theCondition, bindings );
44 coral::AttributeList attList;
45 attList.extend<
int>(
"SMK_LINK_MCK" );
49 coral::ICursor& cursor = q->execute();
52 while (cursor.next()) {
54 const coral::AttributeList& row = cursor.currentRow();
55 mck = row[
"SMK_LINK_MCK"].data<
int>();
60 TRG_MSG_ERROR(
"Found more than one active MCKs for SMK " << smk);
61 }
else if(nFound==1) {
62 TRG_MSG_INFO(
"Found active MCK " << mck <<
" for SMK " << smk);
81 unique_ptr< coral::IQuery > q;
84 unique_ptr< coral::IQuery > qtmp(
m_session.nominalSchema().tableHandle(
"MCK_TABLE").newQuery() );
87 catch(coral::TableNotExistingException & ex) {
92 coral::AttributeList bindings;
93 bindings.extend<
int>(
"mck");
94 bindings[0].data<
int>() = mck;
96 q->setCondition(
"MCK_ID = :mck", bindings );
98 coral::AttributeList attList;
99 attList.extend<std::string> (
"MCK_ATHENA_VERSION" );
103 coral::ICursor& cursor = q->execute();
106 while (cursor.next()) {
108 const coral::AttributeList& row = cursor.currentRow();
109 mck_release = row[
"MCK_ATHENA_VERSION"].data<std::string>();
114 TRG_MSG_ERROR(
"Found more than one release for MCK " << mck);
115 }
else if(nFound==1) {
116 TRG_MSG_INFO(
"Found release " << mck_release <<
" for MCK " << mck);
#define TRG_MSG_WARNING(x)
DBLoader(StorageMgr &sm, coral::ISessionProxy &session)
constructor
void commitSession()
commit session if not already done
coral::ISessionProxy & m_session
CORAL interface to database session.
void startSession()
start session if not already active
MCKLoader(StorageMgr &sm)
bool loadReleaseLinkedToMCK(unsigned int mck, std::string &mck_release)
bool loadMCKlinkedToSMK(unsigned int smk, unsigned int &mck)
Database Storage Manager, controls the database session and the different loader classes for DB acces...
void fillQuery(coral::IQuery *q, coral::AttributeList &attList)