[Libreoffice-commits] core.git: 12 commits - connectivity/source dbaccess/Library_dba.mk dbaccess/source include/sal wizards/com

Lionel Elie Mamane lionel at mamane.lu
Sun May 19 05:06:06 PDT 2013


 connectivity/source/commontools/TSkipDeletedSet.cxx        |    4 
 connectivity/source/drivers/file/FResultSet.cxx            |   63 +-
 connectivity/source/drivers/flat/ETable.cxx                |  335 +++++++------
 connectivity/source/inc/file/FResultSet.hxx                |   10 
 connectivity/source/inc/flat/ETable.hxx                    |   28 -
 dbaccess/Library_dba.mk                                    |    1 
 dbaccess/source/core/api/SingleSelectQueryComposer.cxx     |    6 
 dbaccess/source/core/inc/SingleSelectQueryComposer.hxx     |    2 
 include/sal/log-areas.dox                                  |    1 
 wizards/com/sun/star/wizards/common/Configuration.java     |   42 +
 wizards/com/sun/star/wizards/db/DBMetaData.java            |    4 
 wizards/com/sun/star/wizards/table/CGTable.java            |    2 
 wizards/com/sun/star/wizards/table/ScenarioSelector.java   |    2 
 wizards/com/sun/star/wizards/table/TableWizard.java        |    4 
 wizards/com/sun/star/wizards/ui/CommandFieldSelection.java |    2 
 wizards/com/sun/star/wizards/ui/FilterComponent.java       |   11 
 16 files changed, 302 insertions(+), 215 deletions(-)

New commits:
commit 7bcebc31ed3d6693d0d747bebab4b82bc7c2062c
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Sun May 19 13:21:27 2013 +0200

    java wizard FilterComponent: TODO annotations
    
    Change-Id: I43ce0793306815988e39ba0735abd68f2022eaea

diff --git a/wizards/com/sun/star/wizards/ui/FilterComponent.java b/wizards/com/sun/star/wizards/ui/FilterComponent.java
index 32cdceb..a75eb55 100644
--- a/wizards/com/sun/star/wizards/ui/FilterComponent.java
+++ b/wizards/com/sun/star/wizards/ui/FilterComponent.java
@@ -270,6 +270,7 @@ public class FilterComponent
                             case DataType.DATE:
                                 value = ((Double) value) - oQueryMetaData.getNullDateCorrection();
                                 break;
+                                // TODO: TIME case?
                         }
                         column.removeProperty("Value");
                         final short operator = currentControlRow.getSelectedOperator();
@@ -777,10 +778,12 @@ public class FilterComponent
                     String sValue = AnyConverter.toString(_filtercondition.Value);
                     if (sValue.indexOf("{D '") > -1)
                     {
+                        // TODO: this seems to never happen?
                         sValue = JavaTools.replaceSubString(sValue, PropertyNames.EMPTY_STRING, "{D '");
                         sValue = JavaTools.replaceSubString(sValue, PropertyNames.EMPTY_STRING, "' }");
                         try
                         {
+                            //Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "EffectiveValue", );
                             oQueryMetaData.getNumberFormatter().convertStringToNumber(iDateFormat, sValue);
                         }
                         catch (java.lang.Exception ex)
@@ -790,10 +793,12 @@ public class FilterComponent
                     }
                     else if (sValue.indexOf("{T '") > -1)
                     {
+                        // TODO: this seems to never happen?
                         sValue = JavaTools.replaceSubString(sValue, PropertyNames.EMPTY_STRING, "{T '");
                         sValue = JavaTools.replaceSubString(sValue, PropertyNames.EMPTY_STRING, "' }");
                         try
                         {
+                            //Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "EffectiveValue", );
                             oQueryMetaData.getNumberFormatter().convertStringToNumber(iTimeFormat, sValue);
                         }
                         catch (java.lang.Exception ex)
@@ -801,6 +806,12 @@ public class FilterComponent
                             Logger.getLogger(FilterComponent.class.getName()).log(Level.SEVERE, null, ex);
                         }
                     }
+                    // TODO: TS case?
+                    //TODO: other datetime formats?
+                    else
+                    {
+                        //Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "EffectiveValue", sValue);
+                    }
                 }
                 else if (AnyConverter.isBoolean(_filtercondition.Value))
                 {
commit 48b29cd42ba10fbb3f7be697fd79a0984b4daa1b
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Sun May 19 13:20:51 2013 +0200

    flat db driver: reorganise OFlatTable
    
    Change-Id: I5d522abdffaf1aeb4ae0996d3a19acdcca474f95

diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx
index bbb5706..f777e63 100644
--- a/connectivity/source/drivers/flat/ETable.cxx
+++ b/connectivity/source/drivers/flat/ETable.cxx
@@ -60,38 +60,51 @@ using namespace ::com::sun::star::sdbc;
 using namespace ::com::sun::star::container;
 using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::util;
+using std::vector;
+using std::lower_bound;
 
 // -------------------------------------------------------------------------
 void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale)
 {
     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen at sun.com", "OFlatTable::fillColumns" );
-    sal_Bool bRead = sal_True;
+    m_bNeedToReadLine = true; // we overwrite m_aCurrentLine, seek the stream, ...
+    m_pFileStream->Seek(0);
+    m_aCurrentLine = QuotedTokenizedString();
+    bool bRead = true;
+
+    const OFlatConnection* const pConnection = getFlatConnection();
+    const bool bHasHeaderLine = pConnection->isHeaderLine();
 
     QuotedTokenizedString aHeaderLine;
-    OFlatConnection* pConnection = (OFlatConnection*)m_pConnection;
-    const rtl_TextEncoding nEncoding = m_pConnection->getTextEncoding();
-    const sal_Bool bHasHeaderLine = pConnection->isHeaderLine();
+    TRowPositionInFile rowPos(0, 0);
+    sal_Int32 rowNum(0);
     if ( bHasHeaderLine )
     {
-        while(bRead && !aHeaderLine.Len())
-        {
-            bRead = m_pFileStream->ReadByteStringLine(aHeaderLine,nEncoding);
-        }
-        m_nStartRowFilePos = m_pFileStream->Tell();
+        bRead = readLine(&rowPos.second, &rowPos.first, true);
+        if(bRead)
+            aHeaderLine = m_aCurrentLine;
     }
+    setRowPos(rowNum++, rowPos);
 
     // read first row
     QuotedTokenizedString aFirstLine;
-    bRead = m_pFileStream->ReadByteStringLine(aFirstLine,nEncoding);
+    if(bRead)
+    {
+        bRead = readLine(&rowPos.second, &rowPos.first, false);
+        if(bRead)
+            setRowPos(rowNum++, rowPos);
+    }
 
     if ( !bHasHeaderLine || !aHeaderLine.Len())
     {
-        while(bRead && !aFirstLine.Len())
+        // use first non-empty row as headerline because we need the number of columns
+        while(bRead && m_aCurrentLine.Len() == 0)
         {
-            bRead = m_pFileStream->ReadByteStringLine(aFirstLine,nEncoding);
+            bRead = readLine(&rowPos.second, &rowPos.first, false);
+            if(bRead)
+                setRowPos(rowNum++, rowPos);
         }
-        // use first row as headerline because we need the number of columns
-        aHeaderLine = aFirstLine;
+        aHeaderLine = m_aCurrentLine;
     }
     // column count
     const xub_StrLen nFieldCount = aHeaderLine.GetTokenCount(m_cFieldDelimiter,m_cStringDelimiter);
@@ -117,15 +130,16 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale)
     const sal_Unicode cThousandDelimiter = pConnection->getThousandDelimiter();
     OUString aColumnName;
     ::comphelper::UStringMixEqual aCase(bCase);
-    ::std::vector<OUString> aColumnNames;
-    ::std::vector<String> m_aTypeNames;
+    vector<OUString> aColumnNames;
+    vector<String> m_aTypeNames;
     m_aTypeNames.resize(nFieldCount);
     const sal_Int32 nMaxRowsToScan = pConnection->getMaxRowsToScan();
     sal_Int32 nRowCount = 0;
