summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2020-04-30 23:33:01 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-05-09 15:57:11 +0200
commit4f88fdc7fbf2b4a9113e4640b11ed3be3c768ed0 (patch)
tree7d54edac42f5269c83788e9f96e97ec1d61af325 /connectivity
parentc34b961e51308e2755708655a95b2e0807df9346 (diff)
Avoid ODBC warning when testing connection
When clicking test connection for ODBC, there's this warning on console warn:legacy.osl:11208:1336:connectivity/source/drivers/odbc/OConnection.cxx:68: Failure from SQLDisconnect Some debug by adding a call to OTools::ThrowException indicates that SQLGetDiagRec returns 08003 08003 Connection not open (DM) The connection specified in the argument ConnectionHandle was not open. (see https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqldisconnect-function?view=sql-server-ver15) It's due to the fact that "N3SQLDisconnect( m_aConnectionHandle )" has already been called during void OConnection::disposing() Avoid the warning by testing m_bClosed Change-Id: Ie992da3582ab4d61cde35ada3f10f6a3d51d8be5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93234 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/odbc/OConnection.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/connectivity/source/drivers/odbc/OConnection.cxx b/connectivity/source/drivers/odbc/OConnection.cxx
index 04bb0e1a51a2..26a549814cf3 100644
--- a/connectivity/source/drivers/odbc/OConnection.cxx
+++ b/connectivity/source/drivers/odbc/OConnection.cxx
@@ -64,8 +64,11 @@ OConnection::~OConnection()
{
SQLRETURN rc;
- rc = N3SQLDisconnect( m_aConnectionHandle );
- OSL_ENSURE( rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO, "Failure from SQLDisconnect" );
+ if (!m_bClosed)
+ {
+ rc = N3SQLDisconnect( m_aConnectionHandle );
+ OSL_ENSURE( rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO, "Failure from SQLDisconnect" );
+ }
rc = N3SQLFreeHandle( SQL_HANDLE_DBC, m_aConnectionHandle );
OSL_ENSURE( rc == SQL_SUCCESS , "Failure from SQLFreeHandle for connection");