7 using namespace oracle::occi;
35 if (runmode != m_runMode) {
47 throw(std::runtime_error)
54 this->checkConnection();
57 Statement* stmt = m_conn->createStatement();
58 stmt->setSQL(
"SELECT def_id FROM ecal_run_mode_def WHERE "
59 "run_mode_string = :1"
61 stmt->setString(1, m_runMode);
66 m_ID = rset->getInt(1);
70 m_conn->terminateStatement(stmt);
72 throw(std::runtime_error(
"RunModeDef::fetchID: "+e.getMessage()));
81 throw(std::runtime_error)
83 this->checkConnection();
86 Statement* stmt = m_conn->createStatement();
88 stmt->setSQL(
"SELECT run_mode_string FROM ecal_run_mode_def WHERE def_id = :1");
93 m_runMode = rset->getString(1);
95 throw(std::runtime_error(
"RunModeDef::setByID: Given def_id is not in the database"));
98 m_conn->terminateStatement(stmt);
100 throw(std::runtime_error(
"RunModeDef::setByID: "+e.getMessage()));
107 throw(std::runtime_error)
109 this->checkConnection();
111 Statement* stmt = m_conn->createStatement();
112 stmt->setSQL(
"SELECT def_id FROM ecal_run_mode_def ORDER BY def_id");
118 while(rset->next()) {
119 runModeDef.
setByID( rset->getInt(1) );
120 fillVec->push_back( runModeDef );
123 throw(std::runtime_error(
"RunModeDef::fetchAllDefs: "+e.getMessage()));
std::string getRunMode() const
oracle::occi::SQLException SQLException
oracle::occi::ResultSet ResultSet
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
void fetchAllDefs(std::vector< RunModeDef > *fillVec)
void setRunMode(std::string runmode)