+
     do
     {
-        xub_StrLen nStartPosHeaderLine = 0; // use for eficient way to get the tokens
-        xub_StrLen nStartPosFirstLine = 0; // use for eficient way to get the tokens
+        xub_StrLen nStartPosHeaderLine = 0; // use for efficient way to get the tokens
+        xub_StrLen nStartPosFirstLine = 0; // use for efficient way to get the tokens
         xub_StrLen nStartPosFirstLine2 = 0;
         for (xub_StrLen i = 0; i < nFieldCount; i++)
         {
@@ -146,11 +160,15 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale)
                 }
                 aColumnNames.push_back(aColumnName);
             }
-            impl_fillColumnInfo_nothrow(aFirstLine,nStartPosFirstLine,nStartPosFirstLine2,m_aTypes[i],m_aPrecisions[i],m_aScales[i],m_aTypeNames[i],cDecimalDelimiter,cThousandDelimiter,aCharClass);
+            if(bRead)
+                impl_fillColumnInfo_nothrow(m_aCurrentLine,nStartPosFirstLine,nStartPosFirstLine2,m_aTypes[i],m_aPrecisions[i],m_aScales[i],m_aTypeNames[i],cDecimalDelimiter,cThousandDelimiter,aCharClass);
         }
         ++nRowCount;
+        bRead = readLine(&rowPos.second, &rowPos.first, false);
+        if(bRead)
+            setRowPos(rowNum++, rowPos);
     }
-    while(nRowCount < nMaxRowsToScan && m_pFileStream->ReadByteStringLine(aFirstLine,nEncoding) && !m_pFileStream->IsEof());
+    while(nRowCount < nMaxRowsToScan && bRead);
 
     for (xub_StrLen i = 0; i < nFieldCount; i++)
     {
@@ -177,7 +195,8 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale)
         Reference< XPropertySet> xCol = pColumn;
         m_aColumns->get().push_back(xCol);
     }
-    m_pFileStream->Seek(m_nStartRowFilePos);
+
+    m_pFileStream->Seek(m_aRowPosToFilePos[0].second);
 }
 void OFlatTable::impl_fillColumnInfo_nothrow(QuotedTokenizedString& aFirstLine,xub_StrLen& nStartPosFirstLine,xub_StrLen& nStartPosFirstLine2
                                              ,sal_Int32& io_nType,sal_Int32& io_nPrecisions,sal_Int32& io_nScales,String& o_sTypeName
@@ -400,7 +419,6 @@ OFlatTable::OFlatTable(sdbcx::OCollection* _pTables,OFlatConnection* _pConnectio
                                   _Description,
                                   _SchemaName,
                                   _CatalogName)
-    ,m_nStartRowFilePos(0)
     ,m_nRowPos(0)
     ,m_nMaxRowCount(0)
     ,m_cStringDelimiter(_pConnection->getStringDelimiter())
@@ -530,7 +548,7 @@ void SAL_CALL OFlatTable::disposing(void)
 Sequence< Type > SAL_CALL OFlatTable::getTypes(  ) throw(RuntimeException)
 {
     Sequence< Type > aTypes = OTable_TYPEDEF::getTypes();
-    ::std::vector<Type> aOwnTypes;
+    vector<Type> aOwnTypes;
     aOwnTypes.reserve(aTypes.getLength());
     const Type* pBegin = aTypes.getConstArray();
     const Type* pEnd = pBegin + aTypes.getLength();
@@ -589,27 +607,29 @@ sal_Int64 OFlatTable::getSomething( const Sequence< sal_Int8 > & rId ) throw (Ru
                 : OFlatTable_BASE::getSomething(rId);
 }
 //------------------------------------------------------------------
-sal_Bool OFlatTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols,sal_Bool bIsTable,sal_Bool bRetrieveData)
+sal_Bool OFlatTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns & _rCols, sal_Bool bIsTable, sal_Bool bRetrieveData)
 {
     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen at sun.com", "OFlatTable::fetchRow" );
     *(_rRow->get())[0] = m_nFilePos;
 
     if (!bRetrieveData)
         return sal_True;
+
+    sal_Bool result = sal_False;
     if ( m_bNeedToReadLine )
     {
-        sal_Int32 nCurrentPos = 0;
         m_pFileStream->Seek(m_nFilePos);
-        readLine(nCurrentPos);
-        m_bNeedToReadLine = false;
+        TRowPositionInFile rowPos(0, 0);
+        if(readLine(&rowPos.second, &rowPos.first))
+        {
+            setRowPos(m_nRowPos, rowPos);
+            m_bNeedToReadLine = false;
+            result = sal_True;
+        }
+        // else let run through so that we set _rRow to all NULL
     }
 
-#if OSL_DEBUG_LEVEL>1
-    OFlatConnection* pConnection = dynamic_cast<OFlatConnection*>(m_pConnection);
-    assert(pConnection);
-#else
-    OFlatConnection* pConnection = static_cast<OFlatConnection*>(m_pConnection);
-#endif
+    const OFlatConnection * const pConnection = getFlatConnection();
     const sal_Unicode cDecimalDelimiter = pConnection->getDecimalDelimiter();
     const sal_Unicode cThousandDelimiter = pConnection->getThousandDelimiter();
     // Fields:
@@ -617,7 +637,8 @@ sal_Bool OFlatTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols,sal
     OSQLColumns::Vector::const_iterator aIter = _rCols.get().begin();
     OSQLColumns::Vector::const_iterator aEnd = _rCols.get().end();
     const OValueRefVector::Vector::size_type nCount = _rRow->get().size();
-    for (OValueRefVector::Vector::size_type i = 1; aIter != aEnd && i < nCount;
+    for (OValueRefVector::Vector::size_type i = 1;
+         aIter != aEnd && i < nCount;
          ++aIter, i++)
     {
         String aStr = m_aCurrentLine.GetTokenSpecial(nStartPos,m_cFieldDelimiter,m_cStringDelimiter);
@@ -724,11 +745,22 @@ sal_Bool OFlatTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols,sal
             (_rRow->get())[i]->setTypeKind(nType);
         }
     }
-    return sal_True;
+    return result;
 }
+
+// -----------------------------------------------------------------------------
 void OFlatTable::refreshHeader()
 {
-    m_nRowPos = 0;
+    RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "lionel at mamane.lu", "OFlatTable::refreshHeader" );
+}
+
+// -----------------------------------------------------------------------------
+namespace
+{
+    template< typename Tp, typename Te> bool pairFirstLess(const Tp &p, const Te &e)
+    {
+        return p.first < e;
+    }
 }
 // -----------------------------------------------------------------------------
 sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos)
@@ -736,8 +768,6 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int
     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen at sun.com", "OFlatTable::seekRow" );
     OSL_ENSURE(m_pFileStream,"OFlatTable::seekRow: FileStream is NULL!");
     // ----------------------------------------------------------
-    // Prepare positioning:
-    m_nFilePos = nCurPos;
 
     switch(eCursorPosition)
     {
@@ -746,29 +776,37 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int
             // run through
         case IResultSetHelper::NEXT:
             {
+                assert(m_nRowPos >= 0);
                 if(m_nMaxRowCount != 0 && m_nRowPos > m_nMaxRowCount)
                     return sal_False;
                 ++m_nRowPos;
-                ::std::map<sal_Int32,TRowPositionsInFile::iterator>::const_iterator aFind = m_aRowPosToFilePos.find(m_nRowPos);
-                m_bNeedToReadLine = aFind != m_aRowPosToFilePos.end();
-                if ( m_bNeedToReadLine )
+                if(m_aRowPosToFilePos.size() > static_cast< vector< TRowPositionInFile >::size_type >(m_nRowPos))
                 {
-                    m_nFilePos  = aFind->second->first;
-                    nCurPos     = aFind->second->second;
-                } // if ( m_bNeedToReadLine )
+                    m_bNeedToReadLine = true;
+                    m_nFilePos  = m_aRowPosToFilePos[m_nRowPos].first;
+                    nCurPos     = m_aRowPosToFilePos[m_nRowPos].second;
+                }
                 else
                 {
-                    if ( m_nRowPos == 1 )
-                        m_nFilePos = m_nStartRowFilePos;
+                    assert(m_aRowPosToFilePos.size() == static_cast< vector< TRowPositionInFile >::size_type >(m_nRowPos));
+                    const TRowPositionInFile &lastRowPos(m_aRowPosToFilePos.back());
+                    // Our ResultSet is allowed to disagree with us only
+                    // on the position of the first line
+                    // (because of the special case of the header...)
+                    assert(m_nRowPos == 1 || nCurPos == lastRowPos.second);
+
+                    m_nFilePos = lastRowPos.second;
                     m_pFileStream->Seek(m_nFilePos);
-                    if ( m_pFileStream->IsEof() || !readLine(nCurPos) /*|| !checkHeaderLine()*/)
+
+                    TRowPositionInFile newRowPos;
+                    if(!readLine(&newRowPos.second, &newRowPos.first, false))
                     {
-                        m_nMaxRowCount = m_nRowPos -1;
+                        m_nMaxRowCount = m_nRowPos - 1;
                         return sal_False;
-                    } // if ( m_pFileStream->IsEof() || !readLine(nCurPos) /*|| !checkHeaderLine()*/)
+                    }
 
-                    TRowPositionsInFile::iterator aPos = m_aFilePosToEndLinePos.insert(TRowPositionsInFile::value_type(m_nFilePos,nCurPos)).first;
-                    m_aRowPosToFilePos.insert(::std::map<sal_Int32,TRowPositionsInFile::iterator>::value_type(m_nRowPos,aPos));
+                    nCurPos = newRowPos.second;
+                    setRowPos(m_nRowPos, newRowPos);
                 }
             }
 
