37 if (desc != m_shortDesc) {
60 this->checkConnection();
63 Statement* stmt = m_conn->createStatement();
64 stmt->setSQL(
"SELECT def_id FROM mon_run_outcome_def WHERE " 66 stmt->setString(1, m_shortDesc);
68 ResultSet* rset = stmt->executeQuery();
71 m_ID = rset->getInt(1);
75 m_conn->terminateStatement(stmt);
76 }
catch (SQLException &
e) {
77 throw(std::runtime_error(
"MonRunOutcomeDef::fetchID: "+e.getMessage()));
88 this->checkConnection();
91 Statement* stmt = m_conn->createStatement();
93 stmt->setSQL(
"SELECT short_desc, long_desc FROM mon_run_outcome_def WHERE def_id = :1");
96 ResultSet* rset = stmt->executeQuery();
98 m_shortDesc = rset->getString(1);
99 m_longDesc = rset->getString(2);
102 throw(std::runtime_error(
"MonRunOutcomeDef::setByID: Given def_id is not in the database"));
105 m_conn->terminateStatement(stmt);
106 }
catch (SQLException &
e) {
107 throw(std::runtime_error(
"MonRunOutcomeDef::setByID: "+e.getMessage()));
116 this->checkConnection();
118 Statement* stmt = m_conn->createStatement();
119 stmt->setSQL(
"SELECT def_id FROM mon_run_outcome_def ORDER BY def_id");
120 ResultSet* rset = stmt->executeQuery();
125 while(rset->next()) {
126 def.
setByID( rset->getInt(1) );
127 fillVec->push_back( def );
129 }
catch (SQLException &
e) {
130 throw(std::runtime_error(
"MonRunOutcomeDef::fetchAllDefs: "+e.getMessage()));
std::string getShortDesc() const
void fetchAllDefs(std::vector< MonRunOutcomeDef > *fillVec) noexcept(false)
void setShortDesc(std::string desc)
std::string getLongDesc() const
void setByID(int id) noexcept(false)
int fetchID() noexcept(false)
virtual ~MonRunOutcomeDef()
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)