[Libreoffice-commits] core.git: 4 commits - connectivity/source

Lionel Elie Mamane lionel at mamane.lu
Sat Nov 30 03:04:07 PST 2013


 connectivity/source/drivers/file/FResultSet.cxx |    6 ++++-
 connectivity/source/drivers/flat/ETable.cxx     |   26 +++++-------------------
 connectivity/source/inc/flat/ETable.hxx         |    2 -
 3 files changed, 12 insertions(+), 22 deletions(-)

New commits:
commit 56ad826194d0b9b42ed8bde35836b0e59c46baa6
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Sat Nov 30 11:58:39 2013 +0100

    flat text DB: fix move by bookmark
    
    To test whether the range [a,b( is *before* e,
    compare e to b, not to a.
    
    This makes a difference when a==b, which happens for row 0 (header)
    when there is no header.
    
    Change-Id: I629b71936f82a468febe0360909264dd80304437

diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx
index 2fefbaa..bcc866d 100644
--- a/connectivity/source/drivers/flat/ETable.cxx
+++ b/connectivity/source/drivers/flat/ETable.cxx
@@ -756,22 +756,13 @@ void OFlatTable::refreshHeader()
 // -----------------------------------------------------------------------------
 namespace
 {
-    template< typename Tp, typename Te> struct PairFirstLess
+    template< typename Tp, typename Te> struct RangeBefore
     {
         bool operator() (const Tp &p, const Te &e)
         {
-            return p.first < e;
+            assert(p.first <= p.second);
+            return p.second <= e;
         }
-#ifdef DBG_UTIL
-        bool operator() (const Te &e, const Tp &p)
-        {
-            return e < p.first;
-        }
-        bool operator() (const Tp &p1, const Tp &p2)
-        {
-            return p1.first < p2.first;
-        }
-#endif
     };
 }
 // -----------------------------------------------------------------------------
@@ -910,7 +901,7 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int
                 vector< TRowPositionInFile >::const_iterator aFind = lower_bound(m_aRowPosToFilePos.begin(),
                                                                                  m_aRowPosToFilePos.end(),
                                                                                  nOffset,
-                                                                                 PairFirstLess< TRowPositionInFile, sal_Int32 >());
+                                                                                 RangeBefore< TRowPositionInFile, sal_Int32 >());
 
                 if(aFind == m_aRowPosToFilePos.end() || aFind->first != nOffset)
                     //invalid bookmark
commit 3a89da0b66b35e4ea322bbaea6b0dbcc183c3082
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Sat Nov 30 11:55:26 2013 +0100

    debug mode is OSL_DEBUG_LEVEL > 0, not > 1
    
    Change-Id: I39465b1b22a537de95db9f65b04ecf4bce667d0c

diff --git a/connectivity/source/inc/flat/ETable.hxx b/connectivity/source/inc/flat/ETable.hxx
index eb6e80a..09cbb59 100644
--- a/connectivity/source/inc/flat/ETable.hxx
+++ b/connectivity/source/inc/flat/ETable.hxx
@@ -65,7 +65,7 @@ namespace connectivity
                                              const sal_Unicode cDecimalDelimiter, const sal_Unicode cThousandDelimiter, const CharClass& aCharClass);
             OFlatConnection* getFlatConnection()
             {
-#if OSL_DEBUG_LEVEL>1
+#if OSL_DEBUG_LEVEL > 0
                 OFlatConnection* pConnection = dynamic_cast<OFlatConnection*>(m_pConnection);
                 assert(pConnection);
 #else
commit c0285abc4b3b128b0ab1cfc5689fef13e086db8e
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Sat Nov 30 11:55:03 2013 +0100

    factorise code
    
    Change-Id: Ifd1829843886b8c58669fd4ccf04bc35bf4a0e10

diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx
index f30f467..2fefbaa 100644
--- a/connectivity/source/drivers/flat/ETable.cxx
+++ b/connectivity/source/drivers/flat/ETable.cxx
@@ -127,7 +127,6 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale)
     // read description
     const sal_Unicode cDecimalDelimiter  = pConnection->getDecimalDelimiter();
     const sal_Unicode cThousandDelimiter = pConnection->getThousandDelimiter();
-    OUString aColumnName;
     ::comphelper::UStringMixEqual aCase(bCase);
     vector<OUString> aColumnNames;
     vector<OUString> m_aTypeNames;
@@ -144,17 +143,13 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale)
         {
             if ( nRowCount == 0)
             {
+                OUString aColumnName;
                 if ( bHasHeaderLine )
                 {
                     aColumnName = aHeaderLine.GetTokenSpecial(nStartPosHeaderLine,m_cFieldDelimiter,m_cStringDelimiter);
-                    if ( !aColumnName.getLength() )
-                    {
-                        aColumnName = "C" + OUString::number(i+1);
-                    }
                 }
-                else
+                if ( aColumnName.isEmpty() )
                 {
-                    // no column name so ...
                     aColumnName = "C" + OUString::number(i+1);
                 }
                 aColumnNames.push_back(aColumnName);
commit 7a64727f790f001ec42dafe38caeb86dfb6ddab1
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Sat Nov 30 11:54:20 2013 +0100

    fdo#72148 if expecting table at begin, explicitly set it so
    
    Change-Id: Ic876603e5860b987280b73726fd79a071a9c833c

diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx
index 58aa810..63c77c7 100644
--- a/connectivity/source/drivers/file/FResultSet.cxx
+++ b/connectivity/source/drivers/file/FResultSet.cxx
@@ -1098,7 +1098,11 @@ sal_Bool OResultSet::Move(IResultSetHelper::Movement eCursorPosition, sal_Int32
                 else // Index must be further constructed
                 {
                     // set first on the last known row
-                    if (!m_pFileSet->get().empty())
+                    if (m_pFileSet->get().empty())
+                    {
+                        m_pTable->seekRow(IResultSetHelper::ABSOLUTE, 0, m_nFilePos);
+                    }
+                    else
                     {
                         m_aFileSetIter = m_pFileSet->get().end()-1;
                         m_pTable->seekRow(IResultSetHelper::BOOKMARK, *m_aFileSetIter, m_nFilePos);


More information about the Libreoffice-commits mailing list