@@ -781,39 +819,29 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int
 
             --m_nRowPos;
             {
-                assert(m_aRowPosToFilePos.find(m_nRowPos) != m_aRowPosToFilePos.end());
-                TRowPositionsInFile::iterator aPositions = m_aRowPosToFilePos[m_nRowPos];
-                m_nFilePos = aPositions->first;
-                nCurPos = aPositions->second;
+                assert (m_nRowPos >= 0);
+                assert(m_aRowPosToFilePos.size() >= static_cast< vector< TRowPositionInFile >::size_type >(m_nRowPos));
+                const TRowPositionInFile &aPositions(m_aRowPosToFilePos[m_nRowPos]);
+                m_nFilePos = aPositions.first;
+                nCurPos = aPositions.second;
                 m_bNeedToReadLine = true;
             }
 
             break;
         case IResultSetHelper::LAST:
-            if ( m_nMaxRowCount )
+            if (m_nMaxRowCount == 0)
             {
-                ::std::map<sal_Int32,TRowPositionsInFile::iterator>::reverse_iterator aLastPos = m_aRowPosToFilePos.rbegin();
-                m_nRowPos  = aLastPos->first;
-                m_nFilePos = aLastPos->second->first;
-                nCurPos    = aLastPos->second->second;
-
-                //m_pFileStream->Seek(m_nFilePos);
-                m_bNeedToReadLine = true;
-                //if ( m_pFileStream->IsEof() /*|| !checkHeaderLine()*/ || !readLine(nCurPos) )
-                //  return sal_False;
-            }
-            else
-            {
-                while(seekRow(IResultSetHelper::NEXT,1,nCurPos)) ; // run through after last row
-                // now I know all
-                seekRow(IResultSetHelper::PRIOR,1,nCurPos);
+                while(seekRow(IResultSetHelper::NEXT, 1, nCurPos)) ; // run through after last row
             }
+            // m_nMaxRowCount can still be zero, but now it means there a genuinely zero rows in the table
+            return seekRow(IResultSetHelper::ABSOLUTE, m_nMaxRowCount, nCurPos);
             break;
         case IResultSetHelper::RELATIVE:
             {
                 const sal_Int32 nNewRowPos = m_nRowPos + nOffset;
-                if (nNewRowPos <= 0)
+                if (nNewRowPos < 0)
                     return sal_False;
+                // ABSOLUTE will take care of case nNewRowPos > nMaxRowCount
                 return seekRow(IResultSetHelper::ABSOLUTE, nNewRowPos, nCurPos);
             }
         case IResultSetHelper::ABSOLUTE:
@@ -825,112 +853,116 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int
                         if (!seekRow(IResultSetHelper::LAST, 0, nCurPos))
                             return sal_False;
                     }
-                    assert(m_nMaxRowCount != 0);
-                    nOffset = m_nMaxRowCount + nOffset + 1;
+                    // m_nMaxRowCount can still be zero, but now it means there a genuinely zero rows in the table
+                    nOffset = m_nMaxRowCount + nOffset;
                 }
                 if(nOffset < 0)
                 {
-                    m_nRowPos = 0;
+                    seekRow(IResultSetHelper::ABSOLUTE, 0, nCurPos);
                     return sal_False;
                 }
                 if(m_nMaxRowCount && nOffset > m_nMaxRowCount)
                 {
                     m_nRowPos = m_nMaxRowCount + 1;
+                    const TRowPositionInFile &lastRowPos(m_aRowPosToFilePos.back());
+                    m_nFilePos = lastRowPos.second;
+                    nCurPos = lastRowPos.second;
                     return sal_False;
                 }
 
-                ::std::map<sal_Int32,TRowPositionsInFile::iterator>::const_iterator aIter = m_aRowPosToFilePos.find(nOffset);
-                if(aIter != m_aRowPosToFilePos.end())
+                assert(m_nRowPos >=0);
+                assert(m_aRowPosToFilePos.size() > static_cast< vector< TRowPositionInFile >::size_type >(m_nRowPos));
+                assert(nOffset >= 0);
+                if(m_aRowPosToFilePos.size() > static_cast< vector< TRowPositionInFile >::size_type >(nOffset))
                 {
-                    m_nFilePos  = aIter->second->first;
-                    nCurPos     = aIter->second->second;
+                    m_nFilePos  = m_aRowPosToFilePos[nOffset].first;
+                    nCurPos     = m_aRowPosToFilePos[nOffset].second;
                     m_nRowPos   = nOffset;
                     m_bNeedToReadLine = true;
                 }
                 else
                 {
-                    aIter = m_aRowPosToFilePos.upper_bound(nOffset);
-                    if(aIter == m_aRowPosToFilePos.end())
+                    assert(m_nRowPos < nOffset);
+                    while(m_nRowPos < nOffset)
                     {
-                        ::std::map<sal_Int32,TRowPositionsInFile::iterator>::reverse_iterator aLastPos = m_aRowPosToFilePos.rbegin();
-                        m_nRowPos   = aLastPos->first;
-                        m_nFilePos  = aIter->second->first;
-                        nCurPos     = aIter->second->second;
-                        while(m_nRowPos < nOffset)
-                        {
-                            if(!seekRow(IResultSetHelper::NEXT,1,nCurPos))
-                                return sal_False;
-                        }
-                        assert(m_nRowPos == nOffset);
-                    }
-                    else
-                    {
-                        // This is very fishy... The rows numbering has holes???
-                        assert(false);
-                        --aIter;
-                        m_nRowPos   = aIter->first;
-                        m_nFilePos  = aIter->second->first;
-                        nCurPos     = aIter->second->second;
-                        m_bNeedToReadLine = true;
+                        if(!seekRow(IResultSetHelper::NEXT, 1, nCurPos))
+                            return sal_False;
                     }
+                    assert(m_nRowPos == nOffset);
                 }
             }
 
             break;
         case IResultSetHelper::BOOKMARK:
             {
-                m_nRowPos = 0;
-                TRowPositionsInFile::const_iterator aFind = m_aFilePosToEndLinePos.find(nOffset);
-                if(aFind == m_aFilePosToEndLinePos.end())
+                vector< TRowPositionInFile >::const_iterator aFind = lower_bound(m_aRowPosToFilePos.begin(),
+                                                                                 m_aRowPosToFilePos.end(),
+                                                                                 nOffset,
+                                                                                 pairFirstLess< TRowPositionInFile, sal_Int32 >);
+
+                if(aFind == m_aRowPosToFilePos.end() || aFind->first != nOffset)
                     //invalid bookmark
                     return sal_False;
+
                 m_bNeedToReadLine = true;
                 m_nFilePos  = aFind->first;
                 nCurPos     = aFind->second;
-                for(::std::map<sal_Int32, TRowPositionsInFile::iterator>::const_iterator p = m_aRowPosToFilePos.begin();
-                    p != m_aRowPosToFilePos.end();
-                    ++p)
-                {
-                    assert(p->second->first <= nOffset);
-                    if(p->second->first == nOffset)
-                    {
-                        m_nRowPos = p->first;
-                        break;
-                    }
-                }
-                assert(m_nRowPos > 0);
+                m_nRowPos = aFind - m_aRowPosToFilePos.begin();
                 break;
             }
     }
 
