dba34b: #i115655# new ui setting for max row scan for text db

This commit is contained in:
Ocke.Janssen
2010-11-25 11:23:27 +01:00
parent 7b7a507d69
commit f99088e108
4 changed files with 14 additions and 1 deletions

View File

@@ -56,6 +56,7 @@ using namespace ::com::sun::star::lang;
// --------------------------------------------------------------------------------
OFlatConnection::OFlatConnection(ODriver* _pDriver) : OConnection(_pDriver)
,m_nMaxRowsToScan(50)
,m_bHeaderLine(sal_True)
,m_cFieldDelimiter(';')
,m_cStringDelimiter('"')
@@ -108,6 +109,10 @@ void OFlatConnection::construct(const ::rtl::OUString& url,const Sequence< Prope
OSL_VERIFY( pBegin->Value >>= aVal );
m_cThousandDelimiter = aVal.toChar();
}
else if ( !pBegin->Name.compareToAscii("MaxRowScan") )
{
pBegin->Value >>= m_nMaxRowsToScan;
}
}
osl_decrementInterlockedCount( &m_refCount );

View File

@@ -127,6 +127,7 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale)
::comphelper::UStringMixEqual aCase(bCase);
::std::vector<String> aColumnNames,m_aTypeNames;
m_aTypeNames.resize(nFieldCount);
const sal_Int32 nMaxRowsToScan = pConnection->getMaxRowsToScan();
sal_Int32 nRowCount = 0;
do
{
@@ -158,7 +159,7 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale)
}
++nRowCount;
}
while(nRowCount < 50 && m_pFileStream->ReadByteStringLine(aFirstLine,nEncoding));
while(nRowCount < nMaxRowsToScan && m_pFileStream->ReadByteStringLine(aFirstLine,nEncoding));
for (xub_StrLen i = 0; i < nFieldCount; i++)
{

View File

@@ -75,6 +75,11 @@
<value>false</value>
</prop>
</node>
<node oor:name="MaxRowScan" oor:op="replace">
<prop oor:name="Value" oor:type="xs:int">
<value>100</value>
</prop>
</node>
</node>
<node oor:name="Features">
<node oor:name="UseSQL92NamingConstraints" oor:op="replace">

View File

@@ -38,6 +38,7 @@ namespace connectivity
class OFlatConnection : public file::OConnection
{
private:
sal_Int32 m_nMaxRowsToScan;
sal_Bool m_bHeaderLine; // column names in first row
sal_Unicode m_cFieldDelimiter; // look at the name
sal_Unicode m_cStringDelimiter; // delimiter for strings m_cStringDelimiter blabla m_cStringDelimiter
@@ -55,6 +56,7 @@ namespace connectivity
inline sal_Unicode getStringDelimiter() const { return m_cStringDelimiter; }
inline sal_Unicode getDecimalDelimiter() const { return m_cDecimalDelimiter; }
inline sal_Unicode getThousandDelimiter() const { return m_cThousandDelimiter;}
inline sal_Int32 getMaxRowsToScan() const { return m_nMaxRowsToScan;}
// XServiceInfo
DECLARE_SERVICE_INFO();