[Libreoffice-commits] .: Branch 'feature/mork' - connectivity/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Sep 13 15:16:21 PDT 2012


 connectivity/source/drivers/mork/MConnection.hxx  |    1 
 connectivity/source/drivers/mork/MQueryHelper.cxx |   21 ++++++++++++
 connectivity/source/drivers/mork/MQueryHelper.hxx |    2 +
 connectivity/source/drivers/mork/MResultSet.cxx   |   37 +++++++++++++---------
 4 files changed, 45 insertions(+), 16 deletions(-)

New commits:
commit f1f40a616b905a62fb9c6fc1bb6af30262debb0b
Author: David Ostrovsky <david at ostrovsky.org>
Date:   Fri Sep 14 00:07:07 2012 +0200

    mork driver: get rid of infinite loop.
    
    Many thanks to Michael Stahl for helping out
    with debugging it. The problem was, that soffice.bin
    grabbed the mouse and keyboard. Michael pointed me out
    to alternate Xephyr X-Server. With it it was the matter
    of 5 min. to attach a debugger to soffice.bin and to
    find the problem.
    
    Change-Id: Ic8340fbd87e65945b12f4a928c73fa23a439d9f4

diff --git a/connectivity/source/drivers/mork/MConnection.hxx b/connectivity/source/drivers/mork/MConnection.hxx
index 72cf592..fd478ff 100644
--- a/connectivity/source/drivers/mork/MConnection.hxx
+++ b/connectivity/source/drivers/mork/MConnection.hxx
@@ -109,7 +109,6 @@ namespace connectivity
             // Added to enable me to use SQLInterpreter which requires an
             // XNameAccess i/f to access tables.
             ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL createCatalog();
-
         };
     }
 }
diff --git a/connectivity/source/drivers/mork/MQueryHelper.cxx b/connectivity/source/drivers/mork/MQueryHelper.cxx
index 6b4e351..7803d67 100644
--- a/connectivity/source/drivers/mork/MQueryHelper.cxx
+++ b/connectivity/source/drivers/mork/MQueryHelper.cxx
@@ -158,6 +158,26 @@ sal_Int32 MQueryHelper::getResultCount() const
 
 // -------------------------------------------------------------------------
 