-    //nCurPos = m_nFilePos;
-
     return sal_True;
 }
+
 // -----------------------------------------------------------------------------
-sal_Bool OFlatTable::readLine(sal_Int32& _rnCurrentPos)
+bool OFlatTable::readLine(sal_Int32 * const pEndPos, sal_Int32 * const pStartPos, const bool nonEmpty)
 {
     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen at sun.com", "OFlatTable::readLine" );
     const rtl_TextEncoding nEncoding = m_pConnection->getTextEncoding();
-    m_pFileStream->ReadByteStringLine(m_aCurrentLine,nEncoding);
-    if (m_pFileStream->IsEof())
-        return sal_False;
-
-    QuotedTokenizedString sLine = m_aCurrentLine; // check if the string continues on next line
-    while( (comphelper::string::getTokenCount(sLine.GetString(), m_cStringDelimiter) % 2) != 1 )
+    m_aCurrentLine = QuotedTokenizedString();
+    do
     {
-        m_pFileStream->ReadByteStringLine(sLine,nEncoding);
-        if ( !m_pFileStream->IsEof() )
+        if (pStartPos)
+            *pStartPos = m_pFileStream->Tell();
+        m_pFileStream->ReadByteStringLine(m_aCurrentLine,nEncoding);
+        if (m_pFileStream->IsEof())
+            return false;
+
+        QuotedTokenizedString sLine = m_aCurrentLine; // check if the string continues on next line
+        while( (comphelper::string::getTokenCount(sLine.GetString(), m_cStringDelimiter) % 2) != 1 )
         {
-            m_aCurrentLine.GetString().Append('\n');
-            m_aCurrentLine.GetString() += sLine.GetString();
-            sLine = m_aCurrentLine;
+            m_pFileStream->ReadByteStringLine(sLine,nEncoding);
+            if ( !m_pFileStream->IsEof() )
+            {
+                m_aCurrentLine.GetString().Append('\n');
+                m_aCurrentLine.GetString() += sLine.GetString();
+                sLine = m_aCurrentLine;
+            }
+            else
+                break;
         }
-        else
-            break;
+    } while(nonEmpty && m_aCurrentLine.Len() == 0);
+
+    if(pEndPos)
+        *pEndPos = m_pFileStream->Tell();
+    return true;
+}
+
+// -----------------------------------------------------------------------------
+void OFlatTable::setRowPos(const vector<TRowPositionInFile>::size_type rowNum, const TRowPositionInFile &rowPos)
+{
+    assert(m_aRowPosToFilePos.size() >= rowNum);
+    if(m_aRowPosToFilePos.size() == rowNum)
+        m_aRowPosToFilePos.push_back(rowPos);
+    else
+    {
+        SAL_WARN_IF(m_aRowPosToFilePos[rowNum] != rowPos,
+                    "connectivity.flat",
+                    "Setting position for row " << rowNum << " to (" << rowPos.first << ", " << rowPos.second << "), " <<
+                    "but already had different position (" << m_aRowPosToFilePos[rowNum].first << ", " << m_aRowPosToFilePos[rowNum].second << ")");
+        m_aRowPosToFilePos[rowNum] = rowPos;
     }
-    _rnCurrentPos = m_pFileStream->Tell();
-    return sal_True;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/flat/ETable.hxx b/connectivity/source/inc/flat/ETable.hxx
index 5e266e4..c5b3608 100644
--- a/connectivity/source/inc/flat/ETable.hxx
+++ b/connectivity/source/inc/flat/ETable.hxx
@@ -21,6 +21,7 @@
 #define _CONNECTIVITY_FLAT_TABLE_HXX_
 
 #include "file/FTable.hxx"
+#include "flat/EConnection.hxx"
 #include "connectivity/sdbcx/VColumn.hxx"
 #include "connectivity/CommonTools.hxx"
 #include <tools/urlobj.hxx>
@@ -34,15 +35,14 @@ namespace connectivity
         typedef file::OFileTable OFlatTable_BASE;
         class OFlatConnection;
 
-        typedef ::std::map< OUString,
-                        ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed>, comphelper::UStringMixLess > OContainer;
-        typedef ::std::map<sal_Int32, sal_Int32>    TRowPositionsInFile;
+        typedef ::std::pair<sal_Int32, sal_Int32> TRowPositionInFile;
 
         class OFlatTable :  public OFlatTable_BASE
         {
             // maps a row position to a file position
-            TRowPositionsInFile             m_aFilePosToEndLinePos;
-            ::std::map<sal_Int32, TRowPositionsInFile::iterator>
+            // row n is positions [m_aRowPosToFilePos[n]->first, m_aRowPosToFilePos[n]->second) in file
+            // "real" row indexes start at 1; for the purposes of m_aRowPosToFilePos, row 0 is headers
+            ::std::vector<TRowPositionInFile>
                                             m_aRowPosToFilePos;
             ::std::vector<sal_Int32>        m_aTypes;       // holds all type for columns just to avoid to ask the propertyset
             ::std::vector<sal_Int32>        m_aPrecisions;  // same as aboth
@@ -50,7 +50,6 @@ namespace connectivity
             QuotedTokenizedString           m_aCurrentLine;
             ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > m_xNumberFormatter;
             ::com::sun::star::util::Date    m_aNullDate;
-            sal_Int32                       m_nStartRowFilePos;
             sal_Int32                       m_nRowPos;
             sal_Int32                       m_nMaxRowCount; // will be set if stream is once eof
             sal_Unicode                     m_cStringDelimiter;     // delimiter for strings m_cStringDelimiter blabla m_cStringDelimiter
@@ -59,10 +58,21 @@ namespace connectivity
         private:
             void fillColumns(const ::com::sun::star::lang::Locale& _aLocale);
             sal_Bool CreateFile(const INetURLObject& aFile, sal_Bool& bCreateMemo);
-            sal_Bool readLine(sal_Int32& _rnCurrentPos);
+            bool readLine(sal_Int32 *pEndPos = NULL, sal_Int32 *pStartPos = NULL, bool nonEmpty = false);
+            void setRowPos(::std::vector<TRowPositionInFile>::size_type rowNum, const TRowPositionInFile &rowPos);
             void impl_fillColumnInfo_nothrow(QuotedTokenizedString& aFirstLine,xub_StrLen& nStartPosFirstLine,xub_StrLen& nStartPosFirstLine2
                                              ,sal_Int32& io_nType,sal_Int32& io_nPrecisions,sal_Int32& io_nScales,String& o_sTypeName
                                              ,const sal_Unicode cDecimalDelimiter,const sal_Unicode cThousandDelimiter,const CharClass& aCharClass);
+            OFlatConnection* getFlatConnection()
+            {
+#if OSL_DEBUG_LEVEL>1
+                OFlatConnection* pConnection = dynamic_cast<OFlatConnection*>(m_pConnection);
+                assert(pConnection);
+#else
+                OFlatConnection* pConnection = static_cast<OFlatConnection*>(m_pConnection);
+#endif
+                return pConnection;
+            }
         public:
             virtual void refreshColumns();
 
@@ -79,7 +89,7 @@ namespace connectivity
             void construct(); // can throw any exception
 
             virtual sal_Bool seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos);
-            virtual sal_Bool fetchRow(OValueRefRow& _rRow,const OSQLColumns& _rCols, sal_Bool bIsTable,sal_Bool bRetrieveData);
+            virtual sal_Bool fetchRow(OValueRefRow& _rRow, const OSQLColumns& _rCols, sal_Bool bIsTable, sal_Bool bRetrieveData);
             virtual void refreshHeader();
 
             virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox
index ead3c68..b819684 100644
--- a/include/sal/log-areas.dox
+++ b/include/sal/log-areas.dox
@@ -54,6 +54,7 @@ certain functionality.
 @li @c connectivity.cpool
 @li @c connectivity.commontools
 @li @c connectivity.mork
+ at li @c connectivity.flat
 @li @c connectivity.parse
 @li @c connectivity.postgresql
 
commit 72ced5a1e51435ecd4b0bba32d91f117a18a1eda
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Sun May 19 08:37:05 2013 +0200

    flat file db driver: clean up seekRow
    
    Change-Id: Ib9057944c120522230d5ed00cf5d152e5f0b4726

diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx
index 19918ef..bbb5706 100644
--- a/connectivity/source/drivers/flat/ETable.cxx
+++ b/connectivity/source/drivers/flat/ETable.cxx
@@ -746,6 +746,8 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int
             // run through
         case IResultSetHelper::NEXT:
             {
+                if(m_nMaxRowCount != 0 && m_nRowPos > m_nMaxRowCount)
+                    return sal_False;
                 ++m_nRowPos;
                 ::std::map<sal_Int32,TRowPositionsInFile::iterator>::const_iterator aFind = m_aRowPosToFilePos.find(m_nRowPos);
                 m_bNeedToReadLine = aFind != m_aRowPosToFilePos.end();
@@ -772,16 +774,19 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int
 
             break;
         case IResultSetHelper::PRIOR:
+            assert(m_nRowPos >= 0);
+
+            if(m_nRowPos == 0)
+                return sal_False;
+
             --m_nRowPos;
-            if(m_nRowPos > 0)
             {
+                assert(m_aRowPosToFilePos.find(m_nRowPos) != m_aRowPosToFilePos.end());
                 TRowPositionsInFile::iterator aPositions = m_aRowPosToFilePos[m_nRowPos];
                 m_nFilePos = aPositions->first;
                 nCurPos = aPositions->second;
                 m_bNeedToReadLine = true;
             }
-            else
-                m_nRowPos = 0;
 
             break;
         case IResultSetHelper::LAST:
@@ -805,35 +810,42 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int
             }
             break;
         case IResultSetHelper::RELATIVE:
-            if(nOffset > 0)
             {
-                for(sal_Int32 i = 0;i<nOffset;++i)
-                    seekRow(IResultSetHelper::NEXT,1,nCurPos);
-            }
-            else if(nOffset < 0)
-            {
-                for(sal_Int32 i = nOffset;i;++i)
-                    seekRow(IResultSetHelper::PRIOR,1,nCurPos);
+                const sal_Int32 nNewRowPos = m_nRowPos + nOffset;
+                if (nNewRowPos <= 0)
+                    return sal_False;
+                return seekRow(IResultSetHelper::ABSOLUTE, nNewRowPos, nCurPos);
             }
-            break;
         case IResultSetHelper::ABSOLUTE:
             {
                 if(nOffset < 0)
-                    nOffset = m_nRowPos + nOffset;
+                {
+                    if (m_nMaxRowCount == 0)
+                    {
+                        if (!seekRow(IResultSetHelper::LAST, 0, nCurPos))
+                            return sal_False;
+                    }
+                    assert(m_nMaxRowCount != 0);
+                    nOffset = m_nMaxRowCount + nOffset + 1;
+                }
+                if(nOffset < 0)
+                {
+                    m_nRowPos = 0;
+                    return sal_False;
+                }
+                if(m_nMaxRowCount && nOffset > m_nMaxRowCount)
+                {
+                    m_nRowPos = m_nMaxRowCount + 1;
+                    return sal_False;
+                }
+
                 ::std::map<sal_Int32,TRowPositionsInFile::iterator>::const_iterator aIter = m_aRowPosToFilePos.find(nOffset);
                 if(aIter != m_aRowPosToFilePos.end())
                 {
                     m_nFilePos  = aIter->second->first;
                     nCurPos     = aIter->second->second;
-                    //m_pFileStream->Seek(m_nFilePos);
+                    m_nRowPos   = nOffset;
                     m_bNeedToReadLine = true;
-                    //if ( m_pFileStream->IsEof() /*|| !checkHeaderLine()*/ || !readLine(nCurPos) )
-                    //  return sal_False;
-                }
-                else if(m_nMaxRowCount && nOffset > m_nMaxRowCount) // offset is outside the table
-                {
-                    m_nRowPos = m_nMaxRowCount;
-                    return sal_False;
                 }
                 else
                 {
@@ -842,20 +854,24 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int
                     {
                         ::std::map<sal_Int32,TRowPositionsInFile::iterator>::reverse_iterator aLastPos = m_aRowPosToFilePos.rbegin();
                         m_nRowPos   = aLastPos->first;
-                        nCurPos = m_nFilePos = aLastPos->second->first;
-                        while(m_nRowPos != nOffset)
-                            seekRow(IResultSetHelper::NEXT,1,nCurPos);
+                        m_nFilePos  = aIter->second->first;
+                        nCurPos     = aIter->second->second;
+                        while(m_nRowPos < nOffset)
+                        {
+                            if(!seekRow(IResultSetHelper::NEXT,1,nCurPos))
+                                return sal_False;
+                        }
+                        assert(m_nRowPos == nOffset);
                     }
                     else
                     {
+                        // This is very fishy... The rows numbering has holes???
+                        assert(false);
                         --aIter;
                         m_nRowPos   = aIter->first;
                         m_nFilePos  = aIter->second->first;
                         nCurPos     = aIter->second->second;
-                        //m_pFileStream->Seek(m_nFilePos);
                         m_bNeedToReadLine = true;
-                        //if ( m_pFileStream->IsEof() /*|| !checkHeaderLine()*/ || !readLine(nCurPos) )
-                        //  return sal_False;
                     }
                 }
             }
@@ -865,32 +881,24 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int
             {
                 m_nRowPos = 0;
                 TRowPositionsInFile::const_iterator aFind = m_aFilePosToEndLinePos.find(nOffset);
-                m_bNeedToReadLine = aFind != m_aFilePosToEndLinePos.end();
-                if ( m_bNeedToReadLine )
+                if(aFind == m_aFilePosToEndLinePos.end())
+                    //invalid bookmark
+                    return sal_False;
+                m_bNeedToReadLine = true;
+                m_nFilePos  = aFind->first;
+                nCurPos     = aFind->second;
+                for(::std::map<sal_Int32, TRowPositionsInFile::iterator>::const_iterator p = m_aRowPosToFilePos.begin();
+                    p != m_aRowPosToFilePos.end();
+                    ++p)
                 {
-                    m_nFilePos  = aFind->first;
-                    nCurPos = aFind->second;
-                    for(::std::map<sal_Int32, TRowPositionsInFile::iterator>::const_iterator p = m_aRowPosToFilePos.begin();
-                        p != m_aRowPosToFilePos.end();
-                        ++p)
+                    assert(p->second->first <= nOffset);
+                    if(p->second->first == nOffset)
                     {
-                        assert(p->second->first <= nOffset);
-                        if(p->second->first == nOffset)
-                        {
-                            m_nRowPos = p->first;
-                            break;
-                        }
+                        m_nRowPos = p->first;
+                        break;
                     }
-                    assert(m_nRowPos > 0);
-                }
-                else
-                {
-                    assert(false);
-                    m_nFilePos = nOffset;
-                    m_pFileStream->Seek(nOffset);
-                    if (m_pFileStream->IsEof() || !readLine(nCurPos) )
-                        return sal_False;
                 }
+                assert(m_nRowPos > 0);
                 break;
             }
     }
