diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-28 15:09:33 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-29 09:05:18 +0200 |
commit | 4c91b89d8ce9c34179f31854dc88bd0a9fa84cba (patch) | |
tree | 1fe9cc9db455779d33c24320fedc1e25888b3e5c /dbaccess | |
parent | a1f31211920bfae1a21ea375fa5280c9c6595e15 (diff) |
new loplugin:oustringbuffer
look for places where we are appending the temporary result of adding
strings together, to an OUStringBuffer, where we could rather call
append repeatedly and avoid the temporary creation
Change-Id: I481435124291ac7fb54b91a78344a9fe5b379a82
Reviewed-on: https://gerrit.libreoffice.org/59708
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/qa/unit/embeddeddb_performancetest.cxx | 17 | ||||
-rw-r--r-- | dbaccess/source/core/api/CacheSet.cxx | 6 | ||||
-rw-r--r-- | dbaccess/source/core/api/KeySet.cxx | 10 | ||||
-rw-r--r-- | dbaccess/source/core/api/OptimisticSet.cxx | 4 | ||||
-rw-r--r-- | dbaccess/source/core/api/SingleSelectQueryComposer.cxx | 20 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/ContentHelper.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ext/macromigration/migrationlog.cxx | 8 | ||||
-rw-r--r-- | dbaccess/source/filter/xml/xmlServerDatabase.cxx | 22 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/WCopyTable.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/QueryDesignView.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/uno/copytablewizard.cxx | 2 |
11 files changed, 47 insertions, 48 deletions
diff --git a/dbaccess/qa/unit/embeddeddb_performancetest.cxx b/dbaccess/qa/unit/embeddeddb_performancetest.cxx index 26b77b555fe1..444f283d9630 100644 --- a/dbaccess/qa/unit/embeddeddb_performancetest.cxx +++ b/dbaccess/qa/unit/embeddeddb_performancetest.cxx @@ -137,12 +137,11 @@ void EmbeddedDBPerformanceTest::printTimes( const TimeValue* pTime2, const TimeValue* pTime3) { - m_aOutputBuffer.append( - getPrintableTimeValue(pTime1) + "\t" + - getPrintableTimeValue(pTime2) + "\t" + - getPrintableTimeValue(pTime3) + "\t" - "\n" - ); + m_aOutputBuffer + .append(getPrintableTimeValue(pTime1)).append("\t") + .append(getPrintableTimeValue(pTime2)).append("\t") + .append(getPrintableTimeValue(pTime3)).append("\t") + .append("\n"); } const char EmbeddedDBPerformanceTest::our_sEnableTestEnvVar[] = "DBA_PERFTEST"; @@ -284,7 +283,7 @@ void EmbeddedDBPerformanceTest::performPreparedStatementInsertTest( getTimeDifference(&aStart, &aMiddle, &aTimeInsert); getTimeDifference(&aMiddle, &aEnd, &aTimeCommit); getTimeDifference(&aStart, &aEnd, &aTimeTotal); - m_aOutputBuffer.append("Insert: " + rDBName + "\n"); + m_aOutputBuffer.append("Insert: ").append(rDBName).append("\n"); printTimes(&aTimeInsert, &aTimeCommit, &aTimeTotal); pFile->Close(); @@ -322,7 +321,7 @@ void EmbeddedDBPerformanceTest::performStatementInsertTest( getTimeDifference(&aStart, &aMiddle, &aTimeInsert); getTimeDifference(&aMiddle, &aEnd, &aTimeCommit); getTimeDifference(&aStart, &aEnd, &aTimeTotal); - m_aOutputBuffer.append("Insert: " + rDBName + "\n"); + m_aOutputBuffer.append("Insert: ").append(rDBName).append("\n"); printTimes(&aTimeInsert, &aTimeCommit, &aTimeTotal); pFile->Close(); @@ -353,7 +352,7 @@ void EmbeddedDBPerformanceTest::performReadTest( getTimeDifference(&aStart, &aMiddle, &aTimeSelect); getTimeDifference(&aMiddle, &aEnd, &aTimeIterate); getTimeDifference(&aStart, &aEnd, &aTimeTotal); - m_aOutputBuffer.append("Read from: " + rDBName + "\n"); + m_aOutputBuffer.append("Read from: ").append(rDBName).append("\n"); printTimes(&aTimeSelect, &aTimeIterate, &aTimeTotal); } diff --git a/dbaccess/source/core/api/CacheSet.cxx b/dbaccess/source/core/api/CacheSet.cxx index bf547d6a53c1..fe930722ab68 100644 --- a/dbaccess/source/core/api/CacheSet.cxx +++ b/dbaccess/source/core/api/CacheSet.cxx @@ -163,7 +163,7 @@ void OCacheSet::insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQ connectivity::ORowVector< ORowSetValue > ::Vector::iterator aEnd = _rInsertRow->get().end(); for(; aIter != aEnd;++aIter) { - aSql.append(::dbtools::quoteName( aQuote,m_xSetMetaData->getColumnName(i++)) + ","); + aSql.append(::dbtools::quoteName( aQuote,m_xSetMetaData->getColumnName(i++)) ).append(","); aValues.append("?,"); } @@ -264,7 +264,7 @@ void OCacheSet::fillParameters( const ORowSetRow& _rRow } if(aIter->isModified()) { - _sParameter.append(::dbtools::quoteName( aQuote,aColumnName) + "?,"); + _sParameter.append(::dbtools::quoteName( aQuote,aColumnName) ).append("?,"); } } } @@ -285,7 +285,7 @@ void OCacheSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOri { aCondition.setLength(aCondition.getLength()-5); - aSql.append(" WHERE " + aCondition.makeStringAndClear()); + aSql.append(" WHERE " ).append( aCondition.makeStringAndClear()); } else ::dbtools::throwSQLException( diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx index eb866c82bad2..1cd92ab7835a 100644 --- a/dbaccess/source/core/api/KeySet.cxx +++ b/dbaccess/source/core/api/KeySet.cxx @@ -223,11 +223,11 @@ namespace fullName = tblName + "." + colName; if ( _rValue.isNull() ) { - o_buf.append(fullName + " IS NULL "); + o_buf.append(fullName).append(" IS NULL "); } else { - o_buf.append(fullName + " = ? "); + o_buf.append(fullName).append(" = ? "); } } } @@ -503,7 +503,7 @@ void OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrigi } if((_rInsertRow->get())[columnName.second.nPosition].isModified()) { - aSql.append(::dbtools::quoteName( aQuote,columnName.second.sRealName) + aPara); + aSql.append(::dbtools::quoteName( aQuote,columnName.second.sRealName)).append(aPara); } ++i; } @@ -520,7 +520,7 @@ void OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrigi aSql.append(" WHERE "); if(!sKeyCondition.isEmpty() && !sIndexCondition.isEmpty()) { - aSql.append(sKeyCondition.makeStringAndClear() + sIndexCondition.makeStringAndClear()); + aSql.append(sKeyCondition.makeStringAndClear()).append(sIndexCondition.makeStringAndClear()); } else if(!sKeyCondition.isEmpty()) { @@ -618,7 +618,7 @@ void OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLT { bRefetch = std::find(m_aFilterColumns.begin(),m_aFilterColumns.end(),columnName.second.sRealName) == m_aFilterColumns.end(); } - aSql.append(::dbtools::quoteName( aQuote,columnName.second.sRealName) + ","); + aSql.append(::dbtools::quoteName( aQuote,columnName.second.sRealName)).append(","); aValues.append("?,"); bModified = true; } diff --git a/dbaccess/source/core/api/OptimisticSet.cxx b/dbaccess/source/core/api/OptimisticSet.cxx index 5c2a45017f44..bf272f18471a 100644 --- a/dbaccess/source/core/api/OptimisticSet.cxx +++ b/dbaccess/source/core/api/OptimisticSet.cxx @@ -202,7 +202,7 @@ void OptimisticSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _ OUStringBuffer& rPart = aSql[columnName.second.sTableName]; if ( !rPart.isEmpty() ) rPart.append(", "); - rPart.append(sQuotedColumnName + " = ?"); + rPart.append(sQuotedColumnName).append(" = ?"); } } @@ -225,7 +225,7 @@ void OptimisticSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _ " SET " + elem.second.toString()); OUStringBuffer& rCondition = aKeyConditions[elem.first]; if ( !rCondition.isEmpty() ) - sSql.append(" WHERE " + rCondition.toString() ); + sSql.append(" WHERE ").append( rCondition.toString() ); executeUpdate(_rInsertRow ,_rOriginalRow,sSql.makeStringAndClear(),elem.first); } diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx index 9a8eea35ed10..6d4ba1b0d87c 100644 --- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx +++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx @@ -177,28 +177,28 @@ namespace switch( i_nFilterOperator ) { case SQLFilterOperator::EQUAL: - o_sRet.append(" = " + i_sValue); + o_sRet.append(" = " ).append( i_sValue); break; case SQLFilterOperator::NOT_EQUAL: - o_sRet.append(" <> " + i_sValue); + o_sRet.append(" <> " ).append( i_sValue); break; case SQLFilterOperator::LESS: - o_sRet.append(" < " + i_sValue); + o_sRet.append(" < " ).append( i_sValue); break; case SQLFilterOperator::GREATER: - o_sRet.append(" > " + i_sValue); + o_sRet.append(" > " ).append( i_sValue); break; case SQLFilterOperator::LESS_EQUAL: - o_sRet.append(" <= " + i_sValue); + o_sRet.append(" <= " ).append( i_sValue); break; case SQLFilterOperator::GREATER_EQUAL: - o_sRet.append(" >= " + i_sValue); + o_sRet.append(" >= " ).append( i_sValue); break; case SQLFilterOperator::LIKE: - o_sRet.append(" LIKE " + i_sValue); + o_sRet.append(" LIKE " ).append( i_sValue); break; case SQLFilterOperator::NOT_LIKE: - o_sRet.append(" NOT LIKE " + i_sValue); + o_sRet.append(" NOT LIKE " ).append( i_sValue); break; case SQLFilterOperator::SQLNULL: o_sRet.append(" IS NULL"); @@ -763,7 +763,7 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) OUString sOriginalWhereClause = getSQLPart( Where, m_aSqlIterator, false ); if ( !sOriginalWhereClause.isEmpty() ) { - aSQL.append( " AND ( " + sOriginalWhereClause + " ) " ); + aSQL.append( " AND ( " ).append( sOriginalWhereClause ).append( " ) " ); } OUString sGroupBy = getSQLPart( Group, m_aSqlIterator, true ); @@ -1666,7 +1666,7 @@ void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropert const ::sal_Int64 nLength = xClob->length(); if ( sal_Int64(nLength + aSQL.getLength() + STR_LIKE.getLength() ) < sal_Int64(SAL_MAX_INT32) ) { - aSQL.append("'" + xClob->getSubString(1,static_cast<sal_Int32>(nLength)) + "'"); + aSQL.append("'").append(xClob->getSubString(1,static_cast<sal_Int32>(nLength))).append("'"); } } else diff --git a/dbaccess/source/core/dataaccess/ContentHelper.cxx b/dbaccess/source/core/dataaccess/ContentHelper.cxx index 5f8bb59e0b59..b59e70b63490 100644 --- a/dbaccess/source/core/dataaccess/ContentHelper.cxx +++ b/dbaccess/source/core/dataaccess/ContentHelper.cxx @@ -107,7 +107,7 @@ OUString OContentHelper::impl_getHierarchicalName( bool _includingRootContainer xProp->getPropertyValue( PROPERTY_NAME ) >>= sName; OUString sPrevious = aHierarchicalName.makeStringAndClear(); - aHierarchicalName.append( sName + "/" + sPrevious ); + aHierarchicalName.append( sName ).append( "/" ).append( sPrevious ); } } OUString sHierarchicalName( aHierarchicalName.makeStringAndClear() ); diff --git a/dbaccess/source/ext/macromigration/migrationlog.cxx b/dbaccess/source/ext/macromigration/migrationlog.cxx index 6a0b71b12bfe..13953894bf8b 100644 --- a/dbaccess/source/ext/macromigration/migrationlog.cxx +++ b/dbaccess/source/ext/macromigration/migrationlog.cxx @@ -382,8 +382,8 @@ namespace dbmm OUString sBackedUp( DBA_RES( STR_SAVED_COPY_TO ) ); sBackedUp = sBackedUp.replaceAll( "$location$", m_pData->sBackupLocation ); - aBuffer.append( "=== " + DBA_RES( STR_DATABASE_DOCUMENT ) - + " ===\n" + sBackedUp + "\n\n"); + aBuffer.append( "=== " ).append( DBA_RES( STR_DATABASE_DOCUMENT ) ) + .append( " ===\n" ).append( sBackedUp ).append("\n\n"); } if ( !m_pData->aFailures.empty() ) @@ -405,7 +405,7 @@ namespace dbmm OUString sDocTitle( DBA_RES( rDoc.eType == eForm ? STR_FORM : STR_REPORT ) ); sDocTitle = sDocTitle.replaceAll( "$name$", rDoc.sName ); - aBuffer.append( "=== " + sDocTitle + " ===\n" ); + aBuffer.append( "=== " ).append( sDocTitle ).append( " ===\n" ); for (auto const& elem : rDoc.aMovedLibraries) { @@ -414,7 +414,7 @@ namespace dbmm sMovedLib = sMovedLib.replaceAll( "$old$", elem.sOldName ); sMovedLib = sMovedLib.replaceAll( "$new$", elem.sNewName ); - aBuffer.append( sMovedLib + "\n" ); + aBuffer.append( sMovedLib ).append( "\n" ); } aBuffer.append( '\n' ); diff --git a/dbaccess/source/filter/xml/xmlServerDatabase.cxx b/dbaccess/source/filter/xml/xmlServerDatabase.cxx index 7ce8a7e3ff9a..6eb9ce76ef12 100644 --- a/dbaccess/source/filter/xml/xmlServerDatabase.cxx +++ b/dbaccess/source/filter/xml/xmlServerDatabase.cxx @@ -82,46 +82,46 @@ OXMLServerDatabase::OXMLServerDatabase( ODBFilter& rImport, OUStringBuffer sURL; if ( sType == "sdbc:mysql:jdbc" || sType == "sdbc:mysqlc" || sType == "sdbc:mysql:mysqlc" ) { - sURL.append( sType + ":" + sHostName); + sURL.append( sType ).append( ":" ).append(sHostName); if ( !sPortNumber.isEmpty() ) { - sURL.append(":" + sPortNumber); + sURL.append(":").append(sPortNumber); } if ( !sDatabaseName.isEmpty() ) { - sURL.append("/" + sDatabaseName); + sURL.append("/").append(sDatabaseName); } } else if ( sType == "jdbc:oracle:thin" ) { - sURL.append("jdbc:oracle:thin:@" + sHostName); + sURL.append("jdbc:oracle:thin:@").append(sHostName); if ( !sPortNumber.isEmpty() ) { - sURL.append(":" + sPortNumber); + sURL.append(":").append(sPortNumber); } if ( !sDatabaseName.isEmpty() ) { - sURL.append(":" + sDatabaseName); + sURL.append(":").append(sDatabaseName); } } else if ( sType == "sdbc:address:ldap" ) { - sURL.append("sdbc:address:ldap:" + sHostName); + sURL.append("sdbc:address:ldap:").append(sHostName); if ( !sPortNumber.isEmpty() ) { - sURL.append(":" + sPortNumber); + sURL.append(":").append(sPortNumber); } } else { - sURL.append(sType + ":" + sHostName); + sURL.append(sType).append(":").append(sHostName); if ( !sPortNumber.isEmpty() ) { - sURL.append(":" + sPortNumber); + sURL.append(":").append(sPortNumber); } if ( !sDatabaseName.isEmpty() ) { - sURL.append(":" + sDatabaseName); + sURL.append(":").append(sDatabaseName); } } try diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx index f602ed3abcfc..7c86eced09f2 100644 --- a/dbaccess/source/ui/misc/WCopyTable.cxx +++ b/dbaccess/source/ui/misc/WCopyTable.cxx @@ -238,7 +238,7 @@ OUString ObjectCopySource::getSelectStatement() const aSQL.append( ", " ); } - aSQL.append( "FROM " + ::dbtools::composeTableNameForSelect( m_xConnection, m_xObject ) ); + aSQL.append( "FROM " ).append( ::dbtools::composeTableNameForSelect( m_xConnection, m_xObject ) ); sSelectStatement = aSQL.makeStringAndClear(); } diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index 68ffb367abb7..f977ec528d03 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -2814,7 +2814,7 @@ OUString OQueryDesignView::getStatement() const sal_Int64 nLimit = rController.getLimit(); if( nLimit != -1 ) { - aSqlCmd.append( " LIMIT " + OUString::number(nLimit) ); + aSqlCmd.append( " LIMIT " ).append( OUString::number(nLimit) ); } } diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx index 53685f07f2c1..c129679211bc 100644 --- a/dbaccess/source/ui/uno/copytablewizard.cxx +++ b/dbaccess/source/ui/uno/copytablewizard.cxx @@ -1436,7 +1436,7 @@ OUString CopyTableWizard::impl_getServerSideCopyStatement_throw(const Reference< { if ( !sColumns.isEmpty() ) sColumns.append(","); - sColumns.append(sQuote + aDestColumnNames[rColumnPositionPair.second - 1] + sQuote); + sColumns.append(sQuote).append(aDestColumnNames[rColumnPositionPair.second - 1]).append(sQuote); } } const OUString sComposedTableName = ::dbtools::composeTableName( xDestMetaData, _xTable, ::dbtools::EComposeRule::InDataManipulation, true ); |