7 using namespace oracle::occi;
35 if (genTag != m_genTag) {
45 return m_monVersionDef;
51 if (ver != m_monVersionDef) {
53 m_monVersionDef = ver;
60 throw(std::runtime_error)
67 this->checkConnection();
71 this->fetchParentIDs(&verID);
75 Statement* stmt = m_conn->createStatement();
76 stmt->setSQL(
"SELECT tag_id FROM mon_run_tag WHERE "
80 stmt->setString(1, m_genTag);
81 stmt->setInt(2, verID);
86 m_ID = rset->getInt(1);
90 m_conn->terminateStatement(stmt);
92 throw(std::runtime_error(
"MonRunTag::fetchID: "+e.getMessage()));
101 throw(std::runtime_error)
103 this->checkConnection();
106 Statement* stmt = m_conn->createStatement();
108 stmt->setSQL(
"SELECT gen_tag, mon_ver_id FROM mon_run_tag WHERE tag_id = :1");
113 m_genTag = rset->getString(1);
114 int verID = rset->getInt(2);
115 m_monVersionDef.setByID(verID);
118 throw(std::runtime_error(
"MonRunTag::setByID: Given tag_id is not in the database"));
121 m_conn->terminateStatement(stmt);
123 throw(std::runtime_error(
"MonRunTag::setByID: "+e.getMessage()));
129 throw(std::runtime_error)
132 if (this->fetchID()) {
137 this->checkConnection();
141 this->fetchParentIDs(&verID);
145 Statement* stmt = m_conn->createStatement();
147 stmt->setSQL(
"INSERT INTO mon_run_tag (tag_id, gen_tag, mon_ver_id) "
148 "VALUES (mon_run_tag_sq.NextVal, :1, :2)");
149 stmt->setString(1, m_genTag);
150 stmt->setInt(2, verID);
152 stmt->executeUpdate();
154 m_conn->terminateStatement(stmt);
156 throw(std::runtime_error(
"MonRunTag::writeDB: "+e.getMessage()));
160 if (!this->fetchID()) {
161 throw(std::runtime_error(
"MonRunTag::writeDB: Failed to write"));
170 throw(std::runtime_error)
172 this->checkConnection();
174 Statement* stmt = m_conn->createStatement();
175 stmt->setSQL(
"SELECT tag_id FROM mon_run_tag ORDER BY tag_id");
180 while(rset->next()) {
181 runtag.
setByID( rset->getInt(1) );
182 fillVec->push_back( runtag );
184 m_conn->terminateStatement(stmt);
186 throw(std::runtime_error(
"MonRunTag::fetchAllTags: "+e.getMessage()));
193 throw(std::runtime_error)
196 m_monVersionDef.setConnection(m_env, m_conn);
197 *verID = m_monVersionDef.fetchID();
200 throw(std::runtime_error(
"MonRunTag::writeDB: Given monitoring version does not exist in DB"));
void fetchParentIDs(int *verID)
void setGeneralTag(std::string tag)
oracle::occi::SQLException SQLException
void fetchAllTags(std::vector< MonRunTag > *fillVec)
MonVersionDef getMonVersionDef() const
void setMonVersionDef(const MonVersionDef &ver)
std::string getGeneralTag() const
oracle::occi::ResultSet ResultSet
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)