+sal_Bool MQueryHelper::queryComplete() const
+{
+    return sal_True;
+}
+
+sal_Bool MQueryHelper::checkRowAvailable( sal_Int32 nDBRow )
+{
+/*
+    while (!queryComplete() && getResultCount() <= (sal_uInt32)nDBRow)
+    {
+        if ( !m_aQueryHelper->waitForRow( nDBRow ) ) {
+            m_aError = m_aQueryHelper->getError();
+            return( sal_False );
+        }
+    }
+*/
+    return( getResultCount() > nDBRow );
+}
+
+
 sal_Bool MQueryHelper::getRowValue( ORowSetValue& rValue, sal_Int32 nDBRow,const rtl::OUString& aDBColumnName, sal_Int32 nType )
 {
     SAL_INFO("connectivity.mork", "MQueryHelper::getRowValue()" );
@@ -185,6 +205,7 @@ sal_Bool MQueryHelper::getRowValue( ORowSetValue& rValue, sal_Int32 nDBRow,const
 
 sal_Int32 MQueryHelper::executeQuery(OConnection* xConnection)
 {
+//    OSL_FAIL( "MQueryHelper::executeQuery" );
     SAL_INFO("connectivity.mork", "MQueryHelper::executeQuery()" );
     reset();
 
diff --git a/connectivity/source/drivers/mork/MQueryHelper.hxx b/connectivity/source/drivers/mork/MQueryHelper.hxx
index 2d186a8..8275837 100644
--- a/connectivity/source/drivers/mork/MQueryHelper.hxx
+++ b/connectivity/source/drivers/mork/MQueryHelper.hxx
@@ -82,7 +82,9 @@ namespace connectivity
             MQueryHelperResultEntry*   next();
             MQueryHelperResultEntry*   getByIndex( sal_uInt32 nRow );
             sal_Bool                   isError() const;
+            sal_Bool                   queryComplete() const;
             sal_Int32                  getResultCount() const;
+            sal_Bool                   checkRowAvailable( sal_Int32 nDBRow );
             sal_Bool getRowValue( ORowSetValue& rValue, sal_Int32 nDBRow,const rtl::OUString& aDBColumnName, sal_Int32 nType );
             sal_Int32 executeQuery(OConnection* xConnection);
         };
diff --git a/connectivity/source/drivers/mork/MResultSet.cxx b/connectivity/source/drivers/mork/MResultSet.cxx
index d7d7117..8363901 100644
--- a/connectivity/source/drivers/mork/MResultSet.cxx
+++ b/connectivity/source/drivers/mork/MResultSet.cxx
@@ -467,8 +467,8 @@ sal_Bool SAL_CALL OResultSet::isAfterLast(  ) throw(SQLException, RuntimeExcepti
     ResultSetEntryGuard aGuard( *this );
 
     OSL_TRACE("In/Out: OResultSet::isAfterLast" );
-    return sal_True;
-//    return m_nRowPos > currentRowCount() && m_aQuery.queryComplete();
+//    return sal_True;
+    return m_nRowPos > currentRowCount() && m_aQueryHelper.queryComplete();
 }
 // -------------------------------------------------------------------------
 sal_Bool SAL_CALL OResultSet::isFirst(  ) throw(SQLException, RuntimeException)
@@ -485,8 +485,8 @@ sal_Bool SAL_CALL OResultSet::isLast(  ) throw(SQLException, RuntimeException)
     ResultSetEntryGuard aGuard( *this );
 
     OSL_TRACE("In/Out: OResultSet::isLast" );
-    return sal_True;
-//    return m_nRowPos == currentRowCount() && m_aQuery.queryComplete();
+//    return sal_True;
+    return m_nRowPos == currentRowCount() && m_aQueryHelper.queryComplete();
 }
 // -------------------------------------------------------------------------
 void SAL_CALL OResultSet::beforeFirst(  ) throw(SQLException, RuntimeException)
@@ -1486,34 +1486,41 @@ sal_Bool OResultSet::isCount() const
 //
 // Check for valid row in m_aQuery
 //
-sal_Bool OResultSet::validRow( sal_uInt32 /*nRow*/ )
+sal_Bool OResultSet::validRow( sal_uInt32 nRow)
 {
-    OSL_FAIL( "OResultSet::validRow() is not implemented" );
+//    OSL_FAIL( "OResultSet::validRow() is not implemented" );
 
-/*
-    sal_Int32  nNumberOfRecords = m_aQuery.getRealRowCount();
 
-    while ( nRow > (sal_uInt32)nNumberOfRecords && !m_aQuery.queryComplete() ) {
+    sal_Int32  nNumberOfRecords = m_aQueryHelper.getResultCount();
+//m_aQuery.getRealRowCount();
+
+    while ( nRow > (sal_uInt32)nNumberOfRecords && !m_aQueryHelper.queryComplete() ) {
 #if OSL_DEBUG_LEVEL > 0
             OSL_TRACE("validRow: waiting...");
 #endif
-            m_aQuery.checkRowAvailable( nRow );
+            if (m_aQueryHelper.checkRowAvailable( nRow ) == sal_False)
+            {
+                OSL_TRACE("validRow(%u): return False", nRow);
+                return sal_False;
+            }
+#if 0
             if ( m_aQuery.hadError() )
             {
                 m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this );
             }
-            nNumberOfRecords = m_aQuery.getRealRowCount();
+#endif
+            nNumberOfRecords = m_aQueryHelper.getResultCount();
     }
 
     if (( nRow == 0 ) ||
-        ( nRow > (sal_uInt32)nNumberOfRecords && m_aQuery.queryComplete()) ){
+        ( nRow > (sal_uInt32)nNumberOfRecords && m_aQueryHelper.queryComplete()) ){
         OSL_TRACE("validRow(%u): return False", nRow);
         return sal_False;
     }
 #if OSL_DEBUG_LEVEL > 0
     OSL_TRACE("validRow(%u): return True", nRow);
 #endif
-*/
+
     return sal_True;
 }
 sal_Bool OResultSet::fillKeySet(sal_Int32 nMaxCardNumber)
@@ -1596,16 +1603,16 @@ sal_Bool OResultSet::seekRow( eRowPosition pos, sal_Int32 nOffset )
     else    //The requested row has not been retrived until now. We should get the right card for it.
         nCurCard = nCurPos + deletedCount();
 
-    while ( nCurCard > nNumberOfRecords ) {
 /*
+    while ( nCurCard > nNumberOfRecords ) {
             m_aQuery.checkRowAvailable( nCurCard );
             if ( m_aQuery.hadError() )
             {
                 m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this );
             }
-*/
             nNumberOfRecords = m_aQueryHelper.getResultCount();
     }
+*/
 
     if ( nCurCard > nNumberOfRecords) {
         fillKeySet(nNumberOfRecords);


More information about the Libreoffice-commits mailing list