summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2014-06-16 08:41:46 +0200
committerCaolán McNamara <caolanm@redhat.com>2014-06-18 09:45:18 +0000
commit98986a5167438808871e8094dbf815c72282ca0b (patch)
treef3303746ce3cbd015c2a137d1b909340993a9138 /dbaccess
parent5d0552a34dbc34c840aaa7a3e5fb48cb247ac623 (diff)
fdo#79427 after execute() a ResultSet is expected to be BeforeFirst
Squash the three commits in master: Change-Id: I38091d1ee2161d6e32da3a0bde60e3fc008aa83d Change-Id: Iaa881d055923702acbb96862d187af41a6ded730 Change-Id: I3e34f77ce37c239d8d3d6a8cd7514b125b049de6 1) fdo#79427 after execute() a ResultSet is expected to be BeforeFirst 2) clean up fdo#79427 fix: force BeforeFirst only at execute(), not updateRow() 3) dbaccess::ORowSet: separate impl_rebuild_throw Used by two different callers that wanted different things. Also, freeResources now always positions on BeforeFirst. It is only called with _bComplete==false by execute()-related code. Change-Id: I3cce4334c4ed49855c98fbe5960fb68685c61ed9 Reviewed-on: https://gerrit.libreoffice.org/9813 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/core/api/RowSet.cxx46
1 files changed, 27 insertions, 19 deletions
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index 644b937183d7..ca83936456c3 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -560,6 +560,15 @@ void ORowSet::freeResources( bool _bComplete )
}
m_aClones.clear();
+ m_aBookmark = Any();
+ m_bBeforeFirst = true;
+ m_bAfterLast = false;
+ m_bNew = false;
+ m_bModified = false;
+ m_bIsInsertRow = false;
+ m_bLastKnownRowCountFinal = false;
+ m_nLastKnownRowCount = 0;
+
if ( _bComplete )
{
// the columns must be disposed before the querycomposer is disposed because
@@ -588,14 +597,6 @@ void ORowSet::freeResources( bool _bComplete )
m_xStatement = NULL;
m_xTypeMap = NULL;
- m_aBookmark = Any();
- m_bBeforeFirst = true;
- m_bAfterLast = false;
- m_bNew = false;
- m_bModified = false;
- m_bIsInsertRow = false;
- m_bLastKnownRowCountFinal = false;
- m_nLastKnownRowCount = 0;
if ( m_aOldRow.is() )
m_aOldRow->clearRow();
@@ -2006,7 +2007,22 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi
}
else // !m_bCommandFacetsDirty
{
- impl_rebuild_throw(_rClearForNotification);
+ Reference< XResultSet > xResultSet;
+ if(m_bParametersDirty)
+ {
+ xResultSet = impl_prepareAndExecute_throw();
+ }
+ else
+ {
+ xResultSet = m_xStatement->executeQuery();
+ m_pCache->reset(xResultSet);
+ }
+ // let our warnings container forget the reference to the (possibly disposed) old result set
+ m_aWarnings.setExternalWarnings( NULL );
+ // clear all current warnings
+ m_aWarnings.clearWarnings();
+ // let the warnings container know about the new "external warnings"
+ m_aWarnings.setExternalWarnings( Reference< XWarningsSupplier >( xResultSet, UNO_QUERY ) );
}
checkCache();
// notify the rowset listeners
@@ -2731,16 +2747,8 @@ void SAL_CALL ORowSet::refreshRow( ) throw(SQLException, RuntimeException, std:
void ORowSet::impl_rebuild_throw(::osl::ResettableMutexGuard& _rGuard)
{
- Reference< XResultSet > xResultSet;
- if(m_bParametersDirty)
- {
- xResultSet = impl_prepareAndExecute_throw();
- }
- else
- {
- xResultSet = m_xStatement->executeQuery();
- m_pCache->reset(xResultSet);
- }
+ Reference< XResultSet > xResultSet(m_xStatement->executeQuery());
+ m_pCache->reset(xResultSet);
m_aWarnings.setExternalWarnings( Reference< XWarningsSupplier >( xResultSet, UNO_QUERY ) );
notifyAllListeners(_rGuard);
}