User: rt Date: 2008-01-30 07:53:03+0000 Modified: dba/connectivity/source/drivers/flat/ETable.cxx
Log: INTEGRATION: CWS dba24d (1.58.20); FILE MERGED 2007/11/26 12:40:26 fs 1.58.20.2: #i10000# 2007/11/26 07:52:25 oj 1.58.20.1: #i31385# read multiline string File Changes: Directory: /dba/connectivity/source/drivers/flat/ ================================================= File [changed]: ETable.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/flat/ETable.cxx?r1=1.58&r2=1.59 Delta lines: +34 -20 --------------------- --- ETable.cxx 2007-09-26 14:29:25+0000 1.58 +++ ETable.cxx 2008-01-30 07:53:01+0000 1.59 @@ -683,7 +683,6 @@ { if ( !m_pFileStream ) return sal_False; - OFlatConnection* pConnection = (OFlatConnection*)m_pConnection; // ---------------------------------------------------------- // Positionierung vorbereiten: @@ -707,13 +706,12 @@ m_aRowToFilePos.insert(::std::map<sal_Int32,sal_Int32>::value_type(m_nRowPos,m_nFilePos)); - m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding()); - if (m_pFileStream->IsEof()) + if ( !readLine(nCurPos)) { m_nMaxRowCount = m_nRowPos; return sal_False; } - nCurPos = m_pFileStream->Tell(); + break; case IResultSetHelper::PRIOR: --m_nRowPos; @@ -723,10 +721,8 @@ m_pFileStream->Seek(m_nFilePos); if (m_pFileStream->IsEof() || !checkHeaderLine()) return sal_False; - m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding()); - if (m_pFileStream->IsEof()) + if ( !readLine(nCurPos) ) return sal_False; - nCurPos = m_pFileStream->Tell(); } else m_nRowPos = 0; @@ -740,10 +736,9 @@ m_pFileStream->Seek(m_nFilePos); if (m_pFileStream->IsEof() || !checkHeaderLine()) return sal_False; - m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding()); - if (m_pFileStream->IsEof()) + + if ( !readLine(nCurPos) ) return sal_False; - nCurPos = m_pFileStream->Tell(); } else { @@ -775,10 +770,8 @@ m_pFileStream->Seek(m_nFilePos); if (m_pFileStream->IsEof() || !checkHeaderLine()) return sal_False; - m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding()); - if (m_pFileStream->IsEof()) + if ( !readLine(nCurPos) ) return sal_False; - nCurPos = m_pFileStream->Tell(); } else if(m_nMaxRowCount && nOffset > m_nMaxRowCount) // offset is outside the table { @@ -803,10 +796,8 @@ m_pFileStream->Seek(m_nFilePos); if (m_pFileStream->IsEof() || !checkHeaderLine()) return sal_False; - m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding()); - if (m_pFileStream->IsEof()) + if ( !readLine(nCurPos) ) return sal_False; - nCurPos = m_pFileStream->Tell(); } } } @@ -818,10 +809,9 @@ return sal_False; m_nFilePos = m_pFileStream->Tell(); // Byte-Position in der Datei merken (am ZeilenANFANG) - m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding()); - if (m_pFileStream->IsEof()) + + if ( !readLine(nCurPos) ) return sal_False; - nCurPos = m_pFileStream->Tell(); break; } @@ -829,3 +819,27 @@ return sal_True; } // ----------------------------------------------------------------------------- +sal_Bool OFlatTable::readLine(sal_Int32& _rnCurrentPos) +{ + m_pFileStream->ReadByteStringLine(m_aCurrentLine,m_pConnection->getTextEncoding()); + if (m_pFileStream->IsEof()) + return sal_False; + + OFlatConnection* pConnection = static_cast<OFlatConnection*>(m_pConnection); + QuotedTokenizedString sLine = m_aCurrentLine; + while( (sLine.GetTokenCount(pConnection->getStringDelimiter()) % 2) != 1 ) + { + m_pFileStream->ReadByteStringLine(sLine,m_pConnection->getTextEncoding()); + if ( !m_pFileStream->IsEof() ) + { + m_aCurrentLine.Append('\n'); + m_aCurrentLine += sLine; + sLine = m_aCurrentLine; + } + else + break; + } + _rnCurrentPos = m_pFileStream->Tell(); + return sal_True; +} + --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
