diff options
Diffstat (limited to 'connectivity/source')
-rw-r--r-- | connectivity/source/drivers/odbc/OStatement.cxx | 22 | ||||
-rw-r--r-- | connectivity/source/inc/odbc/OStatement.hxx | 5 |
2 files changed, 15 insertions, 12 deletions
diff --git a/connectivity/source/drivers/odbc/OStatement.cxx b/connectivity/source/drivers/odbc/OStatement.cxx index 13970dc7b80e..895bfa59dc60 100644 --- a/connectivity/source/drivers/odbc/OStatement.cxx +++ b/connectivity/source/drivers/odbc/OStatement.cxx @@ -83,10 +83,12 @@ OStatement_Base::~OStatement_Base() void OStatement_Base::disposeResultSet() { // free the cursor if alive - Reference< XComponent > xComp(m_xResultSet.get(), UNO_QUERY); + rtl::Reference< OResultSet > xComp(m_xResultSet.get()); if (xComp.is()) + { xComp->dispose(); - m_xResultSet.clear(); + m_xResultSet.clear(); + } } void SAL_CALL OStatement_Base::disposing() @@ -208,8 +210,7 @@ void OStatement_Base::clearMyResultSet() try { - Reference<XCloseable> xCloseable( - m_xResultSet.get(), css::uno::UNO_QUERY); + rtl::Reference<OResultSet> xCloseable(m_xResultSet.get()); if ( xCloseable.is() ) xCloseable->close(); } @@ -362,7 +363,7 @@ sal_Bool SAL_CALL OStatement_Base::execute( const OUString& sql ) // getResultSet returns the current result as a ResultSet. It // returns NULL if the current result is not a ResultSet. -Reference< XResultSet > OStatement_Base::getResultSet(bool checkCount) +rtl::Reference< OResultSet > OStatement_Base::getResultSet(bool checkCount) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); @@ -427,15 +428,15 @@ Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery( const OUString& checkDisposed(OStatement_BASE::rBHelper.bDisposed); - Reference< XResultSet > xRS; + rtl::Reference< OResultSet > xRS; // Execute the statement. If execute returns true, a result // set exists. if (execute (sql)) { - xRS = getResultSet (false); - m_xResultSet = xRS; + xRS = getResultSet(false); + m_xResultSet = xRS.get(); } else { @@ -542,8 +543,9 @@ Reference< XResultSet > SAL_CALL OStatement_Base::getResultSet( ) checkDisposed(OStatement_BASE::rBHelper.bDisposed); - m_xResultSet = getResultSet(true); - return m_xResultSet; + rtl::Reference<OResultSet> xRS = getResultSet(true); + m_xResultSet = xRS.get(); + return xRS; } diff --git a/connectivity/source/inc/odbc/OStatement.hxx b/connectivity/source/inc/odbc/OStatement.hxx index 773e79b8d266..2de1e905364d 100644 --- a/connectivity/source/inc/odbc/OStatement.hxx +++ b/connectivity/source/inc/odbc/OStatement.hxx @@ -37,6 +37,7 @@ #include <string_view> #include <vector> #include <com/sun/star/lang/XServiceInfo.hpp> +#include <unotools/weakref.hxx> namespace connectivity::odbc { @@ -61,7 +62,7 @@ namespace connectivity::odbc { css::sdbc::SQLWarning m_aLastWarning; protected: - css::uno::WeakReference< css::sdbc::XResultSet> m_xResultSet; // The last ResultSet created + unotools::WeakReference< OResultSet > m_xResultSet; // The last ResultSet created css::uno::Reference< css::sdbc::XStatement> m_xGeneratedStatement; // for this Statement @@ -122,7 +123,7 @@ namespace connectivity::odbc /// @throws css::sdbc::SQLException /// @throws css::uno::RuntimeException - css::uno::Reference<css::sdbc::XResultSet> getResultSet(bool checkCount); + rtl::Reference<OResultSet> getResultSet(bool checkCount); /** creates the driver specific resultset (factory) */ |