diff options
Diffstat (limited to 'connectivity/source/drivers')
20 files changed, 288 insertions, 290 deletions
diff --git a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx index 4fd2d06caca5..63ffb198f08a 100644 --- a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx +++ b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx @@ -128,6 +128,7 @@ sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::findColumn( const OUString& colum if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) : columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i))) break; + /* FIXME: should throw in case of not found ? */ return i; } #define BLOCK_SIZE 256 diff --git a/connectivity/source/drivers/ado/AResultSet.cxx b/connectivity/source/drivers/ado/AResultSet.cxx index b3dc37278b04..46bcb2259883 100644 --- a/connectivity/source/drivers/ado/AResultSet.cxx +++ b/connectivity/source/drivers/ado/AResultSet.cxx @@ -166,6 +166,7 @@ sal_Int32 SAL_CALL OResultSet::findColumn( const OUString& columnName ) throw(SQ if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) : columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i))) break; + /* FIXME: should throw in case of not found ? */ return i; } #define BLOCK_SIZE 256 diff --git a/connectivity/source/drivers/calc/CTable.cxx b/connectivity/source/drivers/calc/CTable.cxx index 93e4166580a0..12e729c5df13 100644 --- a/connectivity/source/drivers/calc/CTable.cxx +++ b/connectivity/source/drivers/calc/CTable.cxx @@ -451,8 +451,7 @@ void OCalcTable::fillColumns() if ( !m_xSheet.is() ) throw SQLException(); - String aStrFieldName; - aStrFieldName.AssignAscii("Column"); + OUString aStrFieldName("Column"); OUString aTypeName; ::comphelper::UStringMixEqual aCase(m_pConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers()); const sal_Bool bStoresMixedCaseQuotedIdentifiers = getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers(); diff --git a/connectivity/source/drivers/dbase/DIndex.cxx b/connectivity/source/drivers/dbase/DIndex.cxx index bd2ce0d8a351..3dc72295951c 100644 --- a/connectivity/source/drivers/dbase/DIndex.cxx +++ b/connectivity/source/drivers/dbase/DIndex.cxx @@ -375,16 +375,15 @@ OUString ODbaseIndex::getCompletePath() void ODbaseIndex::createINFEntry() { // synchronize inf-file - String sEntry = m_Name; - sEntry += OUString(".ndx"); + OUString sEntry = m_Name + ".ndx"; - OUString sCfgFile(m_pTable->getConnection()->getURL()); - sCfgFile += OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DELIMITER); - sCfgFile += m_pTable->getName(); - sCfgFile += OUString(".inf"); + OUString sCfgFile(m_pTable->getConnection()->getURL() + + OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DELIMITER) + + m_pTable->getName() + + ".inf"); OUString sPhysicalPath; - LocalFileHelper::ConvertURLToPhysicalName(sCfgFile,sPhysicalPath); + LocalFileHelper::ConvertURLToPhysicalName(sCfgFile, sPhysicalPath); Config aInfFile(sPhysicalPath); aInfFile.SetGroup(dBASE_III_GROUP); @@ -394,7 +393,7 @@ void ODbaseIndex::createINFEntry() sal_Bool bCase = isCaseSensitive(); while (aNewEntry.isEmpty()) { - aNewEntry = OString(RTL_CONSTASCII_STRINGPARAM("NDX")); + aNewEntry = OString("NDX"); aNewEntry += OString::number(++nSuffix); for (sal_uInt16 i = 0; i < aInfFile.GetKeyCount(); i++) { @@ -434,17 +433,16 @@ sal_Bool ODbaseIndex::DropImpl() aInfFile.SetGroup(dBASE_III_GROUP); sal_uInt16 nKeyCnt = aInfFile.GetKeyCount(); OString aKeyName; - String sEntry = m_Name; - sEntry += OUString(".ndx"); + OUString sEntry = m_Name + (".ndx"); // delete entries from the inf file for (sal_uInt16 nKey = 0; nKey < nKeyCnt; nKey++) { // References the Key to an Index-file? aKeyName = aInfFile.GetKeyName( nKey ); - if (aKeyName.copy(0,3).equalsL(RTL_CONSTASCII_STRINGPARAM("NDX"))) + if (aKeyName.copy(0,3).equals("NDX")) { - if(sEntry == String(OStringToOUString(aInfFile.ReadKey(aKeyName),m_pTable->getConnection()->getTextEncoding()))) + if(sEntry == OStringToOUString(aInfFile.ReadKey(aKeyName),m_pTable->getConnection()->getTextEncoding())) { aInfFile.DeleteKey(aKeyName); break; @@ -501,26 +499,15 @@ sal_Bool ODbaseIndex::CreateImpl() // firstly the result must be sorted utl::SharedUNOComponent<XStatement> xStmt; utl::SharedUNOComponent<XResultSet> xSet; - String aName; + OUString aName; try { xStmt.set( m_pTable->getConnection()->createStatement(), UNO_SET_THROW); aName = getString(xCol->getFastPropertyValue(PROPERTY_ID_NAME)); - const String aQuote(m_pTable->getConnection()->getMetaData()->getIdentifierQuoteString()); - OUString aStatement( "SELECT " ); - aStatement += aQuote; - aStatement += aName; - aStatement += aQuote; - aStatement += " FROM "; - aStatement += aQuote; - aStatement += m_pTable->getName().getStr(); - aStatement += aQuote; - aStatement += " ORDER BY "; - aStatement += aQuote; - aStatement += aName; - aStatement += aQuote; + const OUString aQuote(m_pTable->getConnection()->getMetaData()->getIdentifierQuoteString()); + OUString aStatement( "SELECT " + aQuote + aName + aQuote +" FROM " + aQuote + m_pTable->getName() + aQuote + " ORDER BY " + aQuote + aName + aQuote); xSet.set( xStmt->executeQuery(aStatement),UNO_SET_THROW ); } diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index 8caf763acdc7..b7ee3cea1602 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -317,8 +317,7 @@ void ODbaseTable::fillColumns() m_aPrecisions.reserve(nFieldCount); m_aScales.reserve(nFieldCount); - String aStrFieldName; - aStrFieldName.AssignAscii("Column"); + OUString aStrFieldName("Column"); OUString aTypeName; const sal_Bool bCase = getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers(); const bool bFoxPro = m_aHeader.db_typ == VisualFoxPro || m_aHeader.db_typ == VisualFoxProAuto || m_aHeader.db_typ == FoxProMemo; @@ -332,7 +331,7 @@ void ODbaseTable::fillColumns() break; sal_Bool bIsRowVersion = bFoxPro && ( aDBFColumn.db_frei2[0] & 0x01 ) == 0x01; - const String aColumnName((const char *)aDBFColumn.db_fnm,m_eEncoding); + const OUString aColumnName((const char *)aDBFColumn.db_fnm, strlen((const char *)aDBFColumn.db_fnm), m_eEncoding); m_aRealFieldLengths.push_back(aDBFColumn.db_flng); sal_Int32 nPrecision = aDBFColumn.db_flng; @@ -347,77 +346,77 @@ void ODbaseTable::fillColumns() switch (aDBFColumn.db_typ) { - case 'C': - eType = DataType::VARCHAR; - aTypeName = "VARCHAR"; - break; - case 'F': - case 'N': - aTypeName = "DECIMAL"; - if ( aDBFColumn.db_typ == 'N' ) - aTypeName = "NUMERIC"; - eType = DataType::DECIMAL; - - // for numeric fields two characters more are written, than the precision of the column description predescribes, - // to keep room for the possible sign and the comma. This has to be considered... - nPrecision = SvDbaseConverter::ConvertPrecisionToOdbc(nPrecision,aDBFColumn.db_dez); - // This is not true for older versions .... - break; - case 'L': - eType = DataType::BIT; - aTypeName = "BOOLEAN"; - break; - case 'Y': - bIsCurrency = sal_True; - eType = DataType::DOUBLE; + case 'C': + eType = DataType::VARCHAR; + aTypeName = "VARCHAR"; + break; + case 'F': + case 'N': + aTypeName = "DECIMAL"; + if ( aDBFColumn.db_typ == 'N' ) + aTypeName = "NUMERIC"; + eType = DataType::DECIMAL; + + // for numeric fields two characters more are written, than the precision of the column description predescribes, + // to keep room for the possible sign and the comma. This has to be considered... + nPrecision = SvDbaseConverter::ConvertPrecisionToOdbc(nPrecision,aDBFColumn.db_dez); + // This is not true for older versions .... + break; + case 'L': + eType = DataType::BIT; + aTypeName = "BOOLEAN"; + break; + case 'Y': + bIsCurrency = sal_True; + eType = DataType::DOUBLE; + aTypeName = "DOUBLE"; + break; + case 'D': + eType = DataType::DATE; + aTypeName = "DATE"; + break; + case 'T': + eType = DataType::TIMESTAMP; + aTypeName = "TIMESTAMP"; + break; + case 'I': + eType = DataType::INTEGER; + aTypeName = "INTEGER"; + break; + case 'M': + if ( bFoxPro && ( aDBFColumn.db_frei2[0] & 0x04 ) == 0x04 ) + { + eType = DataType::LONGVARBINARY; + aTypeName = "LONGVARBINARY"; + } + else + { + aTypeName = "LONGVARCHAR"; + eType = DataType::LONGVARCHAR; + } + nPrecision = 2147483647; + break; + case 'P': + aTypeName = "LONGVARBINARY"; + eType = DataType::LONGVARBINARY; + nPrecision = 2147483647; + break; + case '0': + case 'B': + if ( m_aHeader.db_typ == VisualFoxPro || m_aHeader.db_typ == VisualFoxProAuto ) + { aTypeName = "DOUBLE"; - break; - case 'D': - eType = DataType::DATE; - aTypeName = "DATE"; - break; - case 'T': - eType = DataType::TIMESTAMP; - aTypeName = "TIMESTAMP"; - break; - case 'I': - eType = DataType::INTEGER; - aTypeName = "INTEGER"; - break; - case 'M': - if ( bFoxPro && ( aDBFColumn.db_frei2[0] & 0x04 ) == 0x04 ) - { - eType = DataType::LONGVARBINARY; - aTypeName = "LONGVARBINARY"; - } - else - { - aTypeName = "LONGVARCHAR"; - eType = DataType::LONGVARCHAR; - } - nPrecision = 2147483647; - break; - case 'P': + eType = DataType::DOUBLE; + } + else + { aTypeName = "LONGVARBINARY"; eType = DataType::LONGVARBINARY; nPrecision = 2147483647; - break; - case '0': - case 'B': - if ( m_aHeader.db_typ == VisualFoxPro || m_aHeader.db_typ == VisualFoxProAuto ) - { - aTypeName = "DOUBLE"; - eType = DataType::DOUBLE; - } - else - { - aTypeName = "LONGVARBINARY"; - eType = DataType::LONGVARBINARY; - nPrecision = 2147483647; - } - break; - default: - eType = DataType::OTHER; + } + break; + default: + eType = DataType::OTHER; } m_aTypes.push_back(eType); @@ -485,7 +484,7 @@ void ODbaseTable::construct() m_aHeader.db_slng = 0; m_aMemoHeader.db_size = 0; - String sFileName(getEntry(m_pConnection,m_Name)); + OUString sFileName(getEntry(m_pConnection, m_Name)); INetURLObject aURL; aURL.SetURL(sFileName); @@ -608,7 +607,7 @@ sal_Bool ODbaseTable::ReadMemoHeader() return sal_True; } // ------------------------------------------------------------------------- -String ODbaseTable::getEntry(OConnection* _pConnection,const OUString& _sName ) +OUString ODbaseTable::getEntry(OConnection* _pConnection,const OUString& _sName ) { SAL_INFO( "connectivity.drivers", "dbase Ocke.Janssen@sun.com ODbaseTable::getEntry" ); OUString sURL; @@ -625,7 +624,7 @@ String ODbaseTable::getEntry(OConnection* _pConnection,const OUString& _sName ) { sName = xRow->getString(1); aURL.SetSmartProtocol(INET_PROT_FILE); - String sUrl = _pConnection->getURL() + s_sSeparator + sName; + OUString sUrl = _pConnection->getURL() + s_sSeparator + sName; aURL.SetSmartURL( sUrl ); // cut the extension @@ -634,7 +633,7 @@ String ODbaseTable::getEntry(OConnection* _pConnection,const OUString& _sName ) // name and extension have to coincide if ( _pConnection->matchesExtension( sExt ) ) { - sName = sName.replaceAt(sName.getLength()-(sExt.getLength()+1),sExt.getLength()+1,OUString()); + sName = sName.replaceAt(sName.getLength() - (sExt.getLength() + 1), sExt.getLength() + 1, OUString()); if ( sName == _sName ) { Reference< XContentAccess > xContentAccess( xDir, UNO_QUERY ); @@ -689,7 +688,7 @@ void ODbaseTable::refreshIndexes() // Refences the key an index-file? aKeyName = aInfFile.GetKeyName( nKey ); //...if yes, add the index list of the table - if (aKeyName.copy(0,3).equalsL(RTL_CONSTASCII_STRINGPARAM("NDX"))) + if (aKeyName.copy(0,3).equals("NDX")) { OString aIndexName = aInfFile.ReadKey(aKeyName); aURL.setName(OStringToOUString(aIndexName, m_eEncoding)); @@ -1036,8 +1035,8 @@ sal_Bool ODbaseTable::CreateImpl() INetURLObject aURL; aURL.SetSmartProtocol(INET_PROT_FILE); - String aName = getEntry(m_pConnection,m_Name); - if(!aName.Len()) + OUString aName = getEntry(m_pConnection, m_Name); + if(aName.isEmpty()) { OUString aIdent = m_pConnection->getContent()->getIdentifier()->getContentIdentifier(); if ( aIdent.lastIndexOf('/') != (aIdent.getLength()-1) ) @@ -1090,7 +1089,7 @@ sal_Bool ODbaseTable::CreateImpl() if (bMemoFile) { - String aExt = aURL.getExtension(); + OUString aExt = aURL.getExtension(); aURL.setExtension("dbt"); // extension for memo file Content aMemo1Content(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>(), comphelper::getProcessComponentContext()); @@ -2191,11 +2190,11 @@ void ODbaseTable::alterColumn(sal_Int32 index, // creates a temp file - String sTempName = createTempFile(); + OUString sTempName = createTempFile(); pNewTable = new ODbaseTable(m_pTables,static_cast<ODbaseConnection*>(m_pConnection)); Reference<XPropertySet> xHoldTable = pNewTable; - pNewTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(OUString(sTempName))); + pNewTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(sTempName)); Reference<XAppend> xAppend(pNewTable->getColumns(),UNO_QUERY); OSL_ENSURE(xAppend.is(),"ODbaseTable::alterColumn: No XAppend interface!"); @@ -2302,10 +2301,10 @@ void SAL_CALL ODbaseTable::rename( const OUString& newName ) throw(::com::sun::s namespace { void renameFile(OConnection* _pConenction,const OUString& oldName, - const OUString& newName,const String& _sExtension) + const OUString& newName,const OUString& _sExtension) { - String aName = ODbaseTable::getEntry(_pConenction,oldName); - if(!aName.Len()) + OUString aName = ODbaseTable::getEntry(_pConenction,oldName); + if(aName.isEmpty()) { OUString aIdent = _pConenction->getContent()->getIdentifier()->getContentIdentifier(); if ( aIdent.lastIndexOf('/') != (aIdent.getLength()-1) ) @@ -2317,9 +2316,7 @@ namespace aURL.SetURL(aName); aURL.setExtension( _sExtension ); - OUString sNewName(newName); - sNewName += "."; - sNewName += _sExtension; + OUString sNewName(newName + "." + _sExtension); try { @@ -2328,7 +2325,7 @@ namespace Sequence< PropertyValue > aProps( 1 ); aProps[0].Name = "Title"; aProps[0].Handle = -1; // n/a - aProps[0].Value = makeAny( OUString(sNewName) ); + aProps[0].Value = makeAny( sNewName ); Sequence< Any > aValues; aContent.executeCommand( "setPropertyValues",makeAny(aProps) ) >>= aValues; if(aValues.getLength() && aValues[0].hasValue()) @@ -2360,11 +2357,11 @@ void SAL_CALL ODbaseTable::renameImpl( const OUString& newName ) throw(::com::su void ODbaseTable::addColumn(const Reference< XPropertySet >& _xNewColumn) { SAL_INFO( "connectivity.drivers", "dbase Ocke.Janssen@sun.com ODbaseTable::addColumn" ); - String sTempName = createTempFile(); + OUString sTempName = createTempFile(); ODbaseTable* pNewTable = new ODbaseTable(m_pTables,static_cast<ODbaseConnection*>(m_pConnection)); Reference< XPropertySet > xHold = pNewTable; - pNewTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(OUString(sTempName))); + pNewTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(sTempName)); { Reference<XAppend> xAppend(pNewTable->getColumns(),UNO_QUERY); sal_Bool bCase = getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers(); @@ -2433,11 +2430,11 @@ void ODbaseTable::addColumn(const Reference< XPropertySet >& _xNewColumn) void ODbaseTable::dropColumn(sal_Int32 _nPos) { SAL_INFO( "connectivity.drivers", "dbase Ocke.Janssen@sun.com ODbaseTable::dropColumn" ); - String sTempName = createTempFile(); + OUString sTempName = createTempFile(); ODbaseTable* pNewTable = new ODbaseTable(m_pTables,static_cast<ODbaseConnection*>(m_pConnection)); Reference< XPropertySet > xHold = pNewTable; - pNewTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(OUString(sTempName))); + pNewTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(sTempName)); { Reference<XAppend> xAppend(pNewTable->getColumns(),UNO_QUERY); sal_Bool bCase = getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers(); @@ -2486,7 +2483,7 @@ void ODbaseTable::dropColumn(sal_Int32 _nPos) construct(); } // ----------------------------------------------------------------------------- -String ODbaseTable::createTempFile() +OUString ODbaseTable::createTempFile() { SAL_INFO( "connectivity.drivers", "dbase Ocke.Janssen@sun.com ODbaseTable::createTempFile" ); OUString aIdent = m_pConnection->getContent()->getIdentifier()->getContentIdentifier(); @@ -2496,16 +2493,16 @@ String ODbaseTable::createTempFile() OUString sTempName(aIdent); OUString sExt(OUString(".") + m_pConnection->getExtension()); OUString sName(m_Name); - TempFile aTempFile(sName,&sExt,&sTempName); + TempFile aTempFile(sName, &sExt, &sTempName); if(!aTempFile.IsValid()) - getConnection()->throwGenericSQLException(STR_COULD_NOT_ALTER_TABLE,*this); + getConnection()->throwGenericSQLException(STR_COULD_NOT_ALTER_TABLE, *this); INetURLObject aURL; aURL.SetSmartProtocol(INET_PROT_FILE); aURL.SetURL(aTempFile.GetURL()); - String sNewName(aURL.getName()); - sNewName.Erase(sNewName.Len() - sExt.getLength()); + OUString sNewName(aURL.getName().copy(0, aURL.getName().getLength() - sExt.getLength())); + return sNewName; } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/dbase/dindexnode.cxx b/connectivity/source/drivers/dbase/dindexnode.cxx index 75f959e48dc2..e19f935111c5 100644 --- a/connectivity/source/drivers/dbase/dindexnode.cxx +++ b/connectivity/source/drivers/dbase/dindexnode.cxx @@ -737,41 +737,42 @@ sal_Bool ONDXKey::IsText(sal_Int32 eType) } //------------------------------------------------------------------ -StringCompare ONDXKey::Compare(const ONDXKey& rKey) const +int ONDXKey::Compare(const ONDXKey& rKey) const { - StringCompare eResult; + sal_Int32 nRes; if (getValue().isNull()) { if (rKey.getValue().isNull() || (rKey.IsText(getDBType()) && rKey.getValue().getString().isEmpty())) - eResult = COMPARE_EQUAL; + nRes = 0; else - eResult = COMPARE_LESS; + nRes = -1; } else if (rKey.getValue().isNull()) { if (getValue().isNull() || (IsText(getDBType()) && getValue().getString().isEmpty())) - eResult = COMPARE_EQUAL; + nRes = 0; else - eResult = COMPARE_GREATER; + nRes = 1; } else if (IsText(getDBType())) { - sal_Int32 nRes = getValue().getString().compareTo(rKey.getValue()); - eResult = (nRes > 0) ? COMPARE_GREATER : (nRes == 0) ? COMPARE_EQUAL : COMPARE_LESS; + nRes = getValue().getString().compareTo(rKey.getValue()); } else { - double m = getValue(),n = rKey.getValue(); - eResult = (m > n) ? COMPARE_GREATER : (n == m) ? COMPARE_EQUAL : COMPARE_LESS; + double m = getValue(); + double n = rKey.getValue(); + nRes = (m > n) ? 1 : ( m < n) ? -1 : 0; } // compare record, if index !Unique - if (eResult == COMPARE_EQUAL && nRecord && rKey.nRecord) - eResult = (nRecord > rKey.nRecord) ? COMPARE_GREATER : - (nRecord == rKey.nRecord) ? COMPARE_EQUAL : COMPARE_LESS; - - return eResult; + if (nRes == 0 && nRecord && rKey.nRecord) + { + nRes = (nRecord > rKey.nRecord) ? 1 : + (nRecord == rKey.nRecord) ? 0 : -1; + } + return nRes; } // ----------------------------------------------------------------------------- void ONDXKey::setValue(const ORowSetValue& _rVal) diff --git a/connectivity/source/drivers/evoab2/NResultSet.cxx b/connectivity/source/drivers/evoab2/NResultSet.cxx index cc74911a9071..78021bf3812b 100644 --- a/connectivity/source/drivers/evoab2/NResultSet.cxx +++ b/connectivity/source/drivers/evoab2/NResultSet.cxx @@ -1125,6 +1125,7 @@ sal_Int32 SAL_CALL OEvoabResultSet::findColumn( const OUString& columnName ) thr if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) : columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i))) break; + /* FXIME ? should trow when not found no? */ return i; } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/file/FConnection.cxx b/connectivity/source/drivers/file/FConnection.cxx index 447a6dc435e3..01c5e82761cc 100644 --- a/connectivity/source/drivers/file/FConnection.cxx +++ b/connectivity/source/drivers/file/FConnection.cxx @@ -79,15 +79,13 @@ void SAL_CALL OConnection::release() throw() } //----------------------------------------------------------------------------- -sal_Bool OConnection::matchesExtension( const String& _rExt ) const +sal_Bool OConnection::matchesExtension( const OUString& _rExt ) const { if ( isCaseSensitveExtension() ) return ( getExtension() == _rExt ); - String sMyExtension( getExtension() ); - sMyExtension.ToLowerAscii(); - String sExt( _rExt ); - sExt.ToLowerAscii(); + OUString sMyExtension( getExtension().toAsciiLowerCase() ); + OUString sExt( _rExt.toAsciiLowerCase() ); return sMyExtension == sExt; } @@ -131,7 +129,7 @@ void OConnection::construct(const OUString& url,const Sequence< PropertyValue >& nLen = url.indexOf(':',nLen+1); OUString aDSN(url.copy(nLen+1)); - String aFileName = aDSN; + OUString aFileName = aDSN; INetURLObject aURL; aURL.SetSmartProtocol(INET_PROT_FILE); { @@ -200,7 +198,7 @@ void OConnection::construct(const OUString& url,const Sequence< PropertyValue >& if(!m_xDir.is() || !m_xContent.is()) throwUrlNotValid(getURL(),OUString()); - if (m_aFilenameExtension.Search('*') != STRING_NOTFOUND || m_aFilenameExtension.Search('?') != STRING_NOTFOUND) + if (m_aFilenameExtension.indexOf('*') >= 0 || m_aFilenameExtension.indexOf('?') >= 0) throw SQLException(); } catch(const Exception&) diff --git a/connectivity/source/drivers/file/FDatabaseMetaData.cxx b/connectivity/source/drivers/file/FDatabaseMetaData.cxx index b33f88b13257..b4f445f7189e 100644 --- a/connectivity/source/drivers/file/FDatabaseMetaData.cxx +++ b/connectivity/source/drivers/file/FDatabaseMetaData.cxx @@ -82,7 +82,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns( // ------------------------------------------------------------------------- namespace { - sal_Int16 isCaseSensitiveParentFolder( const String& _rFolderOrDoc, const String& _rDocName ) + sal_Int16 isCaseSensitiveParentFolder( const OUString& _rFolderOrDoc, const OUString& _rDocName ) { sal_Int16 nIsCS = 1; try @@ -215,8 +215,8 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( Reference<XRow> xRow(xResultSet,UNO_QUERY); - String aFilenameExtension = m_pConnection->getExtension(); - String sThisContentExtension; + OUString aFilenameExtension = m_pConnection->getExtension(); + OUString sThisContentExtension; ODatabaseMetaDataResultSet::ORows aRows; // scan the directory for tables OUString aName; @@ -231,7 +231,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( { aName = xRow->getString(1); aURL.SetSmartProtocol(INET_PROT_FILE); - String sUrl = m_pConnection->getURL() + OUString("/") + aName; + OUString sUrl = m_pConnection->getURL() + "/" + aName; aURL.SetSmartURL( sUrl ); sThisContentExtension = aURL.getExtension(); @@ -245,31 +245,35 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( sal_Int16 nCase = isCaseSensitiveParentFolder( m_pConnection->getURL(), aURL.getName() ); switch( nCase ) { - case 1: - bCaseSensitiveDir = sal_True; - break; - case -1: - bKnowCaseSensivity = sal_False; - /** run through */ - case 0: - bCaseSensitiveDir = sal_False; + case 1: + bCaseSensitiveDir = sal_True; + break; + case -1: + bKnowCaseSensivity = sal_False; + /** run through */ + case 0: + bCaseSensitiveDir = sal_False; } if ( bKnowCaseSensivity ) { m_pConnection->setCaseSensitiveExtension( bCaseSensitiveDir, OConnection::GrantAccess() ); if ( !bCaseSensitiveDir ) - aFilenameExtension.ToLowerAscii(); + { + aFilenameExtension = aFilenameExtension.toAsciiLowerCase(); + } } } - if (aFilenameExtension.Len()) + if (!aFilenameExtension.isEmpty()) { if ( !bCaseSensitiveDir ) - sThisContentExtension.ToLowerAscii(); + { + sThisContentExtension = sThisContentExtension.toAsciiLowerCase(); + } if ( sThisContentExtension == aFilenameExtension ) { - aName = aName.replaceAt(aName.getLength()-(aFilenameExtension.Len()+1),aFilenameExtension.Len()+1,OUString()); + aName = aName.copy(0, (aName.getLength()-(aFilenameExtension.getLength()+1))); sal_Unicode nChar = aName.toChar(); if ( match(tableNamePattern,aName,'\0') && ( !bCheckEnabled || ( bCheckEnabled && ((nChar < '0' || nChar > '9')))) ) { diff --git a/connectivity/source/drivers/file/FPreparedStatement.cxx b/connectivity/source/drivers/file/FPreparedStatement.cxx index aa76cde20926..175fd48a3dca 100644 --- a/connectivity/source/drivers/file/FPreparedStatement.cxx +++ b/connectivity/source/drivers/file/FPreparedStatement.cxx @@ -595,7 +595,7 @@ void OPreparedStatement::initializeResultSet(OResultSet* _pResult) } } // ----------------------------------------------------------------------------- -void OPreparedStatement::parseParamterElem(const String& _sColumnName,OSQLParseNode* pRow_Value_Constructor_Elem) +void OPreparedStatement::parseParamterElem(const OUString& _sColumnName, OSQLParseNode* pRow_Value_Constructor_Elem) { SAL_INFO( "connectivity.drivers", "file Ocke.Janssen@sun.com OPreparedStatement::parseParamterElem" ); Reference<XPropertySet> xCol; @@ -610,7 +610,7 @@ void OPreparedStatement::parseParamterElem(const String& _sColumnName,OSQLParseN if(nParameter == -1) nParameter = AddParameter(pRow_Value_Constructor_Elem,xCol); // Save number of parameter in the variable: - SetAssignValue(_sColumnName, String(), sal_True, nParameter); + SetAssignValue(_sColumnName, OUString(), sal_True, nParameter); } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx index 9108f3bc35e6..0e71e23898bd 100644 --- a/connectivity/source/drivers/file/FResultSet.cxx +++ b/connectivity/source/drivers/file/FResultSet.cxx @@ -215,6 +215,9 @@ sal_Int32 SAL_CALL OResultSet::findColumn( const OUString& columnName ) throw(SQ if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) : columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i))) break; + /* FIXME ? should this check for non found. iow return i instead of break, and exception + * if we get out of the for loop + */ return i; } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/file/FStatement.cxx b/connectivity/source/drivers/file/FStatement.cxx index 3555507a4a9e..cb89a384ce76 100644 --- a/connectivity/source/drivers/file/FStatement.cxx +++ b/connectivity/source/drivers/file/FStatement.cxx @@ -563,7 +563,7 @@ void OStatement_Base::GetAssignValues() m_aParameterIndexes.resize(nCount+1,SQL_NO_PARAMETER); // List of Column-Names, that exist in the column_commalist (separated by ;): - ::std::vector<String> aColumnNameList; + ::std::vector<OUString> aColumnNameList; OSL_ENSURE(m_pParseTree->count() >= 4,"OResultSet: Fehler im Parse Tree"); @@ -658,7 +658,7 @@ void OStatement_Base::GetAssignValues() OSL_ENSURE(pAssignmentCommalist->count() > 0,"OResultSet: pAssignmentCommalist->count() <= 0"); // work on all assignments (commalist) ... - ::std::vector< String> aList(1); + ::std::vector< OUString> aList(1); for (sal_uInt32 i = 0; i < pAssignmentCommalist->count(); i++) { OSQLParseNode * pAssignment = pAssignmentCommalist->getChild(i); @@ -686,11 +686,11 @@ void OStatement_Base::GetAssignValues() } } // ------------------------------------------------------------------------- -void OStatement_Base::ParseAssignValues(const ::std::vector< String>& aColumnNameList,OSQLParseNode* pRow_Value_Constructor_Elem,xub_StrLen nIndex) +void OStatement_Base::ParseAssignValues(const ::std::vector< OUString>& aColumnNameList,OSQLParseNode* pRow_Value_Constructor_Elem,xub_StrLen nIndex) { SAL_INFO( "connectivity.drivers", "file Ocke.Janssen@sun.com OStatement_Base::ParseAssignValues" ); OSL_ENSURE(nIndex <= aColumnNameList.size(),"SdbFileCursor::ParseAssignValues: nIndex > aColumnNameList.GetTokenCount()"); - String aColumnName(aColumnNameList[nIndex]); + OUString aColumnName(aColumnNameList[nIndex]); OSL_ENSURE(aColumnName.Len() > 0,"OResultSet: Column-Name nicht gefunden"); OSL_ENSURE(pRow_Value_Constructor_Elem != NULL,"OResultSet: pRow_Value_Constructor_Elem darf nicht NULL sein!"); @@ -704,7 +704,7 @@ void OStatement_Base::ParseAssignValues(const ::std::vector< String>& aColumnNam else if (SQL_ISTOKEN(pRow_Value_Constructor_Elem,NULL)) { // set NULL - SetAssignValue(aColumnName, String(), sal_True); + SetAssignValue(aColumnName, OUString(), sal_True); } else if (SQL_ISRULE(pRow_Value_Constructor_Elem,parameter)) parseParamterElem(aColumnName,pRow_Value_Constructor_Elem); @@ -714,10 +714,10 @@ void OStatement_Base::ParseAssignValues(const ::std::vector< String>& aColumnNam } } //------------------------------------------------------------------ -void OStatement_Base::SetAssignValue(const String& aColumnName, - const String& aValue, - sal_Bool bSetNull, - sal_uInt32 nParameter) +void OStatement_Base::SetAssignValue(const OUString& aColumnName, + const OUString& aValue, + sal_Bool bSetNull, + sal_uInt32 nParameter) { SAL_INFO( "connectivity.drivers", "file Ocke.Janssen@sun.com OStatement_Base::SetAssignValue" ); Reference<XPropertySet> xCol; @@ -741,40 +741,35 @@ void OStatement_Base::SetAssignValue(const String& aColumnName, switch (::comphelper::getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))) { // put criteria depending on the Type as String or double in the variable - case DataType::CHAR: - case DataType::VARCHAR: - case DataType::LONGVARCHAR: - *(m_aAssignValues->get())[nId] = ORowSetValue(aValue); - //Characterset is already converted, since the entire statement was converted - break; - - case DataType::BIT: - { - if (aValue.EqualsIgnoreCaseAscii("TRUE") || aValue.GetChar(0) == '1') - *(m_aAssignValues->get())[nId] = sal_True; - else if (aValue.EqualsIgnoreCaseAscii("FALSE") || aValue.GetChar(0) == '0') - *(m_aAssignValues->get())[nId] = sal_False; - else - { - throwFunctionSequenceException(*this); - } - } - break; - case DataType::TINYINT: - case DataType::SMALLINT: - case DataType::INTEGER: - case DataType::DECIMAL: - case DataType::NUMERIC: - case DataType::REAL: - case DataType::DOUBLE: - case DataType::DATE: - case DataType::TIME: - case DataType::TIMESTAMP: - { - *(m_aAssignValues->get())[nId] = ORowSetValue(aValue); - } break; - default: + case DataType::CHAR: + case DataType::VARCHAR: + case DataType::LONGVARCHAR: + *(m_aAssignValues->get())[nId] = ORowSetValue(aValue); + //Characterset is already converted, since the entire statement was converted + break; + + case DataType::BIT: + if (aValue.equalsIgnoreAsciiCase("TRUE") || aValue[0] == '1') + *(m_aAssignValues->get())[nId] = sal_True; + else if (aValue.equalsIgnoreAsciiCase("FALSE") || aValue[0] == '0') + *(m_aAssignValues->get())[nId] = sal_False; + else throwFunctionSequenceException(*this); + break; + case DataType::TINYINT: + case DataType::SMALLINT: + case DataType::INTEGER: + case DataType::DECIMAL: + case DataType::NUMERIC: + case DataType::REAL: + case DataType::DOUBLE: + case DataType::DATE: + case DataType::TIME: + case DataType::TIMESTAMP: + *(m_aAssignValues->get())[nId] = ORowSetValue(aValue); + break; + default: + throwFunctionSequenceException(*this); } } @@ -785,7 +780,7 @@ void OStatement_Base::SetAssignValue(const String& aColumnName, m_aParameterIndexes[nParameter] = nId; } // ----------------------------------------------------------------------------- -void OStatement_Base::parseParamterElem(const String& /*_sColumnName*/,OSQLParseNode* /*pRow_Value_Constructor_Elem*/) +void OStatement_Base::parseParamterElem(const OUString& /*_sColumnName*/,OSQLParseNode* /*pRow_Value_Constructor_Elem*/) { SAL_INFO( "connectivity.drivers", "file Ocke.Janssen@sun.com OStatement_Base::parseParamterElem" ); // do nothing here diff --git a/connectivity/source/drivers/file/FTable.cxx b/connectivity/source/drivers/file/FTable.cxx index 6a818fca5c5f..7996bb678133 100644 --- a/connectivity/source/drivers/file/FTable.cxx +++ b/connectivity/source/drivers/file/FTable.cxx @@ -54,23 +54,23 @@ OFileTable::OFileTable(sdbcx::OCollection* _pTables,OConnection* _pConnection) } // ------------------------------------------------------------------------- OFileTable::OFileTable( sdbcx::OCollection* _pTables,OConnection* _pConnection, - const OUString& _Name, - const OUString& _Type, - const OUString& _Description , - const OUString& _SchemaName, - const OUString& _CatalogName - ) : OTable_TYPEDEF(_pTables,_pConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers(), - _Name, - _Type, - _Description, - _SchemaName, - _CatalogName) - ,m_pConnection(_pConnection) - ,m_pFileStream(NULL) - ,m_nFilePos(0) - ,m_pBuffer(NULL) - ,m_nBufferSize(0) - ,m_bWriteable(sal_False) + const OUString& _Name, + const OUString& _Type, + const OUString& _Description , + const OUString& _SchemaName, + const OUString& _CatalogName ) + : OTable_TYPEDEF(_pTables,_pConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers(), + _Name, + _Type, + _Description, + _SchemaName, + _CatalogName) + , m_pConnection(_pConnection) + , m_pFileStream(NULL) + , m_nFilePos(0) + , m_pBuffer(NULL) + , m_nBufferSize(0) + , m_bWriteable(sal_False) { SAL_INFO( "connectivity.drivers", "file Ocke.Janssen@sun.com OFileTable::OFileTable" ); DBG_CTOR( file_OFileTable, NULL ); @@ -88,8 +88,8 @@ void OFileTable::refreshColumns() { SAL_INFO( "connectivity.drivers", "file Ocke.Janssen@sun.com OFileTable::refreshColumns" ); TStringVector aVector; - Reference< XResultSet > xResult = m_pConnection->getMetaData()->getColumns(Any(), - m_SchemaName,m_Name,OUString("%")); + Reference< XResultSet > xResult = m_pConnection->getMetaData()->getColumns(Any(), + m_SchemaName,m_Name, OUString("%")); if(xResult.is()) { @@ -222,11 +222,11 @@ void OFileTable::dropColumn(sal_Int32 /*_nPos*/) } // ----------------------------------------------------------------------------- -SvStream* OFileTable::createStream_simpleError( const String& _rFileName, StreamMode _eOpenMode) +SvStream* OFileTable::createStream_simpleError( const OUString& _rFileName, StreamMode _eOpenMode) { SAL_INFO( "connectivity.drivers", "file Ocke.Janssen@sun.com OFileTable::createStream_simpleError" ); - utl::UcbLockBytesHandler* p_null_dummy=NULL; - SvStream* pReturn = ::utl::UcbStreamHelper::CreateStream( _rFileName, _eOpenMode, (_eOpenMode & STREAM_NOCREATE) == STREAM_NOCREATE ,p_null_dummy); + utl::UcbLockBytesHandler* p_null_dummy = NULL; + SvStream* pReturn = ::utl::UcbStreamHelper::CreateStream( _rFileName, _eOpenMode, (_eOpenMode & STREAM_NOCREATE) == STREAM_NOCREATE, p_null_dummy); if (pReturn && (ERRCODE_NONE != pReturn->GetErrorCode())) { delete pReturn; diff --git a/connectivity/source/drivers/file/fcode.cxx b/connectivity/source/drivers/file/fcode.cxx index 8caa506ee7b7..fb3883cb572b 100644 --- a/connectivity/source/drivers/file/fcode.cxx +++ b/connectivity/source/drivers/file/fcode.cxx @@ -22,7 +22,6 @@ #include "connectivity/sqlparse.hxx" #include <i18nlangtag/mslangid.hxx> #include <tools/debug.hxx> -#include <tools/string.hxx> #include "TConnection.hxx" #include <com/sun/star/sdb/SQLFilterOperator.hpp> #include <comphelper/types.hxx> @@ -123,10 +122,10 @@ OOperandParam::OOperandParam(OSQLParseNode* pNode, sal_Int32 _nPos) OSL_ENSURE(pNode->count() > 0,"Fehler im Parse Tree"); OSQLParseNode *pMark = pNode->getChild(0); - String aParameterName; - if (SQL_ISPUNCTUATION(pMark,"?")) - aParameterName = '?'; - else if (SQL_ISPUNCTUATION(pMark,":")) + OUString aParameterName; + if (SQL_ISPUNCTUATION(pMark, "?")) + aParameterName = "?"; + else if (SQL_ISPUNCTUATION(pMark, ":")) aParameterName = pNode->getChild(1)->getTokenValue(); else { @@ -158,29 +157,27 @@ OOperandConst::OOperandConst(const OSQLParseNode& rColumnRef, const OUString& aS SAL_INFO( "connectivity.drivers", "file Ocke.Janssen@sun.com OOperandConst::OOperandConst" ); switch (rColumnRef.getNodeType()) { - case SQL_NODE_STRING: - m_aValue = aStrValue; - m_eDBType = DataType::VARCHAR; - m_aValue.setBound(sal_True); - return; - case SQL_NODE_INTNUM: - case SQL_NODE_APPROXNUM: - { - m_aValue = aStrValue.toDouble(); - m_eDBType = DataType::DOUBLE; - m_aValue.setBound(sal_True); - return; - } - default: - break; + case SQL_NODE_STRING: + m_aValue = aStrValue; + m_eDBType = DataType::VARCHAR; + m_aValue.setBound(sal_True); + return; + case SQL_NODE_INTNUM: + case SQL_NODE_APPROXNUM: + m_aValue = aStrValue.toDouble(); + m_eDBType = DataType::DOUBLE; + m_aValue.setBound(sal_True); + return; + default: + break; } - if (SQL_ISTOKEN(&rColumnRef,TRUE)) + if (SQL_ISTOKEN(&rColumnRef, TRUE)) { m_aValue = 1.0; m_eDBType = DataType::BIT; } - else if (SQL_ISTOKEN(&rColumnRef,FALSE)) + else if (SQL_ISTOKEN(&rColumnRef, FALSE)) { m_aValue = 0.0; m_eDBType = DataType::BIT; diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx index 8f4e2c365e6d..18c3bd511999 100644 --- a/connectivity/source/drivers/flat/ETable.cxx +++ b/connectivity/source/drivers/flat/ETable.cxx @@ -130,7 +130,7 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) OUString aColumnName; ::comphelper::UStringMixEqual aCase(bCase); vector<OUString> aColumnNames; - vector<String> m_aTypeNames; + vector<OUString> m_aTypeNames; m_aTypeNames.resize(nFieldCount); const sal_Int32 nMaxRowsToScan = pConnection->getMaxRowsToScan(); sal_Int32 nRowCount = 0; @@ -203,7 +203,7 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) } void OFlatTable::impl_fillColumnInfo_nothrow(QuotedTokenizedString& aFirstLine, sal_Int32& nStartPosFirstLine, sal_Int32& nStartPosFirstLine2, - sal_Int32& io_nType, sal_Int32& io_nPrecisions, sal_Int32& io_nScales, String& o_sTypeName, + sal_Int32& io_nType, sal_Int32& io_nPrecisions, sal_Int32& io_nScales, OUString& o_sTypeName, const sal_Unicode cDecimalDelimiter, const sal_Unicode cThousandDelimiter, const CharClass& aCharClass) { if ( io_nType != DataType::VARCHAR ) @@ -214,9 +214,9 @@ void OFlatTable::impl_fillColumnInfo_nothrow(QuotedTokenizedString& aFirstLine, if ( bNumeric ) { // first without fielddelimiter - String aField = aFirstLine.GetTokenSpecial(nStartPosFirstLine,m_cFieldDelimiter,'\0'); - if (aField.Len() == 0 || - (m_cStringDelimiter && m_cStringDelimiter == aField.GetChar(0))) + OUString aField = aFirstLine.GetTokenSpecial(nStartPosFirstLine,m_cFieldDelimiter,'\0'); + if (aField.isEmpty() || + (m_cStringDelimiter && m_cStringDelimiter == aField[0])) { bNumeric = sal_False; if ( m_cStringDelimiter != '\0' ) @@ -226,13 +226,13 @@ void OFlatTable::impl_fillColumnInfo_nothrow(QuotedTokenizedString& aFirstLine, } else { - String aField2; + OUString aField2; if ( m_cStringDelimiter != '\0' ) aField2 = aFirstLine.GetTokenSpecial(nStartPosFirstLine2,m_cFieldDelimiter,m_cStringDelimiter); else aField2 = aField; - if (aField2.Len() == 0) + if (aField2.isEmpty()) { bNumeric = sal_False; } @@ -242,9 +242,9 @@ void OFlatTable::impl_fillColumnInfo_nothrow(QuotedTokenizedString& aFirstLine, xub_StrLen nDot = 0; xub_StrLen nDecimalDelCount = 0; xub_StrLen nSpaceCount = 0; - for (xub_StrLen j = 0; j < aField2.Len(); j++) + for (xub_StrLen j = 0; j < aField2.getLength(); j++) { - const sal_Unicode c = aField2.GetChar(j); + const sal_Unicode c = aField2[j]; if ( j == nSpaceCount && m_cFieldDelimiter != 32 && c == 32 ) { ++nSpaceCount; @@ -274,10 +274,10 @@ void OFlatTable::impl_fillColumnInfo_nothrow(QuotedTokenizedString& aFirstLine, if (bNumeric && cThousandDelimiter) { // Is the delimiter correct? - const String aValue = aField2.GetToken(0,cDecimalDelimiter); - for (sal_Int32 j = aValue.Len() - 4; j >= 0; j -= 4) + const OUString aValue = aField2.getToken(0,cDecimalDelimiter); + for (sal_Int32 j = aValue.getLength() - 4; j >= 0; j -= 4) { - const sal_Unicode c = aValue.GetChar(static_cast<sal_uInt16>(j)); + const sal_Unicode c = aValue[j]; // just digits, decimal- and thousands-delimiter? if (c == cThousandDelimiter && j) continue; @@ -305,19 +305,19 @@ void OFlatTable::impl_fillColumnInfo_nothrow(QuotedTokenizedString& aFirstLine, } else if ( io_nType == DataType::DATE || io_nType == DataType::TIMESTAMP || io_nType == DataType::TIME) { - String aField = aFirstLine.GetTokenSpecial(nStartPosFirstLine,m_cFieldDelimiter,'\0'); - if (aField.Len() == 0 || - (m_cStringDelimiter && m_cStringDelimiter == aField.GetChar(0))) + OUString aField = aFirstLine.GetTokenSpecial(nStartPosFirstLine,m_cFieldDelimiter,'\0'); + if (aField.isEmpty() || + (m_cStringDelimiter && m_cStringDelimiter == aField[0])) { } else { - String aField2; + OUString aField2; if ( m_cStringDelimiter != '\0' ) aField2 = aFirstLine.GetTokenSpecial(nStartPosFirstLine2,m_cFieldDelimiter,m_cStringDelimiter); else aField2 = aField; - if (aField2.Len() ) + if (!aField2.isEmpty() ) { try { @@ -395,19 +395,19 @@ void OFlatTable::impl_fillColumnInfo_nothrow(QuotedTokenizedString& aFirstLine, } else { - String aField = aFirstLine.GetTokenSpecial(nStartPosFirstLine,m_cFieldDelimiter,'\0'); - if (aField.Len() == 0 || - (m_cStringDelimiter && m_cStringDelimiter == aField.GetChar(0))) + OUString aField = aFirstLine.GetTokenSpecial(nStartPosFirstLine,m_cFieldDelimiter,'\0'); + if (aField.isEmpty() || + (m_cStringDelimiter && m_cStringDelimiter == aField[0])) { if ( m_cStringDelimiter != '\0' ) - aField = aFirstLine.GetTokenSpecial(nStartPosFirstLine2,m_cFieldDelimiter,m_cStringDelimiter); + aField = aFirstLine.GetTokenSpecial(nStartPosFirstLine2, m_cFieldDelimiter, m_cStringDelimiter); else nStartPosFirstLine2 = nStartPosFirstLine; } else { if ( m_cStringDelimiter != '\0' ) - aFirstLine.GetTokenSpecial(nStartPosFirstLine2,m_cFieldDelimiter,m_cStringDelimiter); + aFirstLine.GetTokenSpecial(nStartPosFirstLine2, m_cFieldDelimiter, m_cStringDelimiter); } } } @@ -451,7 +451,7 @@ void OFlatTable::construct() if(aURL.getExtension() != OUString(m_pConnection->getExtension())) aURL.setExtension(m_pConnection->getExtension()); - String aFileName = aURL.GetMainURL(INetURLObject::NO_DECODE); + OUString aFileName = aURL.GetMainURL(INetURLObject::NO_DECODE); m_pFileStream = createStream_simpleError( aFileName,STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYWRITE); @@ -475,7 +475,7 @@ void OFlatTable::construct() } } // ------------------------------------------------------------------------- -String OFlatTable::getEntry() +OUString OFlatTable::getEntry() { SAL_INFO( "connectivity.drivers", "flat Ocke.Janssen@sun.com OFlatTable::getEntry" ); OUString sURL; @@ -493,7 +493,7 @@ String OFlatTable::getEntry() { sName = xRow->getString(1); aURL.SetSmartProtocol(INET_PROT_FILE); - String sUrl = m_pConnection->getURL() + s_sSeparator + sName; + OUString sUrl = m_pConnection->getURL() + s_sSeparator + sName; aURL.SetSmartURL( sUrl ); // cut the extension @@ -503,7 +503,7 @@ String OFlatTable::getEntry() if ( m_pConnection->matchesExtension( sExt ) ) { if ( !sExt.isEmpty() ) - sName = sName.replaceAt(sName.getLength()-(sExt.getLength()+1),sExt.getLength()+1,OUString()); + sName = sName.replaceAt(sName.getLength() - (sExt.getLength() + 1), sExt.getLength()+1, OUString()); if ( sName == m_Name ) { Reference< XContentAccess > xContentAccess( xDir, UNO_QUERY ); @@ -643,15 +643,17 @@ sal_Bool OFlatTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns & _rCols, s aIter != aEnd && i < nCount; ++aIter, i++) { - String aStr = m_aCurrentLine.GetTokenSpecial(nStartPos,m_cFieldDelimiter,m_cStringDelimiter); + OUString aStr = m_aCurrentLine.GetTokenSpecial(nStartPos,m_cFieldDelimiter,m_cStringDelimiter); - if (aStr.Len() == 0) + if (aStr.isEmpty()) + { (_rRow->get())[i]->setNull(); + } else { // lengths depending on data-type: - sal_Int32 nLen, - nType = 0; + sal_Int32 nLen; + sal_Int32 nType = 0; if(bIsTable) { nLen = m_aPrecisions[i-1]; @@ -703,11 +705,11 @@ sal_Bool OFlatTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns & _rCols, s (!cDecimalDelimiter && nType == DataType::INTEGER), "FalscherTyp"); - OUStringBuffer aBuf(aStr.Len()); + OUStringBuffer aBuf(aStr.getLength()); // convert to Standard-Notation (DecimalPOINT without thousands-comma): - for (xub_StrLen j = 0; j < aStr.Len(); ++j) + for (sal_Int32 j = 0; j < aStr.getLength(); ++j) { - const sal_Unicode cChar = aStr.GetChar(j); + const sal_Unicode cChar = aStr[j]; if (cDecimalDelimiter && cChar == cDecimalDelimiter) aBuf.append('.'); else if ( cChar == '.' ) // special case, if decimal separator isn't '.' we have to put the string after it @@ -718,7 +720,7 @@ sal_Bool OFlatTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns & _rCols, s } else aBuf.append(cChar); - } // for (xub_StrLen j = 0; j < aStr.Len(); ++j) + } // for (j = 0; j < aStr.getLength(); ++j) aStrConverted = aBuf.makeStringAndClear(); } // if ( DataType::INTEGER != nType ) else @@ -957,7 +959,8 @@ bool OFlatTable::readLine(sal_Int32 * const pEndPos, sal_Int32 * const pStartPos else break; } - } while(nonEmpty && m_aCurrentLine.Len() == 0); + } + while(nonEmpty && m_aCurrentLine.Len() == 0); if(pEndPos) *pEndPos = m_pFileStream->Tell(); diff --git a/connectivity/source/drivers/mork/MResultSet.cxx b/connectivity/source/drivers/mork/MResultSet.cxx index 044cf0223a1c..7486f3f3c54a 100644 --- a/connectivity/source/drivers/mork/MResultSet.cxx +++ b/connectivity/source/drivers/mork/MResultSet.cxx @@ -180,6 +180,8 @@ sal_Int32 SAL_CALL OResultSet::findColumn( const OUString& columnName ) throw(SQ if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) : columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i))) break; + /* FIXME should throw in case of not found ? or at least return -1 */ + return i; } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/mozab/MResultSet.cxx b/connectivity/source/drivers/mozab/MResultSet.cxx index 6f071dd0f0a1..2ae60ae35072 100644 --- a/connectivity/source/drivers/mozab/MResultSet.cxx +++ b/connectivity/source/drivers/mozab/MResultSet.cxx @@ -179,6 +179,8 @@ sal_Int32 SAL_CALL OResultSet::findColumn( const OUString& columnName ) throw(SQ if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) : columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i))) break; + /* FIXME should throw in case of not found ? or at least return -1 */ + return i; } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx index fbb1b597a0b0..c7d0ddc44471 100644 --- a/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx +++ b/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx @@ -160,6 +160,7 @@ sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::findColumn( const OUString& colum if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) : columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i))) break; + /* FIXME should throw in case of not found ? or at least return -1 */ return i; } diff --git a/connectivity/source/drivers/odbcbase/OResultSet.cxx b/connectivity/source/drivers/odbcbase/OResultSet.cxx index e841de41ce59..6f4b6f6aff75 100644 --- a/connectivity/source/drivers/odbcbase/OResultSet.cxx +++ b/connectivity/source/drivers/odbcbase/OResultSet.cxx @@ -398,6 +398,7 @@ sal_Int32 SAL_CALL OResultSet::findColumn( const OUString& columnName ) throw(SQ if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) : columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i))) break; + /* FIXME should throw in case of not found ? or at least return -1 */ return i; } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/postgresql/pq_resultset.cxx b/connectivity/source/drivers/postgresql/pq_resultset.cxx index 8961b5a33f8a..b8e5d393a55b 100644 --- a/connectivity/source/drivers/postgresql/pq_resultset.cxx +++ b/connectivity/source/drivers/postgresql/pq_resultset.cxx @@ -158,10 +158,15 @@ sal_Int32 ResultSet::findColumn( const OUString& columnName ) { MutexGuard guard( m_refMutex->mutex ); checkClosed(); - return PQfnumber( - m_result, - OUStringToOString( columnName, (*m_ppSettings)->encoding ).getStr()) - +1; + sal_Int32 res = PQfnumber( m_result, + OUStringToOString( columnName, (*m_ppSettings)->encoding ).getStr()); + /* PQfnumber reurn -1 for not found, which is waht we want + * otehr than that we use col number as 1-based not 0-based */ + if(res >= 0) + { + res += 1; + } + return res; } static bool isNumber( const char * data, sal_Int32 len ) |