22 if (ver != m_monVer) {
36 this->checkConnection();
39 Statement* stmt = m_conn->createStatement();
41 "SELECT def_id FROM mon_version_def WHERE " 43 stmt->setString(1, m_monVer);
45 ResultSet* rset = stmt->executeQuery();
48 m_ID = rset->getInt(1);
52 m_conn->terminateStatement(stmt);
53 }
catch (SQLException&
e) {
54 throw(std::runtime_error(
"MonVersionDef::fetchID: " +
e.getMessage()));
61 this->checkConnection();
64 Statement* stmt = m_conn->createStatement();
66 stmt->setSQL(
"SELECT mon_ver, description FROM mon_version_def WHERE def_id = :1");
69 ResultSet* rset = stmt->executeQuery();
71 m_monVer = rset->getString(1);
72 m_desc = rset->getString(2);
74 throw(std::runtime_error(
"MonVersionDef::setByID: Given def_id is not in the database"));
77 m_conn->terminateStatement(stmt);
78 }
catch (SQLException&
e) {
79 throw(std::runtime_error(
"MonVersionDef::setByID: " +
e.getMessage()));
84 this->checkConnection();
86 Statement* stmt = m_conn->createStatement();
87 stmt->setSQL(
"SELECT def_id FROM mon_version_def ORDER BY def_id");
88 ResultSet* rset = stmt->executeQuery();
93 while (rset->next()) {
94 monVersionDef.
setByID(rset->getInt(1));
95 fillVec->push_back(monVersionDef);
97 }
catch (SQLException&
e) {
98 throw(std::runtime_error(
"MonVersionDef::fetchAllDefs: " +
e.getMessage()));
void setByID(int id) noexcept(false) override
int fetchID() noexcept(false) override
void fetchAllDefs(std::vector< MonVersionDef > *fillVec) noexcept(false)
std::string getDescription() const
void setMonitoringVersion(std::string ver)
std::string getMonitoringVersion() const
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
~MonVersionDef() override