Kaydet (Commit) ebe37593 authored tarafından Andrzej J.R. Hunt's avatar Andrzej J.R. Hunt

Clean up ResultSet management. (firebird-sdbc)

Change-Id: I00cd0aa08a5a3da17f06933ebc3422a6b4b8bc74
üst eb5e9ab4
...@@ -258,6 +258,7 @@ sal_Bool SAL_CALL OPreparedStatement::execute() ...@@ -258,6 +258,7 @@ sal_Bool SAL_CALL OPreparedStatement::execute()
MutexGuard aGuard( m_pConnection->getMutex() ); MutexGuard aGuard( m_pConnection->getMutex() );
checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed); checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
ensurePrepared(); ensurePrepared();
ISC_STATUS aErr; ISC_STATUS aErr;
...@@ -273,9 +274,12 @@ sal_Bool SAL_CALL OPreparedStatement::execute() ...@@ -273,9 +274,12 @@ sal_Bool SAL_CALL OPreparedStatement::execute()
evaluateStatusVector(m_statusVector, "isc_dsql_execute", *this); evaluateStatusVector(m_statusVector, "isc_dsql_execute", *this);
} }
// TODO: check we actually got results -- ? m_xResultSet = new OResultSet(m_pConnection,
uno::Reference< XInterface >(*this),
m_statementHandle,
m_pOutSqlda);
return sal_True; return m_xResultSet.is();
// TODO: implement handling of multiple ResultSets. // TODO: implement handling of multiple ResultSets.
} }
...@@ -296,12 +300,6 @@ Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery() ...@@ -296,12 +300,6 @@ Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery()
throw SQLException(); // TODO: add message to exception throw SQLException(); // TODO: add message to exception
} }
uno::Reference< OResultSet > pResult(new OResultSet(m_pConnection,
uno::Reference< XInterface >(*this),
m_statementHandle,
m_pOutSqlda));
m_xResultSet = pResult.get();
return m_xResultSet; return m_xResultSet;
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
......
...@@ -82,7 +82,6 @@ void SAL_CALL OStatement::release() throw() ...@@ -82,7 +82,6 @@ void SAL_CALL OStatement::release() throw()
sal_Int32 SAL_CALL OStatement::executeUpdate(const OUString& sql) sal_Int32 SAL_CALL OStatement::executeUpdate(const OUString& sql)
throw(SQLException, RuntimeException) throw(SQLException, RuntimeException)
{ {
// TODO: close ResultSet if existing -- so so in all 3 execute methods.
MutexGuard aGuard(m_pConnection->getMutex()); MutexGuard aGuard(m_pConnection->getMutex());
checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed); checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
...@@ -133,12 +132,10 @@ uno::Reference< XResultSet > SAL_CALL OStatement::executeQuery(const OUString& s ...@@ -133,12 +132,10 @@ uno::Reference< XResultSet > SAL_CALL OStatement::executeQuery(const OUString& s
SAL_WARN("connectivity.firebird", "isc_dsql_execute failed" ); SAL_WARN("connectivity.firebird", "isc_dsql_execute failed" );
} }
uno::Reference< OResultSet > pResult(new OResultSet(m_pConnection, m_xResultSet = new OResultSet(m_pConnection,
uno::Reference< XInterface >(*this), uno::Reference< XInterface >(*this),
aStatementHandle, aStatementHandle,
pOutSqlda)); pOutSqlda);
//initializeResultSet( pResult.get() );
m_xResultSet = pResult.get();
// TODO: deal with cleanup // TODO: deal with cleanup
// close(); // close();
......
...@@ -59,11 +59,10 @@ OStatementCommonBase::~OStatementCommonBase() ...@@ -59,11 +59,10 @@ OStatementCommonBase::~OStatementCommonBase()
void OStatementCommonBase::disposeResultSet() void OStatementCommonBase::disposeResultSet()
{ {
//free the cursor if alive uno::Reference< XComponent > xComp(m_xResultSet.get(), UNO_QUERY);
// uno::Reference< XComponent > xComp(m_xResultSet.get(), UNO_QUERY); if (xComp.is())
// if (xComp.is()) xComp->dispose();
// xComp->dispose(); m_xResultSet = uno::Reference< XResultSet>();
// m_xResultSet = uno::Reference< XResultSet>();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -101,7 +100,7 @@ void SAL_CALL OStatementCommonBase::close( ) throw(SQLException, RuntimeExcepti ...@@ -101,7 +100,7 @@ void SAL_CALL OStatementCommonBase::close( ) throw(SQLException, RuntimeExcepti
{ {
MutexGuard aGuard(m_pConnection->getMutex()); MutexGuard aGuard(m_pConnection->getMutex());
checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed); checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
disposeResultSet();
} }
dispose(); dispose();
} }
...@@ -191,11 +190,11 @@ int OStatementCommonBase::prepareAndDescribeStatement(const OUString& sql, ...@@ -191,11 +190,11 @@ int OStatementCommonBase::prepareAndDescribeStatement(const OUString& sql,
uno::Reference< XResultSet > SAL_CALL OStatementCommonBase::getResultSet() throw(SQLException, RuntimeException) uno::Reference< XResultSet > SAL_CALL OStatementCommonBase::getResultSet() throw(SQLException, RuntimeException)
{ {
// TODO: verify we really can't support this // TODO: verify we really can't support this
return uno::Reference< XResultSet >(); // return uno::Reference< XResultSet >();
// MutexGuard aGuard( m_aMutex ); MutexGuard aGuard(m_pConnection->getMutex());
// checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed); checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
// return m_xResultSet; return m_xResultSet;
} }
sal_Bool SAL_CALL OStatementCommonBase::getMoreResults() throw(SQLException, RuntimeException) sal_Bool SAL_CALL OStatementCommonBase::getMoreResults() throw(SQLException, RuntimeException)
......
...@@ -53,7 +53,7 @@ namespace connectivity ...@@ -53,7 +53,7 @@ namespace connectivity
{ {
protected: protected:
::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XResultSet> m_xResultSet; // The last ResultSet created ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> m_xResultSet; // The last ResultSet created
// for this Statement // for this Statement
::std::list< ::rtl::OUString> m_aBatchList; ::std::list< ::rtl::OUString> m_aBatchList;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment