35 if (runmode != m_runMode) {
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);
63 ResultSet* rset = stmt->executeQuery();
66 m_ID = rset->getInt(1);
70 m_conn->terminateStatement(stmt);
71 }
catch (SQLException &
e) {
72 throw(std::runtime_error(
"RunModeDef::fetchID: "+e.getMessage()));
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");
91 ResultSet* rset = stmt->executeQuery();
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);
99 }
catch (SQLException &
e) {
100 throw(std::runtime_error(
"RunModeDef::setByID: "+e.getMessage()));
109 this->checkConnection();
111 Statement* stmt = m_conn->createStatement();
112 stmt->setSQL(
"SELECT def_id FROM ecal_run_mode_def ORDER BY def_id");
113 ResultSet* rset = stmt->executeQuery();
118 while(rset->next()) {
119 runModeDef.
setByID( rset->getInt(1) );
120 fillVec->push_back( runModeDef );
122 }
catch (SQLException &
e) {
123 throw(std::runtime_error(
"RunModeDef::fetchAllDefs: "+e.getMessage()));
std::string getRunMode() const
void fetchAllDefs(std::vector< RunModeDef > *fillVec) noexcept(false)
int fetchID() noexcept(false) override
void setByID(int id) noexcept(false) override
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
void setRunMode(std::string runmode)