33 this->checkConnection();
36 Statement* stmt = m_conn->createStatement();
38 "SELECT def_id FROM ecal_run_mode_def WHERE " 39 "run_mode_string = :1");
40 stmt->setString(1, m_runMode);
42 ResultSet* rset = stmt->executeQuery();
45 m_ID = rset->getInt(1);
49 m_conn->terminateStatement(stmt);
50 }
catch (SQLException&
e) {
51 throw(std::runtime_error(
"RunModeDef::fetchID: " +
e.getMessage()));
58 this->checkConnection();
61 Statement* stmt = m_conn->createStatement();
63 stmt->setSQL(
"SELECT run_mode_string FROM ecal_run_mode_def WHERE def_id = :1");
66 ResultSet* rset = stmt->executeQuery();
68 m_runMode = rset->getString(1);
70 throw(std::runtime_error(
"RunModeDef::setByID: Given def_id is not in the database"));
73 m_conn->terminateStatement(stmt);
74 }
catch (SQLException&
e) {
75 throw(std::runtime_error(
"RunModeDef::setByID: " +
e.getMessage()));
80 this->checkConnection();
82 Statement* stmt = m_conn->createStatement();
83 stmt->setSQL(
"SELECT def_id FROM ecal_run_mode_def ORDER BY def_id");
84 ResultSet* rset = stmt->executeQuery();
89 while (rset->next()) {
90 runModeDef.
setByID(rset->getInt(1));
91 fillVec->push_back(runModeDef);
93 }
catch (SQLException&
e) {
94 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)