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

Lionel Elie Mamane lionel at mamane.lu
Sat May 30 08:36:32 PDT 2015


 dbaccess/qa/complex/dbaccess/RowSet.java |   21 +++++++++++++++++++++
 dbaccess/source/core/api/RowSet.cxx      |   25 +++++++++++--------------
 dbaccess/source/core/api/RowSet.hxx      |    3 +--
 dbaccess/source/core/api/RowSetBase.cxx  |    1 +
 4 files changed, 34 insertions(+), 16 deletions(-)

New commits:
commit d35ac867bd5653d612e3dde601686a76081dadd8
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Sat May 30 16:56:29 2015 +0200

    do not try to get bookmark when in invalid position
    
    Change-Id: I64fc14e527af4f0f846bbfae84cf8d1d2914b6b9

diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx
index 09c9847..01830fb 100644
--- a/dbaccess/source/core/api/RowSetBase.cxx
+++ b/dbaccess/source/core/api/RowSetBase.cxx
@@ -1239,6 +1239,7 @@ void ORowSetBase::positionCache( CursorMoveDirection _ePrepareForDirection )
     if ( m_aBookmark.hasValue() )
     {
         if (_ePrepareForDirection == MOVE_NONE_REFRESH ||
+            (m_pCache->isAfterLast() != isAfterLast()) || ( m_pCache->isBeforeFirst() != isBeforeFirst() ) ||
              m_pCache->compareBookmarks( m_aBookmark, m_pCache->getBookmark() ) != CompareBookmark::EQUAL )
             bSuccess = m_pCache->moveToBookmark( m_aBookmark );
         else
commit ccceac2a91204a1f03316fba59ba32946470ef94
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Sat May 30 14:33:16 2015 +0200

    handle getParameters being called before execute()
    
    Change-Id: If81e745ee15df3848c6577a9e979672523718daf

diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index 619f5a7..dcbacf4 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -1624,10 +1624,17 @@ void ORowSet::setStatementResultSetType( const Reference< XPropertySet >& _rxSta
     _rxStatement->setPropertyValue( PROPERTY_RESULTSETCONCURRENCY, makeAny( nResultSetConcurrency ) );
 }
 
-void ORowSet::impl_makeNewStatement_throw()
+void ORowSet::impl_ensureStatement_throw()
 {
     OUString sCommandToExecute;
-    impl_initComposer_throw( sCommandToExecute );
+    if(m_bCommandFacetsDirty)
+    {
+        impl_initComposer_throw( sCommandToExecute );
+    }
+    else
+    {
+        sCommandToExecute = m_bUseEscapeProcessing ? m_xComposer->getQueryWithSubstitution() : m_aActiveCommand;
+    }
 
     try
     {
@@ -1672,8 +1679,7 @@ void ORowSet::impl_makeNewStatement_throw()
 
 Reference< XResultSet > ORowSet::impl_prepareAndExecute_throw()
 {
-    if(m_bCommandFacetsDirty)
-        impl_makeNewStatement_throw();
+    impl_ensureStatement_throw();
 
     m_aParameterValueForCache.get().resize(1);
     Reference< XParameters > xParam( m_xStatement, UNO_QUERY_THROW );
diff --git a/dbaccess/source/core/api/RowSet.hxx b/dbaccess/source/core/api/RowSet.hxx
index 596969d..19e50f5 100644
--- a/dbaccess/source/core/api/RowSet.hxx
+++ b/dbaccess/source/core/api/RowSet.hxx
@@ -197,7 +197,7 @@ namespace dbaccess
         */
         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >
                         impl_prepareAndExecute_throw();
-        void            impl_makeNewStatement_throw();
+        void            impl_ensureStatement_throw();
 
         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >  calcConnection(const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxHandler) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
         // free clones and ParseTree. Plus, if _bComplete is <TRUE/>, *all* other associated resources
commit bd09c6a0ba4ab179e549812d456a1674ab3ae6e8
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Sat May 30 14:25:54 2015 +0200

    tdf#82591 ORowSetBase::getRow handles insert row correctly
    
    and critically for this bug, modified row, too.
    
    Change-Id: I11c418d8926cabe81fcdb65d7293a4283e566f7a

diff --git a/dbaccess/qa/complex/dbaccess/RowSet.java b/dbaccess/qa/complex/dbaccess/RowSet.java
index ad0968a..211aa2d 100644
--- a/dbaccess/qa/complex/dbaccess/RowSet.java
+++ b/dbaccess/qa/complex/dbaccess/RowSet.java
@@ -207,6 +207,9 @@ public class RowSet extends TestCase
         // absolute positioning
         testAbsolutePositioning(m_resultSet, m_row);
 
+        // position during modify
+        testModifyPosition(m_resultSet, m_row);
+
         // 3rd test
         test3(createClone(), m_resultSet);
         // 4th test
@@ -289,6 +292,24 @@ public class RowSet extends TestCase
     }
 
 
+    void testModifyPosition(XResultSet _resultSet, XRow _row)
+    {
+        try
+        {
+            final int testPos = 3;
+            assertTrue("testModifyPosition wants at least " + (testPos+1) + " rows", MAX_FETCH_ROWS >= testPos+1);
+            assertTrue("testModifyPosition failed on moving to row " + testPos, _resultSet.absolute(testPos));
+            UnoRuntime.queryInterface( XRowUpdate.class, _row ).updateString(2, TEST21);
+            testPosition(_resultSet, _row, testPos, "testModifyPosition");
+            UnoRuntime.queryInterface( XResultSetUpdate.class, _resultSet ).cancelRowUpdates();
+        }
+        catch (Exception e)
+        {
+            fail("testModifyPosition failed: " + e);
+        }
+    }
+
+
     void test3(XResultSet clone, XResultSet _resultSet)
     {
         try
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index 69b3571..619f5a7 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -929,15 +929,6 @@ void SAL_CALL ORowSet::insertRow(  ) throw(SQLException, RuntimeException, std::
     fireRowcount();
 }
 
-sal_Int32 SAL_CALL ORowSet::getRow(  ) throw(SQLException, RuntimeException, std::exception)
-{
-    ::osl::MutexGuard aGuard( *m_pMutex );
-    checkCache();
-
-    // check if we are inserting a row
-    return (m_pCache && isInsertRow()) ? 0 : ORowSetBase::getRow();
-}
-
 void SAL_CALL ORowSet::updateRow(  ) throw(SQLException, RuntimeException, std::exception)
 {
     ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
@@ -1517,7 +1508,7 @@ Reference< XIndexAccess > SAL_CALL ORowSet::getParameters(  ) throw (RuntimeExce
         }
         catch( const Exception& )
         {
-            // silence it
+            DBG_UNHANDLED_EXCEPTION();
         }
     }
 
diff --git a/dbaccess/source/core/api/RowSet.hxx b/dbaccess/source/core/api/RowSet.hxx
index aae5b7f..596969d 100644
--- a/dbaccess/source/core/api/RowSet.hxx
+++ b/dbaccess/source/core/api/RowSet.hxx
@@ -287,7 +287,6 @@ namespace dbaccess
         virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
 
     // ::com::sun::star::sdbc::XResultSet
-        virtual sal_Int32 SAL_CALL getRow(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
         virtual void SAL_CALL refreshRow(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
     // XCompletedExecution


More information about the Libreoffice-commits mailing list