diff --git a/Data/MySQL/include/Poco/Data/MySQL/Connector.h b/Data/MySQL/include/Poco/Data/MySQL/Connector.h index be7a50cd6..ffb6a82d5 100644 --- a/Data/MySQL/include/Poco/Data/MySQL/Connector.h +++ b/Data/MySQL/include/Poco/Data/MySQL/Connector.h @@ -85,7 +85,14 @@ struct MySQL_API MySQLConnectorRegistrator ~MySQLConnectorRegistrator() /// Calls Poco::Data::MySQL::unregisterConnector(); { - Poco::Data::MySQL::Connector::unregisterConnector(); + try + { + Poco::Data::MySQL::Connector::unregisterConnector(); + } + catch (...) + { + poco_unexpected(); + } } }; diff --git a/Data/ODBC/include/Poco/Data/ODBC/Connector.h b/Data/ODBC/include/Poco/Data/ODBC/Connector.h index a8bc736b6..84e6ba2fc 100644 --- a/Data/ODBC/include/Poco/Data/ODBC/Connector.h +++ b/Data/ODBC/include/Poco/Data/ODBC/Connector.h @@ -96,7 +96,14 @@ struct ODBC_API ODBCConnectorRegistrator ~ODBCConnectorRegistrator() /// Calls Poco::Data::ODBC::unregisterConnector(); { - Poco::Data::ODBC::Connector::unregisterConnector(); + try + { + Poco::Data::ODBC::Connector::unregisterConnector(); + } + catch (...) + { + poco_unexpected(); + } } }; diff --git a/Data/ODBC/include/Poco/Data/ODBC/Handle.h b/Data/ODBC/include/Poco/Data/ODBC/Handle.h index 43b02cb49..c8190c4f5 100644 --- a/Data/ODBC/include/Poco/Data/ODBC/Handle.h +++ b/Data/ODBC/include/Poco/Data/ODBC/Handle.h @@ -57,13 +57,20 @@ public: ~Handle() /// Destroys the Handle. { + try + { #if defined(_DEBUG) - SQLRETURN rc = + SQLRETURN rc = #endif - SQLFreeHandle(handleType, _handle); - // N.B. Destructors should not throw, but neither do we want to - // leak resources. So, we throw here in debug mode if things go bad. - poco_assert_dbg (!Utility::isError(rc)); + SQLFreeHandle(handleType, _handle); + // N.B. Destructors should not throw, but neither do we want to + // leak resources. So, we throw here in debug mode if things go bad. + poco_assert_dbg (!Utility::isError(rc)); + } + catch (...) + { + poco_unexpected(); + } } operator const H& () const diff --git a/Data/ODBC/src/ConnectionHandle.cpp b/Data/ODBC/src/ConnectionHandle.cpp index 5652a2413..a4fed4884 100644 --- a/Data/ODBC/src/ConnectionHandle.cpp +++ b/Data/ODBC/src/ConnectionHandle.cpp @@ -40,12 +40,19 @@ ConnectionHandle::ConnectionHandle(EnvironmentHandle* pEnvironment): ConnectionHandle::~ConnectionHandle() { - SQLDisconnect(_hdbc); - SQLRETURN rc = SQLFreeHandle(SQL_HANDLE_DBC, _hdbc); + try + { + SQLDisconnect(_hdbc); + SQLRETURN rc = SQLFreeHandle(SQL_HANDLE_DBC, _hdbc); - if (_ownsEnvironment) delete _pEnvironment; + if (_ownsEnvironment) delete _pEnvironment; - poco_assert (!Utility::isError(rc)); + poco_assert (!Utility::isError(rc)); + } + catch (...) + { + poco_unexpected(); + } } diff --git a/Data/ODBC/src/EnvironmentHandle.cpp b/Data/ODBC/src/EnvironmentHandle.cpp index 85f1ec10c..f8c9b11f3 100644 --- a/Data/ODBC/src/EnvironmentHandle.cpp +++ b/Data/ODBC/src/EnvironmentHandle.cpp @@ -41,8 +41,15 @@ EnvironmentHandle::EnvironmentHandle(): _henv(SQL_NULL_HENV) EnvironmentHandle::~EnvironmentHandle() { - SQLRETURN rc = SQLFreeHandle(SQL_HANDLE_ENV, _henv); - poco_assert (!Utility::isError(rc)); + try + { + SQLRETURN rc = SQLFreeHandle(SQL_HANDLE_ENV, _henv); + poco_assert (!Utility::isError(rc)); + } + catch (...) + { + poco_unexpected(); + } } diff --git a/Data/ODBC/src/Preparator.cpp b/Data/ODBC/src/Preparator.cpp index 5b7122b5a..8e18fc8fe 100644 --- a/Data/ODBC/src/Preparator.cpp +++ b/Data/ODBC/src/Preparator.cpp @@ -52,7 +52,14 @@ Preparator::Preparator(const Preparator& other): Preparator::~Preparator() { - freeMemory(); + try + { + freeMemory(); + } + catch (...) + { + poco_unexpected(); + } } diff --git a/Data/ODBC/src/SessionImpl.cpp b/Data/ODBC/src/SessionImpl.cpp index 25f25c2b6..6c861e633 100644 --- a/Data/ODBC/src/SessionImpl.cpp +++ b/Data/ODBC/src/SessionImpl.cpp @@ -70,14 +70,20 @@ SessionImpl::SessionImpl(const std::string& connect, SessionImpl::~SessionImpl() { - if (isTransaction() && !getFeature("autoCommit")) + try { - try { rollback(); } - catch (...) { } - } + if (isTransaction() && !getFeature("autoCommit")) + { + try { rollback(); } + catch (...) { } + } - try { close(); } - catch (...) { } + close(); + } + catch (...) + { + poco_unexpected(); + } } diff --git a/Data/SQLite/include/Poco/Data/SQLite/Connector.h b/Data/SQLite/include/Poco/Data/SQLite/Connector.h index 45c7cb03d..9524c160c 100644 --- a/Data/SQLite/include/Poco/Data/SQLite/Connector.h +++ b/Data/SQLite/include/Poco/Data/SQLite/Connector.h @@ -104,7 +104,14 @@ struct SQLite_API SQLiteConnectorRegistrator ~SQLiteConnectorRegistrator() /// Calls Poco::Data::SQLite::unregisterConnector(); { - Poco::Data::SQLite::Connector::unregisterConnector(); + try + { + Poco::Data::SQLite::Connector::unregisterConnector(); + } + catch (...) + { + poco_unexpected(); + } } }; diff --git a/Data/SQLite/src/Notifier.cpp b/Data/SQLite/src/Notifier.cpp index 2aff29a77..6484b07cd 100644 --- a/Data/SQLite/src/Notifier.cpp +++ b/Data/SQLite/src/Notifier.cpp @@ -45,7 +45,14 @@ Notifier::Notifier(const Session& session, const Any& value, EnabledEventType en Notifier::~Notifier() { - disableAll(); + try + { + disableAll(); + } + catch (...) + { + poco_unexpected(); + } } diff --git a/Data/SQLite/src/SQLiteStatementImpl.cpp b/Data/SQLite/src/SQLiteStatementImpl.cpp index 274126974..d27a5f46c 100644 --- a/Data/SQLite/src/SQLiteStatementImpl.cpp +++ b/Data/SQLite/src/SQLiteStatementImpl.cpp @@ -52,7 +52,14 @@ SQLiteStatementImpl::SQLiteStatementImpl(Poco::Data::SessionImpl& rSession, sqli SQLiteStatementImpl::~SQLiteStatementImpl() { - clear(); + try + { + clear(); + } + catch (...) + { + poco_unexpected(); + } } diff --git a/Data/SQLite/src/SessionImpl.cpp b/Data/SQLite/src/SessionImpl.cpp index 9978b8694..f1f72f71f 100644 --- a/Data/SQLite/src/SessionImpl.cpp +++ b/Data/SQLite/src/SessionImpl.cpp @@ -57,7 +57,14 @@ SessionImpl::SessionImpl(const std::string& fileName, std::size_t loginTimeout): SessionImpl::~SessionImpl() { - close(); + try + { + close(); + } + catch (...) + { + poco_unexpected(); + } }