Skip to content
Snippets Groups Projects
Commit d227a6d9 authored by Steven Murray's avatar Steven Murray
Browse files

OcciStmt::executeQuery() now throws LostDatabaseConnection

parent 7e367caa
Branches
Tags
No related merge requests found
......@@ -17,6 +17,7 @@
*/
#include "common/exception/Exception.hpp"
#include "common/exception/LostDatabaseConnection.hpp"
#include "common/make_unique.hpp"
#include "common/threading/MutexLocker.hpp"
#include "rdbms/wrapper/OcciColumn.hpp"
......@@ -183,6 +184,9 @@ std::unique_ptr<Rset> OcciStmt::executeQuery() {
try {
return cta::make_unique<OcciRset>(*this, m_stmt->executeQuery());
} catch(occi::SQLException &ex) {
std::ostringstream msg;
msg << std::string(__FUNCTION__) << " failed for SQL statement " << getSqlForException() << ": " << ex.what();
if(connShouldBeClosed(ex)) {
// Close the statement first and then the connection
try {
......@@ -194,9 +198,9 @@ std::unique_ptr<Rset> OcciStmt::executeQuery() {
m_conn.close();
} catch(...) {
}
throw exception::LostDatabaseConnection(msg.str());
}
throw exception::Exception(std::string(__FUNCTION__) + " failed for SQL statement " +
getSqlForException() + ": " + ex.what());
throw exception::Exception(msg.str());
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment