diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-04-23 16:07:32 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-04-27 14:07:56 +0200 |
commit | c7c6f0af6c836ebe0968967a1e7c8320b0ac17d6 (patch) | |
tree | 4bc5b2fa623b9765b88bbfe7de10a7590c87d5c8 /dbaccess | |
parent | 99482297c7dd497e41fad2e7193759043e305101 (diff) |
loplugin:stringadd convert chained append to +
which can use the more efficient *StringConcat
Also fix a crash in stringview plugin which
started happening while I working on this.
Change-Id: I91a5b9b7707d1594d27d80b73930f5afac8ae608
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114568
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/core/api/CacheSet.cxx | 6 | ||||
-rw-r--r-- | dbaccess/source/core/api/KeySet.cxx | 12 | ||||
-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/filter/xml/xmlServerDatabase.cxx | 22 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/directsql.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/tablespage.cxx | 4 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/WCopyTable.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/uno/copytablewizard.cxx | 2 |
10 files changed, 38 insertions, 38 deletions
diff --git a/dbaccess/source/core/api/CacheSet.cxx b/dbaccess/source/core/api/CacheSet.cxx index e6f31962834f..366a727be58d 100644 --- a/dbaccess/source/core/api/CacheSet.cxx +++ b/dbaccess/source/core/api/CacheSet.cxx @@ -160,7 +160,7 @@ void OCacheSet::insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQ connectivity::ORowVector< ORowSetValue > ::Vector::iterator aEnd = _rInsertRow->end(); for(; aIter != aEnd;++aIter) { - aSql.append(::dbtools::quoteName( aQuote,m_xSetMetaData->getColumnName(i++)) ).append(","); + aSql.append(::dbtools::quoteName( aQuote,m_xSetMetaData->getColumnName(i++)) + ","); aValues.append("?,"); } @@ -261,7 +261,7 @@ void OCacheSet::fillParameters( const ORowSetRow& _rRow } if(aIter->isModified()) { - _sParameter.append(::dbtools::quoteName( aQuote,aColumnName) ).append("?,"); + _sParameter.append(::dbtools::quoteName( aQuote,aColumnName) + "?,"); } } } @@ -282,7 +282,7 @@ void OCacheSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOri { aCondition.setLength(aCondition.getLength()-5); - aSql.append(" WHERE " ).append( aCondition.makeStringAndClear()); + aSql.append(" WHERE " + aCondition.makeStringAndClear()); } else ::dbtools::throwSQLException( diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx index e61259bf61b1..8999ded1e3c7 100644 --- a/dbaccess/source/core/api/KeySet.cxx +++ b/dbaccess/source/core/api/KeySet.cxx @@ -220,11 +220,11 @@ namespace fullName = OUString::Concat(tblName) + "." + colName; if ( _rValue.isNull() ) { - o_buf.append(fullName).append(" IS NULL "); + o_buf.append(fullName + " IS NULL "); } else { - o_buf.append(fullName).append(" = ? "); + o_buf.append(fullName + " = ? "); } } } @@ -496,7 +496,7 @@ void OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrigi } if((*_rInsertRow)[columnName.second.nPosition].isModified()) { - aSql.append(::dbtools::quoteName( aQuote,columnName.second.sRealName)).append(aPara); + aSql.append(::dbtools::quoteName( aQuote,columnName.second.sRealName) + aPara); } ++i; } @@ -513,7 +513,7 @@ void OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrigi aSql.append(" WHERE "); if(!sKeyCondition.isEmpty() && !sIndexCondition.isEmpty()) { - aSql.append(sKeyCondition.makeStringAndClear()).append(sIndexCondition.makeStringAndClear()); + aSql.append(sKeyCondition.makeStringAndClear() + sIndexCondition.makeStringAndClear()); } else if(!sKeyCondition.isEmpty()) { @@ -611,7 +611,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)).append(","); + aSql.append(::dbtools::quoteName( aQuote,columnName.second.sRealName) + ","); aValues.append("?,"); bModified = true; } @@ -717,7 +717,7 @@ void OKeySet::executeInsert( const ORowSetRow& _rInsertRow,const OUString& i_sSQ SelectColumnsMetaData::const_iterator aFind = m_pKeyColumnNames->find(autoColumn); if ( aFind != aEnd ) { - sMaxStmt.append(" MAX(").append(::dbtools::quoteName( sQuote,aFind->second.sRealName)).append("),"); + sMaxStmt.append(" MAX(" + ::dbtools::quoteName( sQuote,aFind->second.sRealName) + "),"); } } diff --git a/dbaccess/source/core/api/OptimisticSet.cxx b/dbaccess/source/core/api/OptimisticSet.cxx index 4cec7ed6839b..c214402f50c5 100644 --- a/dbaccess/source/core/api/OptimisticSet.cxx +++ b/dbaccess/source/core/api/OptimisticSet.cxx @@ -188,7 +188,7 @@ void OptimisticSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _ OUStringBuffer& rPart = aSql[columnName.second.sTableName]; if ( !rPart.isEmpty() ) rPart.append(", "); - rPart.append(sQuotedColumnName).append(" = ?"); + rPart.append(sQuotedColumnName + " = ?"); } } @@ -211,7 +211,7 @@ void OptimisticSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _ " SET " + elem.second.toString()); OUStringBuffer& rCondition = aKeyConditions[elem.first]; if ( !rCondition.isEmpty() ) - sSql.append(" WHERE ").append( rCondition ); + sSql.append(" WHERE " + rCondition ); executeUpdate(_rInsertRow ,_rOriginalRow,sSql.makeStringAndClear(),elem.first); } diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx index 879342932cc0..2284f1db3e3f 100644 --- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx +++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx @@ -174,28 +174,28 @@ namespace switch( i_nFilterOperator ) { case SQLFilterOperator::EQUAL: - o_sRet.append(" = " ).append( i_sValue); + o_sRet.append(OUString::Concat(" = ") + i_sValue); break; case SQLFilterOperator::NOT_EQUAL: - o_sRet.append(" <> " ).append( i_sValue); + o_sRet.append(OUString::Concat(" <> ") + i_sValue); break; case SQLFilterOperator::LESS: - o_sRet.append(" < " ).append( i_sValue); + o_sRet.append(OUString::Concat(" < ") + i_sValue); break; case SQLFilterOperator::GREATER: - o_sRet.append(" > " ).append( i_sValue); + o_sRet.append(OUString::Concat(" > ") + i_sValue); break; case SQLFilterOperator::LESS_EQUAL: - o_sRet.append(" <= " ).append( i_sValue); + o_sRet.append(OUString::Concat(" <= ") + i_sValue); break; case SQLFilterOperator::GREATER_EQUAL: - o_sRet.append(" >= " ).append( i_sValue); + o_sRet.append(OUString::Concat(" >= ") + i_sValue); break; case SQLFilterOperator::LIKE: - o_sRet.append(" LIKE " ).append( i_sValue); + o_sRet.append(OUString::Concat(" LIKE ") + i_sValue); break; case SQLFilterOperator::NOT_LIKE: - o_sRet.append(" NOT LIKE " ).append( i_sValue); + o_sRet.append(OUString::Concat(" NOT LIKE ") + i_sValue); break; case SQLFilterOperator::SQLNULL: o_sRet.append(" IS NULL"); @@ -759,7 +759,7 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) OUString sOriginalWhereClause = getSQLPart( Where, m_aSqlIterator, false ); if ( !sOriginalWhereClause.isEmpty() ) { - aSQL.append( " AND ( " ).append( sOriginalWhereClause ).append( " ) " ); + aSQL.append( " AND ( " + sOriginalWhereClause + " ) " ); } OUString sGroupBy = getSQLPart( Group, m_aSqlIterator, true ); @@ -1665,7 +1665,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("'").append(xClob->getSubString(1,static_cast<sal_Int32>(nLength))).append("'"); + aSQL.append("'" + xClob->getSubString(1,static_cast<sal_Int32>(nLength)) + "'"); } } else diff --git a/dbaccess/source/core/dataaccess/ContentHelper.cxx b/dbaccess/source/core/dataaccess/ContentHelper.cxx index e237d8ea3b88..94cb7168d037 100644 --- a/dbaccess/source/core/dataaccess/ContentHelper.cxx +++ b/dbaccess/source/core/dataaccess/ContentHelper.cxx @@ -123,7 +123,7 @@ OUString OContentHelper::impl_getHierarchicalName( bool _includingRootContainer xProp->getPropertyValue( PROPERTY_NAME ) >>= sName; OUString sPrevious = aHierarchicalName.makeStringAndClear(); - aHierarchicalName.append( sName ).append( "/" ).append( sPrevious ); + aHierarchicalName.append( sName + "/" + sPrevious ); } } OUString sHierarchicalName( aHierarchicalName.makeStringAndClear() ); diff --git a/dbaccess/source/filter/xml/xmlServerDatabase.cxx b/dbaccess/source/filter/xml/xmlServerDatabase.cxx index 590db077437b..654a9f403402 100644 --- a/dbaccess/source/filter/xml/xmlServerDatabase.cxx +++ b/dbaccess/source/filter/xml/xmlServerDatabase.cxx @@ -74,46 +74,46 @@ OXMLServerDatabase::OXMLServerDatabase( ODBFilter& rImport, OUStringBuffer sURL; if ( sType == "sdbc:mysql:jdbc" || sType == "sdbc:mysqlc" || sType == "sdbc:mysql:mysqlc" ) { - sURL.append( sType ).append( ":" ).append(sHostName); + sURL.append( sType + ":" + sHostName); if ( !sPortNumber.isEmpty() ) { - sURL.append(":").append(sPortNumber); + sURL.append(":" + sPortNumber); } if ( !sDatabaseName.isEmpty() ) { - sURL.append("/").append(sDatabaseName); + sURL.append("/" + sDatabaseName); } } else if ( sType == "jdbc:oracle:thin" ) { - sURL.append("jdbc:oracle:thin:@").append(sHostName); + sURL.append("jdbc:oracle:thin:@" + sHostName); if ( !sPortNumber.isEmpty() ) { - sURL.append(":").append(sPortNumber); + sURL.append(":" + sPortNumber); } if ( !sDatabaseName.isEmpty() ) { - sURL.append(":").append(sDatabaseName); + sURL.append(":" + sDatabaseName); } } else if ( sType == "sdbc:address:ldap" ) { - sURL.append("sdbc:address:ldap:").append(sHostName); + sURL.append("sdbc:address:ldap:" + sHostName); if ( !sPortNumber.isEmpty() ) { - sURL.append(":").append(sPortNumber); + sURL.append(":" + sPortNumber); } } else { - sURL.append(sType).append(":").append(sHostName); + sURL.append(sType + ":" + sHostName); if ( !sPortNumber.isEmpty() ) { - sURL.append(":").append(sPortNumber); + sURL.append(":" + sPortNumber); } if ( !sDatabaseName.isEmpty() ) { - sURL.append(":").append(sDatabaseName); + sURL.append(":" + sDatabaseName); } } try diff --git a/dbaccess/source/ui/dlg/directsql.cxx b/dbaccess/source/ui/dlg/directsql.cxx index fc8191707c44..ac3425999cf9 100644 --- a/dbaccess/source/ui/dlg/directsql.cxx +++ b/dbaccess/source/ui/dlg/directsql.cxx @@ -258,7 +258,7 @@ namespace dbaui for (;;) { // be dumb, treat everything as a string - out.append(xRow->getString(i)).append(","); + out.append(xRow->getString(i) + ","); i++; } } diff --git a/dbaccess/source/ui/dlg/tablespage.cxx b/dbaccess/source/ui/dlg/tablespage.cxx index 8162126a3749..91456123ec58 100644 --- a/dbaccess/source/ui/dlg/tablespage.cxx +++ b/dbaccess/source/ui/dlg/tablespage.cxx @@ -381,7 +381,7 @@ namespace dbaui bCatalogWildcard = m_xTablesList->isWildcardChecked(*xCatalog); if (m_bCatalogAtStart) { - sComposedName.append(m_xTablesList->GetWidget().get_text(*xCatalog)).append(m_sCatalogSeparator); + sComposedName.append(m_xTablesList->GetWidget().get_text(*xCatalog) + m_sCatalogSeparator); if (bCatalogWildcard) sComposedName.append(sWildcard); } @@ -396,7 +396,7 @@ namespace dbaui } } bSchemaWildcard = m_xTablesList->isWildcardChecked(*xSchema); - sComposedName.append(m_xTablesList->GetWidget().get_text(*xSchema)).append("."); + sComposedName.append(m_xTablesList->GetWidget().get_text(*xSchema) + "."); } if (bSchemaWildcard) diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx index 4420b83bf428..05d6181ca881 100644 --- a/dbaccess/source/ui/misc/WCopyTable.cxx +++ b/dbaccess/source/ui/misc/WCopyTable.cxx @@ -230,7 +230,7 @@ OUString ObjectCopySource::getSelectStatement() const aSQL.append( ", " ); } - aSQL.append( "FROM " ).append( ::dbtools::composeTableNameForSelect( m_xConnection, m_xObject ) ); + aSQL.append( "FROM " + ::dbtools::composeTableNameForSelect( m_xConnection, m_xObject ) ); sSelectStatement = aSQL.makeStringAndClear(); } diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx index 50fa22f6dad4..12e3575dbafd 100644 --- a/dbaccess/source/ui/uno/copytablewizard.cxx +++ b/dbaccess/source/ui/uno/copytablewizard.cxx @@ -1448,7 +1448,7 @@ OUString CopyTableWizard::impl_getServerSideCopyStatement_throw(const Reference< { if ( !sColumns.isEmpty() ) sColumns.append(","); - sColumns.append(sQuote).append(aDestColumnNames[rColumnPositionPair.second - 1]).append(sQuote); + sColumns.append(sQuote + aDestColumnNames[rColumnPositionPair.second - 1] + sQuote); } } const OUString sComposedTableName = ::dbtools::composeTableName( xDestMetaData, _xTable, ::dbtools::EComposeRule::InDataManipulation, true ); |