diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-28 11:27:41 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-28 17:22:39 +0200 |
commit | fa87224130a4ab6c4b79f993cc990adc4be0465b (patch) | |
tree | 89ef6c5fbae775cfc508d96e20d052fa6bad114a /connectivity | |
parent | e1d7b0973d8318bd7f153350e2e8a38bec3b3e7b (diff) |
loplugin:stringloop basctl,chart2,connectivity
Change-Id: I21353dace60705d55b3d70f1e0bc610d55b84d63
Reviewed-on: https://gerrit.libreoffice.org/58210
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/commontools/TTableHelper.cxx | 3 | ||||
-rw-r--r-- | connectivity/source/commontools/dbtools2.cxx | 10 | ||||
-rw-r--r-- | connectivity/source/drivers/file/FStringFunctions.cxx | 6 | ||||
-rw-r--r-- | connectivity/source/drivers/odbc/OStatement.cxx | 11 |
4 files changed, 15 insertions, 15 deletions
diff --git a/connectivity/source/commontools/TTableHelper.cxx b/connectivity/source/commontools/TTableHelper.cxx index 6c7cd5f5aafc..92447c8e94db 100644 --- a/connectivity/source/commontools/TTableHelper.cxx +++ b/connectivity/source/commontools/TTableHelper.cxx @@ -448,12 +448,11 @@ void OTableHelper::refreshIndexes() if(xResult.is()) { Reference< XRow > xRow(xResult,UNO_QUERY); - OUString aName; OUString sCatalogSep = getMetaData()->getCatalogSeparator(); OUString sPreviousRoundName; while( xResult->next() ) { - aName = xRow->getString(5); + OUString aName = xRow->getString(5); if(!aName.isEmpty()) aName += sCatalogSep; aName += xRow->getString(6); diff --git a/connectivity/source/commontools/dbtools2.cxx b/connectivity/source/commontools/dbtools2.cxx index 5faf1146e67e..cd09553e06df 100644 --- a/connectivity/source/commontools/dbtools2.cxx +++ b/connectivity/source/commontools/dbtools2.cxx @@ -251,20 +251,20 @@ namespace ::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap(); const OUString sQuote(_xMetaData->getIdentifierQuoteString()); - OUString sSql( " (" ); + OUStringBuffer sSql( " (" ); Reference< XPropertySet > xColProp; sal_Int32 nColCount = _xColumns->getCount(); for(sal_Int32 i=0;i<nColCount;++i) { if ( (_xColumns->getByIndex(i) >>= xColProp) && xColProp.is() ) - sSql += ::dbtools::quoteName(sQuote,::comphelper::getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME)))) - + ","; + sSql.append( ::dbtools::quoteName(sQuote,::comphelper::getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME)))) ) + .append(","); } if ( nColCount ) - sSql = sSql.replaceAt(sSql.getLength()-1, 1, ")"); - return sSql; + sSql[sSql.getLength()-1] = ')'; + return sSql.makeStringAndClear(); } } diff --git a/connectivity/source/drivers/file/FStringFunctions.cxx b/connectivity/source/drivers/file/FStringFunctions.cxx index 95119f650ebe..27dbdbfcc695 100644 --- a/connectivity/source/drivers/file/FStringFunctions.cxx +++ b/connectivity/source/drivers/file/FStringFunctions.cxx @@ -191,13 +191,13 @@ ORowSetValue OOp_Repeat::operate(const ORowSetValue& lhs,const ORowSetValue& rhs if ( lhs.isNull() || rhs.isNull() ) return lhs; - OUString sRet; + OUStringBuffer sRet; sal_Int32 nCount = rhs; for (sal_Int32 i=0; i < nCount; ++i) { - sRet += lhs; + sRet.append(lhs.operator OUString()); } - return sRet; + return sRet.makeStringAndClear(); } ORowSetValue OOp_Insert::operate(const std::vector<ORowSetValue>& lhs) const diff --git a/connectivity/source/drivers/odbc/OStatement.cxx b/connectivity/source/drivers/odbc/OStatement.cxx index a26526894080..0ebc71e7dbde 100644 --- a/connectivity/source/drivers/odbc/OStatement.cxx +++ b/connectivity/source/drivers/odbc/OStatement.cxx @@ -33,6 +33,7 @@ #include <cppuhelper/typeprovider.hxx> #include <cppuhelper/queryinterface.hxx> #include <comphelper/types.hxx> +#include <rtl/strbuf.hxx> #include <algorithm> #include <strings.hrc> #include <connectivity/dbexception.hxx> @@ -474,18 +475,18 @@ Sequence< sal_Int32 > SAL_CALL OStatement::executeBatch( ) ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - - OString aBatchSql; + OStringBuffer aBatchSql; sal_Int32 nLen = m_aBatchVector.size(); for (auto const& elem : m_aBatchVector) { - aBatchSql += OUStringToOString(elem,getOwnConnection()->getTextEncoding()); - aBatchSql += ";"; + aBatchSql.append(OUStringToOString(elem,getOwnConnection()->getTextEncoding())); + aBatchSql.append(";"); } OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!"); - THROW_SQL(N3SQLExecDirect(m_aStatementHandle, reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(aBatchSql.getStr())), aBatchSql.getLength())); + auto s = aBatchSql.makeStringAndClear(); + THROW_SQL(N3SQLExecDirect(m_aStatementHandle, reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(s.getStr())), s.getLength())); Sequence< sal_Int32 > aRet(nLen); sal_Int32* pArray = aRet.getArray(); |