[Libreoffice-commits] core.git: connectivity/source
Julien Nabet (via logerrit)
logerrit at kemper.freedesktop.org
Sat May 9 13:57:50 UTC 2020
connectivity/source/drivers/odbc/OConnection.cxx | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
New commits:
commit 4f88fdc7fbf2b4a9113e4640b11ed3be3c768ed0
Author: Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Thu Apr 30 23:33:01 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat May 9 15:57:11 2020 +0200
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 at collabora.co.uk>
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");
More information about the Libreoffice-commits
mailing list