51 this->checkConnection();
54 Statement* stmt = m_conn->createStatement();
55 stmt->setSQL(
"SELECT def_id FROM location_def WHERE " 56 "location = :location");
57 stmt->setString(1, m_loc);
59 ResultSet* rset = stmt->executeQuery();
62 m_ID = rset->getInt(1);
66 m_conn->terminateStatement(stmt);
67 }
catch (SQLException &
e) {
68 throw(std::runtime_error(
"LocationDef::fetchID: "+e.getMessage()));
79 this->checkConnection();
82 Statement* stmt = m_conn->createStatement();
84 stmt->setSQL(
"SELECT location FROM location_def WHERE def_id = :1");
87 ResultSet* rset = stmt->executeQuery();
89 m_loc = rset->getString(1);
92 throw(std::runtime_error(
"LocationDef::setByID: Given def_id is not in the database"));
95 m_conn->terminateStatement(stmt);
96 }
catch (SQLException &
e) {
97 throw(std::runtime_error(
"LocationDef::setByID: "+e.getMessage()));
106 this->checkConnection();
108 Statement* stmt = m_conn->createStatement();
109 stmt->setSQL(
"SELECT def_id FROM location_def ORDER BY def_id");
110 ResultSet* rset = stmt->executeQuery();
115 while(rset->next()) {
116 locationDef.
setByID( rset->getInt(1) );
117 fillVec->push_back( locationDef );
119 }
catch (SQLException &
e) {
120 throw(std::runtime_error(
"LocationDef::fetchAllDefs: "+e.getMessage()));
void fetchAllDefs(std::vector< LocationDef > *fillVec) noexcept(false)
void setByID(int id) noexcept(false)
int fetchID() noexcept(false)
std::string getLocation() const
void setLocation(std::string loc)
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)