commit f2cf75d1886b031bbc058bb9399e91afff79a8f5
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Sun May 19 07:35:11 2013 +0200

    janitorial: spelling in comment
    
    Change-Id: I54854765c7ad88f1749d5ae7ad9203f6d29fa2b6

diff --git a/connectivity/source/inc/flat/ETable.hxx b/connectivity/source/inc/flat/ETable.hxx
index ea8f504..5e266e4 100644
--- a/connectivity/source/inc/flat/ETable.hxx
+++ b/connectivity/source/inc/flat/ETable.hxx
@@ -40,7 +40,7 @@ namespace connectivity
 
         class OFlatTable :  public OFlatTable_BASE
         {
-            // maps a row postion to a file position
+            // maps a row position to a file position
             TRowPositionsInFile             m_aFilePosToEndLinePos;
             ::std::map<sal_Int32, TRowPositionsInFile::iterator>
                                             m_aRowPosToFilePos;
commit db6ab9f8f11107b7c09c3a5139ee4b3d4afd2f80
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Sun May 19 07:34:32 2013 +0200

    remove unused & suspicious method
    
    calls m_pTable->seekRow with m_nRowPos instead of m_nFilePos...
    
    Change-Id: Ibf9b4da3dffdd75402deb9e7a371a312e0464613

diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx
index fbd87a3..be363b3 100644
--- a/connectivity/source/drivers/file/FResultSet.cxx
+++ b/connectivity/source/drivers/file/FResultSet.cxx
@@ -546,37 +546,37 @@ sal_Bool SAL_CALL OResultSet::isBeforeFirst(  ) throw(SQLException, RuntimeExcep
     return m_nRowPos == -1;
 }
 // -------------------------------------------------------------------------
-sal_Bool OResultSet::evaluate()
-{
-    RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen at sun.com", "OResultSet::evaluate" );
-    OSL_ENSURE(m_pSQLAnalyzer,"OResultSet::evaluate: Analyzer isn't set!");
-    sal_Bool bRet = sal_True;
-    while(!m_pSQLAnalyzer->evaluateRestriction())
-    {
-        if(m_pEvaluationKeySet)
-        {
-            if(m_aEvaluateIter == m_pEvaluationKeySet->end())
-                return sal_False;
-            bRet = m_pTable->seekRow(IResultSetHelper::BOOKMARK,(*m_aEvaluateIter),m_nRowPos);
-            ++m_aEvaluateIter;
-        }
-        else
-            bRet = m_pTable->seekRow(IResultSetHelper::NEXT,1,m_nRowPos);
-        if(bRet)
-        {
-            if(m_pEvaluationKeySet)
-            {
-                bRet = m_pTable->fetchRow(m_aEvaluateRow,*(m_pTable->getTableColumns()),sal_True,sal_True);
-                evaluate();
-
-            }
-            else
-                bRet = m_pTable->fetchRow(m_aRow,*m_xColumns,sal_False,sal_True);
-        }
-    }
-
-    return bRet;
-}
+// sal_Bool OResultSet::evaluate()
+// {
+//     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen at sun.com", "OResultSet::evaluate" );
+//     OSL_ENSURE(m_pSQLAnalyzer,"OResultSet::evaluate: Analyzer isn't set!");
+//     sal_Bool bRet = sal_True;
+//     while(!m_pSQLAnalyzer->evaluateRestriction())
+//     {
+//         if(m_pEvaluationKeySet)
+//         {
+//             if(m_aEvaluateIter == m_pEvaluationKeySet->end())
+//                 return sal_False;
+//             bRet = m_pTable->seekRow(IResultSetHelper::BOOKMARK,(*m_aEvaluateIter),m_nRowPos);
+//             ++m_aEvaluateIter;
+//         }
+//         else
+//             bRet = m_pTable->seekRow(IResultSetHelper::NEXT,1,m_nRowPos);
+//         if(bRet)
+//         {
+//             if(m_pEvaluationKeySet)
+//             {
+//                 bRet = m_pTable->fetchRow(m_aEvaluateRow,*(m_pTable->getTableColumns()),sal_True,sal_True);
+//                 evaluate();
+
+//             }
+//             else
+//                 bRet = m_pTable->fetchRow(m_aRow,*m_xColumns,sal_False,sal_True);
+//         }
+//     }
+
+//     return bRet;
+// }
 // -------------------------------------------------------------------------
 
 sal_Bool SAL_CALL OResultSet::next(  ) throw(SQLException, RuntimeException)
diff --git a/connectivity/source/inc/file/FResultSet.hxx b/connectivity/source/inc/file/FResultSet.hxx
index 738c2e1..c0ae89d 100644
--- a/connectivity/source/inc/file/FResultSet.hxx
+++ b/connectivity/source/inc/file/FResultSet.hxx
@@ -134,7 +134,7 @@ namespace connectivity
 
             void initializeRow(OValueRefRow& _rRow,sal_Int32 _nColumnCount);
             void construct();
-            sal_Bool evaluate();
+            //sal_Bool evaluate();
 
             sal_Bool ExecuteRow(IResultSetHelper::Movement eFirstCursorPosition,
                                 sal_Int32 nOffset = 1,
commit 7ac4c9dcc928d040c5a446efc256aa392f4bee2c
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Sat May 18 09:03:01 2013 +0200

    DB wizards (java): use system locale, not UI language, for parsing matters
    
    Change-Id: Ieb00ef3b16cd6213c11298040b789444b3ee3a31

diff --git a/wizards/com/sun/star/wizards/common/Configuration.java b/wizards/com/sun/star/wizards/common/Configuration.java
index bba2a79..3983f82 100644
--- a/wizards/com/sun/star/wizards/common/Configuration.java
+++ b/wizards/com/sun/star/wizards/common/Configuration.java
@@ -200,26 +200,30 @@ public abstract class Configuration
         }
     }
 
