7 using namespace oracle::occi;
35 if (runtype != m_runType) {
51 throw(std::runtime_error)
58 this->checkConnection();
61 Statement* stmt = m_conn->createStatement();
62 stmt->setSQL(
"SELECT def_id FROM run_type_def WHERE "
65 stmt->setString(1, m_runType);
70 m_ID = rset->getInt(1);
74 m_conn->terminateStatement(stmt);
76 throw(std::runtime_error(
"RunTypeDef::fetchID: "+e.getMessage()));
85 throw(std::runtime_error)
87 this->checkConnection();
90 Statement* stmt = m_conn->createStatement();
92 stmt->setSQL(
"SELECT run_type, description FROM run_type_def WHERE def_id = :1");
97 m_runType = rset->getString(1);
98 m_desc = rset->getString(2);
100 throw(std::runtime_error(
"RunTypeDef::setByID: Given def_id is not in the database"));
103 m_conn->terminateStatement(stmt);
105 throw(std::runtime_error(
"RunTypeDef::setByID: "+e.getMessage()));
112 throw(std::runtime_error)
114 this->checkConnection();
116 Statement* stmt = m_conn->createStatement();
117 stmt->setSQL(
"SELECT def_id FROM run_type_def ORDER BY def_id");
123 while(rset->next()) {
124 runTypeDef.
setByID( rset->getInt(1) );
125 fillVec->push_back( runTypeDef );
128 throw(std::runtime_error(
"RunTypeDef::fetchAllDefs: "+e.getMessage()));
std::string getDescription() const
std::string getRunType() const
oracle::occi::SQLException SQLException
void fetchAllDefs(std::vector< RunTypeDef > *fillVec)
void setRunType(std::string runtype)
oracle::occi::ResultSet ResultSet
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)