[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - dbaccess/source

Lionel Elie Mamane lionel at mamane.lu
Wed Jun 18 02:45:42 PDT 2014


 dbaccess/source/core/api/RowSet.cxx |   46 +++++++++++++++++++++---------------
 1 file changed, 27 insertions(+), 19 deletions(-)

New commits:
commit 98986a5167438808871e8094dbf815c72282ca0b
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Mon Jun 16 08:41:46 2014 +0200

    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 at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index 644b937..ca83936 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);
 }


More information about the Libreoffice-commits mailing list