8 using namespace oracle::occi;
44 throw(std::runtime_error)
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);
62 m_ID = rset->getInt(1);
66 m_conn->terminateStatement(stmt);
68 throw(std::runtime_error(
"LocationDef::fetchID: "+e.getMessage()));
77 throw(std::runtime_error)
79 this->checkConnection();
82 Statement* stmt = m_conn->createStatement();
84 stmt->setSQL(
"SELECT location FROM location_def WHERE def_id = :1");
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);
97 throw(std::runtime_error(
"LocationDef::setByID: "+e.getMessage()));
104 throw(std::runtime_error)
106 this->checkConnection();
108 Statement* stmt = m_conn->createStatement();
109 stmt->setSQL(
"SELECT def_id FROM location_def ORDER BY def_id");
115 while(rset->next()) {
116 locationDef.
setByID( rset->getInt(1) );
117 fillVec->push_back( locationDef );
120 throw(std::runtime_error(
"LocationDef::fetchAllDefs: "+e.getMessage()));
oracle::occi::SQLException SQLException
void fetchAllDefs(std::vector< LocationDef > *fillVec)
std::string getLocation() const
oracle::occi::ResultSet ResultSet
void setLocation(std::string loc)
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)