-    public static String getOfficeLocaleString(XMultiServiceFactory xMSF)
+    public static String getLocaleString(XMultiServiceFactory xMSF, String root, String key)
     {
         String sLocale = PropertyNames.EMPTY_STRING;
         try
         {
             Locale aLocLocale = new Locale();
-            Object oMasterKey = getConfigurationRoot(xMSF, "org.openoffice.Setup/L10N/", false);
-            sLocale = (String) Helper.getUnoObjectbyName(oMasterKey, "ooLocale");
+            Object oMasterKey = getConfigurationRoot(xMSF, root, false);
+            sLocale = (String) Helper.getUnoObjectbyName(oMasterKey, key);
         }
         catch (Exception exception)
         {
             exception.printStackTrace(System.err);
         }
+        if (sLocale.length() == 0 && (!key.equals("Locale") || !root.equals("org.openoffice.System/L10N/")))
+        {
+            return getLocaleString(xMSF, "org.openoffice.System/L10N/", "Locale");
+        }
         return sLocale;
     }
 
-    public static Locale getOfficeLocale(XMultiServiceFactory xMSF)
+    public static Locale getLocale(XMultiServiceFactory xMSF, String root, String key)
     {
         Locale aLocLocale = new Locale();
-        String sLocale = getOfficeLocaleString(xMSF);
+        String sLocale = getLocaleString(xMSF, root, key);
         String[] sLocaleList = JavaTools.ArrayoutofString(sLocale, "-");
         aLocLocale.Language = sLocaleList[0];
         if (sLocaleList.length > 1)
@@ -229,18 +233,24 @@ public abstract class Configuration
         return aLocLocale;
     }
 
