7 using namespace oracle::occi;
22 if (desc != m_shortDesc) {
36 this->checkConnection();
39 Statement* stmt = m_conn->createStatement();
41 "SELECT def_id FROM mon_run_outcome_def WHERE "
43 stmt->setString(1, m_shortDesc);
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(
"MonRunOutcomeDef::fetchID: " + e.getMessage()));
61 this->checkConnection();
64 Statement* stmt = m_conn->createStatement();
66 stmt->setSQL(
"SELECT short_desc, long_desc FROM mon_run_outcome_def WHERE def_id = :1");
69 ResultSet* rset = stmt->executeQuery();
71 m_shortDesc = rset->getString(1);
72 m_longDesc = rset->getString(2);
75 throw(std::runtime_error(
"MonRunOutcomeDef::setByID: Given def_id is not in the database"));
78 m_conn->terminateStatement(stmt);
79 }
catch (SQLException&
e) {
80 throw(std::runtime_error(
"MonRunOutcomeDef::setByID: " + e.getMessage()));
85 this->checkConnection();
87 Statement* stmt = m_conn->createStatement();
88 stmt->setSQL(
"SELECT def_id FROM mon_run_outcome_def ORDER BY def_id");
89 ResultSet* rset = stmt->executeQuery();
94 while (rset->next()) {
96 fillVec->push_back(def);
98 }
catch (SQLException&
e) {
99 throw(std::runtime_error(
"MonRunOutcomeDef::fetchAllDefs: " + e.getMessage()));
int def(FILE *, FILE *, int)
uint16_t *__restrict__ id
std::string getShortDesc() const
void setByID(int id) noexcept(false) override
void fetchAllDefs(std::vector< MonRunOutcomeDef > *fillVec) noexcept(false)
void setShortDesc(std::string desc)
std::string getLongDesc() const
int fetchID() noexcept(false) override
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
~MonRunOutcomeDef() override