From f185b070fd72112a7c4c4b843ee6156c1860ac94 Mon Sep 17 00:00:00 2001 From: Lionel Elie Mamane Date: Sat, 9 May 2020 13:55:23 +0200 Subject: mysql-sdbc: statement: do not pointlessly keep pointer to result in m_pMysqlResult since it is never actually used after being assigned, except in the code block that assigned it. Change-Id: Ic4341321b18b2c92eb93e59dd3b9e3035c69f293 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93852 Tested-by: Jenkins Reviewed-by: Lionel Elie Mamane --- connectivity/source/drivers/mysqlc/mysqlc_statement.cxx | 7 +++---- connectivity/source/drivers/mysqlc/mysqlc_statement.hxx | 1 - 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'connectivity') diff --git a/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx b/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx index 6b35b236361f..2301d040511b 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx @@ -57,7 +57,6 @@ void OCommonStatement::closeResultSet() css::uno::Reference xClose(m_xResultSet, UNO_QUERY_THROW); xClose->close(); m_xResultSet.clear(); - m_pMysqlResult = nullptr; // it is freed by XResultSet } } @@ -155,15 +154,15 @@ Reference SAL_CALL OCommonStatement::executeQuery(const OUString& sq mysql_errno(pMySql), *this, m_xConnection->getConnectionEncoding()); - m_pMysqlResult = mysql_store_result(pMySql); - if (m_pMysqlResult == nullptr) + MYSQL_RES* pMysqlResult = mysql_store_result(pMySql); + if (pMysqlResult == nullptr) { mysqlc_sdbc_driver::throwSQLExceptionWithMsg(mysql_error(pMySql), mysql_sqlstate(pMySql), mysql_errno(pMySql), *this, m_xConnection->getConnectionEncoding()); } - m_xResultSet = new OResultSet(*getOwnConnection(), this, m_pMysqlResult, + m_xResultSet = new OResultSet(*getOwnConnection(), this, pMysqlResult, m_xConnection->getConnectionEncoding()); return m_xResultSet; } diff --git a/connectivity/source/drivers/mysqlc/mysqlc_statement.hxx b/connectivity/source/drivers/mysqlc/mysqlc_statement.hxx index 9595c596401a..2ce417259b24 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_statement.hxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_statement.hxx @@ -65,7 +65,6 @@ protected: rtl::Reference m_xConnection; // The owning Connection object css::uno::Reference m_xResultSet; - MYSQL_RES* m_pMysqlResult = nullptr; // number of rows affected by an UPDATE, DELETE or INSERT statement. sal_Int32 m_nAffectedRows = 0; -- cgit v1.2.3