-    public static String getOfficeLinguistic(XMultiServiceFactory xMSF)
+    public static Locale getLocale(XMultiServiceFactory xMSF)
     {
-        try
-        {
-            Object oMasterKey = getConfigurationRoot(xMSF, "org.openoffice.Setup/L10N/", false);
-            return (String) Helper.getUnoObjectbyName(oMasterKey, "ooLocale");
-        }
-        catch (Exception exception)
-        {
-            exception.printStackTrace();
-            return null;
-        }
+        return getLocale(xMSF, "org.openoffice.Setup/L10N/", "ooSetupSystemLocale");
+    }
+
+    public static Locale getUILocale(XMultiServiceFactory xMSF)
+    {
+        return getLocale(xMSF, "org.openoffice.Setup/L10N/", "ooLocale");
+    }
+
+    public static String getLocaleString(XMultiServiceFactory xMSF)
+    {
+        return getLocaleString(xMSF, "org.openoffice.Setup/L10N/", "ooSetupSystemLocale");
+    }
+
+    public static String getUILocaleString(XMultiServiceFactory xMSF)
+    {
+        return getLocaleString(xMSF, "org.openoffice.Setup/L10N/", "ooLocale");
     }
 
     /**
diff --git a/wizards/com/sun/star/wizards/db/DBMetaData.java b/wizards/com/sun/star/wizards/db/DBMetaData.java
index 93b42e0..39c4f84 100644
--- a/wizards/com/sun/star/wizards/db/DBMetaData.java
+++ b/wizards/com/sun/star/wizards/db/DBMetaData.java
@@ -169,7 +169,7 @@ public class DBMetaData
             {
                 XNumberFormatsSupplier xNumberFormatsSupplier = (XNumberFormatsSupplier) AnyConverter.toObject(XNumberFormatsSupplier.class, xDataSourcePropertySet.getPropertyValue("NumberFormatsSupplier"));
                 //TODO get the locale from the datasource
-                aLocale = Configuration.getOfficeLocale(xMSF);
+                aLocale = Configuration.getLocale(xMSF);
                 oNumberFormatter = new NumberFormatter(xMSF, xNumberFormatsSupplier, aLocale);
                 lDateCorrection = oNumberFormatter.getNullDateCorrection();
             }
@@ -529,7 +529,7 @@ public class DBMetaData
         }
         if (this.isSQL92CheckEnabled())
         {
-            return Desktop.removeSpecialCharacters(xMSF, Configuration.getOfficeLocale(xMSF), _sname);
+            return Desktop.removeSpecialCharacters(xMSF, Configuration.getLocale(xMSF), _sname);
         }
         return _sname;
     }
diff --git a/wizards/com/sun/star/wizards/table/CGTable.java b/wizards/com/sun/star/wizards/table/CGTable.java
index 9237901..6e10598 100644
--- a/wizards/com/sun/star/wizards/table/CGTable.java
+++ b/wizards/com/sun/star/wizards/table/CGTable.java
@@ -74,7 +74,7 @@ public class CGTable
             }
             for (int i = 0; i < fieldnames.length; i++)
             {
-                fieldnames[i] = Desktop.removeSpecialCharacters(xMSF, Configuration.getOfficeLocale(xMSF), fieldnames[i]);
+                fieldnames[i] = Desktop.removeSpecialCharacters(xMSF, Configuration.getLocale(xMSF), fieldnames[i]);
             }
             return fieldnames;
         }
diff --git a/wizards/com/sun/star/wizards/table/ScenarioSelector.java b/wizards/com/sun/star/wizards/table/ScenarioSelector.java
index 5d505c9..7ae2bd0 100644
--- a/wizards/com/sun/star/wizards/table/ScenarioSelector.java
+++ b/wizards/com/sun/star/wizards/table/ScenarioSelector.java
@@ -70,7 +70,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
         super(_CurUnoDialog, TableWizard.SOMAINPAGE, 91, 108, 230, 80, _reslblFields, _reslblSelFields, 41209, true);
         CurTableWizardUnoDialog =  _CurUnoDialog;
         xMSF = CurUnoDialog.xMSF;
-        aLocale = Configuration.getOfficeLocale(xMSF);
+        aLocale = Configuration.getLocale(xMSF);
         curtabledescriptor = _curtabledescriptor;
         imaxcolumnchars = this.curtabledescriptor.getMaxColumnNameLength();
         bcolumnnameislimited = (imaxcolumnchars > 0) && (imaxcolumnchars < 16);
diff --git a/wizards/com/sun/star/wizards/table/TableWizard.java b/wizards/com/sun/star/wizards/table/TableWizard.java
index ddd4be3..70ce06b 100644
--- a/wizards/com/sun/star/wizards/table/TableWizard.java
+++ b/wizards/com/sun/star/wizards/table/TableWizard.java
@@ -283,7 +283,7 @@ public class TableWizard extends DatabaseObjectWizard implements XTextListener
         scomposedtablename = curFinalizer.getComposedTableName(tablename);
         if (this.curTableDescriptor.isSQL92CheckEnabled())
         {
-            Desktop.removeSpecialCharacters(curTableDescriptor.xMSF, Configuration.getOfficeLocale(this.curTableDescriptor.xMSF), tablename);
+            Desktop.removeSpecialCharacters(curTableDescriptor.xMSF, Configuration.getLocale(this.curTableDescriptor.xMSF), tablename);
         }
         if ( tablename.length() > 0 )
         {
@@ -422,7 +422,7 @@ public class TableWizard extends DatabaseObjectWizard implements XTextListener
         {
             Object otextcomponent = UnoDialog.getModel(aTextEvent.Source);
             String sName = (String) Helper.getUnoPropertyValue(otextcomponent, "Text");
-            sName = Desktop.removeSpecialCharacters(curTableDescriptor.xMSF, Configuration.getOfficeLocale(curTableDescriptor.xMSF), sName);
+            sName = Desktop.removeSpecialCharacters(curTableDescriptor.xMSF, Configuration.getLocale(curTableDescriptor.xMSF), sName);
             Helper.setUnoPropertyValue(otextcomponent, "Text", sName);
         }
     }
diff --git a/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java b/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java
index a52edad..082bd36 100644
--- a/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java
+++ b/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java
@@ -326,7 +326,7 @@ public class CommandFieldSelection extends FieldSelection implements Comparator<
     {
         if (this.aCollator == null)
         {
-            com.sun.star.lang.Locale aOfficeLocale = Configuration.getOfficeLocale(this.CurDBMetaData.xMSF);
+            com.sun.star.lang.Locale aOfficeLocale = Configuration.getLocale(this.CurDBMetaData.xMSF);
             java.util.Locale aJavaLocale = new java.util.Locale(aOfficeLocale.Language, aOfficeLocale.Country, aOfficeLocale.Variant);
             //Get the Collator for US English and set its strength to PRIMARY
             this.aCollator = Collator.getInstance(aJavaLocale);
commit cd2f2e772ce37808b0922358bf2f22adff6d2ea1
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Sat May 18 08:53:54 2013 +0200

    make OSingleSelectQueryComposer use *system* parse context
    
    and pass it to the parser and PredicateInput constructors.
    This makes the whole story consistent; before system locale settings were already manually passed to parseNodeToPredicateStr, which led to some things being parsed as en_US and others as system locale.
    
    Change-Id: Ib9571b10d79183571e8ab3f79660b41594dc2d1c

diff --git a/dbaccess/Library_dba.mk b/dbaccess/Library_dba.mk
index b3b794d..bca628d 100644
--- a/dbaccess/Library_dba.mk
+++ b/dbaccess/Library_dba.mk
@@ -38,6 +38,7 @@ $(eval $(call gb_Library_use_libraries,dba,\
     sfx \
     svl \
     svt \
+    svxcore \
     tl \
     ucbhelper \
     utl \
diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
index d84f000..7bd978d 100644
--- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
+++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
@@ -226,7 +226,7 @@ OSingleSelectQueryComposer::OSingleSelectQueryComposer(const Reference< XNameAcc
                                const Reference<XComponentContext>& _rContext )
     :OSubComponent(m_aMutex,_xConnection)
     ,OPropertyContainer(m_aBHelper)
-    ,m_aSqlParser( _rContext )
+    ,m_aSqlParser( _rContext, &m_aParseContext )
     ,m_aSqlIterator( _xConnection, _rxTables, m_aSqlParser, NULL )
     ,m_aAdditiveIterator( _xConnection, _rxTables, m_aSqlParser, NULL )
     ,m_aElementaryParts( (size_t)SQLPartCount )
@@ -248,7 +248,7 @@ OSingleSelectQueryComposer::OSingleSelectQueryComposer(const Reference< XNameAcc
 
     m_aCurrentColumns.resize(4);
 
-    m_aLocale = SvtSysLocale().GetLanguageTag().getLocale();
+    m_aLocale = m_aParseContext.getPreferredLocale();
     m_xNumberFormatsSupplier = dbtools::getNumberFormats( m_xConnection, sal_True, m_aContext );
     Reference< XLocaleData4 > xLocaleData( LocaleData::create(m_aContext) );
     LocaleDataItem aData = xLocaleData->getLocaleItem(m_aLocale);
@@ -1507,7 +1507,7 @@ namespace
 void SAL_CALL OSingleSelectQueryComposer::setStructuredFilter( const Sequence< Sequence< PropertyValue > >& filter ) throw (SQLException, ::com::sun::star::lang::IllegalArgumentException, RuntimeException)
 {
     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen at sun.com", "OSingleSelectQueryComposer::setStructuredFilter" );
-    OPredicateInputController aPredicateInput(m_aContext, m_xConnection);
+    OPredicateInputController aPredicateInput(m_aContext, m_xConnection, &m_aParseContext);
     setFilter(lcl_getCondition(filter,aPredicateInput,getColumns()));
 }
 
diff --git a/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx b/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx
index 314c05b..1f9c720 100644
--- a/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx
+++ b/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx
@@ -33,6 +33,7 @@
 #include <comphelper/uno3.hxx>
 #include <comphelper/proparrhlp.hxx>
 #include <comphelper/propertycontainer.hxx>
+#include <svx/ParseContext.hxx>
 
 #include <memory>
 
@@ -77,6 +78,7 @@ namespace dbaccess
         };
         typedef ::std::const_mem_fun_t< const ::connectivity::OSQLParseNode*, ::connectivity::OSQLParseTreeIterator >
                                                 TGetParseNode;
+        ::svxform::OSystemParseContext          m_aParseContext;
         ::connectivity::OSQLParser              m_aSqlParser;
         ::connectivity::OSQLParseTreeIterator   m_aSqlIterator;         // the iterator for the complete statement
         ::connectivity::OSQLParseTreeIterator   m_aAdditiveIterator;    // the iterator for the "additive statement" (means without the clauses of the elementary statement)
commit 6b946f228397c370e09f487c470bafd9d046eee5
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Fri May 17 10:54:40 2013 +0200

    fdo#47951 flat text table: update m_nRowPos when moving by bookmark
    
    Change-Id: Iac154020b4b6309f92b1f68fa5bf79611dfcc91b

diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx
index 083cad4..19918ef 100644
--- a/connectivity/source/drivers/flat/ETable.cxx
+++ b/connectivity/source/drivers/flat/ETable.cxx
@@ -863,15 +863,29 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int
             break;
         case IResultSetHelper::BOOKMARK:
             {
+                m_nRowPos = 0;
                 TRowPositionsInFile::const_iterator aFind = m_aFilePosToEndLinePos.find(nOffset);
                 m_bNeedToReadLine = aFind != m_aFilePosToEndLinePos.end();
                 if ( m_bNeedToReadLine )
                 {
                     m_nFilePos  = aFind->first;
                     nCurPos = aFind->second;
+                    for(::std::map<sal_Int32, TRowPositionsInFile::iterator>::const_iterator p = m_aRowPosToFilePos.begin();
+                        p != m_aRowPosToFilePos.end();
+                        ++p)
+                    {
+                        assert(p->second->first <= nOffset);
+                        if(p->second->first == nOffset)
+                        {
+                            m_nRowPos = p->first;
+                            break;
+                        }
+                    }
+                    assert(m_nRowPos > 0);
                 }
                 else
                 {
+                    assert(false);
                     m_nFilePos = nOffset;
                     m_pFileStream->Seek(nOffset);
                     if (m_pFileStream->IsEof() || !readLine(nCurPos) )
commit dab009a4fcd2b558a055b917e5ff48bfb998689e
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Fri May 17 10:03:09 2013 +0200

    use safer/more explicit C++ casts
    
    Especially in debug mode.
    
    Change-Id: I431851bd46da0f46fdb5cfaa19c76cb139823fa8

diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx
index 2030b3c..083cad4 100644
--- a/connectivity/source/drivers/flat/ETable.cxx
+++ b/connectivity/source/drivers/flat/ETable.cxx
@@ -604,7 +604,12 @@ sal_Bool OFlatTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols,sal
         m_bNeedToReadLine = false;
     }
 
-    OFlatConnection* pConnection = (OFlatConnection*)m_pConnection;
+#if OSL_DEBUG_LEVEL>1
+    OFlatConnection* pConnection = dynamic_cast<OFlatConnection*>(m_pConnection);
+    assert(pConnection);
+#else
+    OFlatConnection* pConnection = static_cast<OFlatConnection*>(m_pConnection);
+#endif
     const sal_Unicode cDecimalDelimiter = pConnection->getDecimalDelimiter();
     const sal_Unicode cThousandDelimiter = pConnection->getThousandDelimiter();
     // Fields:
commit 9b9612f554bf8754ff911dec07253ffdddbcb216
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Fri May 17 09:56:14 2013 +0200

    janitorial: clean up comments
    
    Change-Id: Iaa146aad75acdceaeb6701b069f0a538904af298

diff --git a/connectivity/source/inc/file/FResultSet.hxx b/connectivity/source/inc/file/FResultSet.hxx
index 7c55d2f..738c2e1 100644
--- a/connectivity/source/inc/file/FResultSet.hxx
+++ b/connectivity/source/inc/file/FResultSet.hxx
@@ -47,9 +47,6 @@ namespace connectivity
 {
     namespace file
     {
-        /*
-        **  java_sql_ResultSet
-        */
         typedef ::cppu::WeakComponentImplHelper12<  ::com::sun::star::sdbc::XResultSet,
                                                     ::com::sun::star::sdbc::XRow,
                                                     ::com::sun::star::sdbc::XResultSetMetaDataSupplier,
@@ -89,8 +86,6 @@ namespace connectivity
             TIntVector::iterator                    m_aEvaluateIter;
 
 
-//          TInt2IntMap                             m_aBookmarks;         // map from bookmarks to logical position
-//          ::std::vector<TInt2IntMap::iterator>    m_aBookmarksPositions;// vector of iterators to bookmark map, the order is the logical position
             OSkipDeletedSet                         m_aSkipDeletedSet;
 
             ::rtl::Reference<OKeySet>                   m_pFileSet;
@@ -319,7 +314,7 @@ namespace connectivity
             sal_Int32   map = column;
 
             OSL_ENSURE(column > 0, "file::OResultSet::mapColumn: invalid column index!");
-                // the first column (index 0) is for convenience only. The first real select column is no 1.
+            // the first column (index 0) is for convenience only. The first real select column is number 1.
             if ((column > 0) && (column < (sal_Int32)m_aColMapping.size()))
                 map = m_aColMapping[column];
 
commit 4f214b2b42dafe059f5bb4601ab4cbfac5a6934e
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Fri May 17 09:53:33 2013 +0200

    connectivity::file::OResultSet remove totally unused data member
    
    Change-Id: I5c4b2d72b600c8ce9de070dc82bf489d66144342

diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx
index 555ac12..fbd87a3 100644
--- a/connectivity/source/drivers/file/FResultSet.cxx
+++ b/connectivity/source/drivers/file/FResultSet.cxx
@@ -99,7 +99,6 @@ OResultSet::OResultSet(OStatement_Base* pStmt,OSQLParseTreeIterator&    _aSQLIte
                         ,m_nFilePos(0)
                         ,m_nLastVisitedPos(-1)
                         ,m_nRowCountResult(-1)
-                        ,m_nCurrentPosition(0)
                         ,m_nColumnCount(0)
                         ,m_bWasNull(sal_False)
                         ,m_bEOF(sal_False)
diff --git a/connectivity/source/inc/file/FResultSet.hxx b/connectivity/source/inc/file/FResultSet.hxx
index fe60f07..7c55d2f 100644
--- a/connectivity/source/inc/file/FResultSet.hxx
+++ b/connectivity/source/inc/file/FResultSet.hxx
@@ -125,7 +125,6 @@ namespace connectivity
             sal_Int32                               m_nFilePos;
             sal_Int32                               m_nLastVisitedPos;
             sal_Int32                               m_nRowCountResult;
-            sal_Int32                               m_nCurrentPosition;     // current position of the resultset is returned when ask for getRow()
             sal_Int32                               m_nColumnCount;
             sal_Bool                                m_bWasNull;
             sal_Bool                                m_bEOF;                 // after last record
commit 10e03ade8fc9ee78b99f4f24bf962d968ffee346
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Fri May 17 09:46:28 2013 +0200

    janitorial: typos in comments
    
    Change-Id: I6fbd522e796a8f1b6c13136f65bda11c19ffbda4

diff --git a/connectivity/source/commontools/TSkipDeletedSet.cxx b/connectivity/source/commontools/TSkipDeletedSet.cxx
index cc25b3f..a0304c5 100644
--- a/connectivity/source/commontools/TSkipDeletedSet.cxx
+++ b/connectivity/source/commontools/TSkipDeletedSet.cxx
@@ -54,7 +54,7 @@ sal_Bool OSkipDeletedSet::skipDeleted(IResultSetHelper::Movement _eCursorPositio
             nDelOffset = 1;
             break;
         case IResultSetHelper::LAST:
-            eDelPosition = IResultSetHelper::PRIOR; // lsat row is invalid so position before
+            eDelPosition = IResultSetHelper::PRIOR; // last row is invalid so position before
             nDelOffset = 1;
             break;
         case IResultSetHelper::RELATIVE:
@@ -89,7 +89,7 @@ sal_Bool OSkipDeletedSet::skipDeleted(IResultSetHelper::Movement _eCursorPositio
         }
 
 
-        // and than move forward until we are after the last row
+        // and then move forward until we are after the last row
         while(bDataFound)
         {
             bDataFound = m_pHelper->move(IResultSetHelper::NEXT, 1, sal_False); // we don't need the data here


More information about the Libreoffice-commits mailing list