diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-03-24 19:08:40 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-03-25 06:21:25 +0000 |
commit | d638a512ac19fa68f7760ff110469337f061f481 (patch) | |
tree | a5f9d74252f31be1a90b3bcbd346ea58dea217cb /dbaccess | |
parent | 4ca4282517d02592966576fc642048b3d5ae5532 (diff) |
loplugin:stringadd in d*
after my patch to merge the bufferadd loplugin into stringadd
Change-Id: I625a0adf89f54ea25f0377a266c37acf9a37d723
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149550
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/filter/hsqldb/fbalterparser.cxx | 6 | ||||
-rw-r--r-- | dbaccess/source/filter/hsqldb/fbcreateparser.cxx | 6 | ||||
-rw-r--r-- | dbaccess/source/filter/hsqldb/hsqlimport.cxx | 8 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/DExport.cxx | 3 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/WCopyTable.cxx | 3 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx | 3 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/defaultobjectnamecheck.cxx | 3 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/QueryDesignView.cxx | 24 |
8 files changed, 20 insertions, 36 deletions
diff --git a/dbaccess/source/filter/hsqldb/fbalterparser.cxx b/dbaccess/source/filter/hsqldb/fbalterparser.cxx index 024598c0b319..a8948069e4e6 100644 --- a/dbaccess/source/filter/hsqldb/fbalterparser.cxx +++ b/dbaccess/source/filter/hsqldb/fbalterparser.cxx @@ -32,15 +32,13 @@ OUString FbAlterStmtParser::compose() const } else if (getActionType() == AlterAction::ADD_FOREIGN) return getStatement(); // do nothing with that - OUStringBuffer sSql("ALTER TABLE "); - sSql.append(getTableName()); + OUStringBuffer sSql("ALTER TABLE " + getTableName()); if (getActionType() == AlterAction::IDENTITY_RESTART) { sSql.append(" ALTER COLUMN "); } - sSql.append(getColumnName()); - sSql.append(" RESTART WITH "); + sSql.append(getColumnName() + " RESTART WITH "); // Firebird: restart with 0 means the first number is 1, not 0. sSql.append(getIdentityParam() - 1); diff --git a/dbaccess/source/filter/hsqldb/fbcreateparser.cxx b/dbaccess/source/filter/hsqldb/fbcreateparser.cxx index f3399474c272..1740998c62d2 100644 --- a/dbaccess/source/filter/hsqldb/fbcreateparser.cxx +++ b/dbaccess/source/filter/hsqldb/fbcreateparser.cxx @@ -135,8 +135,7 @@ OUString FbCreateStmtParser::compose() const { ensureProperTableLengths(); OUStringBuffer sSql(128); - sSql.append("CREATE TABLE "); - sSql.append(getTableName()); + sSql.append("CREATE TABLE " + getTableName()); lcl_appendWithSpace(sSql, u"("); // column declaration auto& rColumns = getColumnDef(); @@ -183,8 +182,7 @@ OUString FbCreateStmtParser::compose() const // start with 0: // HSQLDB: first value will be 0. // Firebird: first value will be 1. - sSql.append(columnIter->getStartValue() - 1); - sSql.append(")"); + sSql.append(OUString::number(columnIter->getStartValue() - 1) + ")"); } else if (!columnIter->isNullable()) lcl_appendWithSpace(sSql, u"NOT NULL"); diff --git a/dbaccess/source/filter/hsqldb/hsqlimport.cxx b/dbaccess/source/filter/hsqldb/hsqlimport.cxx index 045a32f93ce3..af9b637cb862 100644 --- a/dbaccess/source/filter/hsqldb/hsqlimport.cxx +++ b/dbaccess/source/filter/hsqldb/hsqlimport.cxx @@ -180,9 +180,7 @@ OUString lcl_createInsertStatement(std::u16string_view sTableName, const std::vector<dbahsql::ColumnDefinition>& rColTypes) { assert(rColTypes.size() > 0); - OUStringBuffer sql("INSERT INTO "); - sql.append(sTableName); - sql.append(" ("); + OUStringBuffer sql(OUString::Concat("INSERT INTO ") + sTableName + " ("); // column names for (size_t i = 0; i < rColTypes.size(); ++i) @@ -191,9 +189,7 @@ OUString lcl_createInsertStatement(std::u16string_view sTableName, if (i < rColTypes.size() - 1) sql.append(", "); } - sql.append(")"); - - sql.append(" VALUES ("); + sql.append(") VALUES ("); for (size_t i = 0; i < rColTypes.size(); ++i) { sql.append("?"); diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx index d45b791af1af..fdc6bc4b3d26 100644 --- a/dbaccess/source/ui/misc/DExport.cxx +++ b/dbaccess/source/ui/misc/DExport.cxx @@ -823,8 +823,7 @@ Reference< XPreparedStatement > ODatabaseExport::createPreparedStatement( const { if ( !elem.isEmpty() ) { - aSql.append(elem); - aSql.append(","); + aSql.append(elem + ","); aValues.append("?,"); } } diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx index c5db4b2fd956..4d8e73141a5c 100644 --- a/dbaccess/source/ui/misc/WCopyTable.cxx +++ b/dbaccess/source/ui/misc/WCopyTable.cxx @@ -213,8 +213,7 @@ OUString ObjectCopySource::getSelectStatement() const } else { // table - OUStringBuffer aSQL; - aSQL.append( "SELECT " ); + OUStringBuffer aSQL( "SELECT " ); // we need to create the sql stmt with column names // otherwise it is possible that names don't match diff --git a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx index d4b039ce66ef..12a73c78877f 100644 --- a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx +++ b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx @@ -535,8 +535,7 @@ namespace dbaui Reference< XTitle > xTitle(getPrivateModel(),UNO_QUERY); if ( xTitle.is() ) { - sTitle.append( xTitle->getTitle() ); - sTitle.append(" : "); + sTitle.append( xTitle->getTitle() + " : "); } sTitle.append( getPrivateTitle() ); return sTitle.makeStringAndClear(); diff --git a/dbaccess/source/ui/misc/defaultobjectnamecheck.cxx b/dbaccess/source/ui/misc/defaultobjectnamecheck.cxx index d2a158d2b76e..736d9378ae9b 100644 --- a/dbaccess/source/ui/misc/defaultobjectnamecheck.cxx +++ b/dbaccess/source/ui/misc/defaultobjectnamecheck.cxx @@ -88,8 +88,7 @@ namespace dbaui OUStringBuffer aCompleteName; if ( !msRelativeRoot.isEmpty() ) { - aCompleteName.append( msRelativeRoot ); - aCompleteName.append( "/" ); + aCompleteName.append( msRelativeRoot + "/" ); } aCompleteName.append( _rObjectName ); diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index c081012ddf2a..1c23e936b016 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -291,11 +291,12 @@ namespace { if(!aCondition.isEmpty()) aCondition.append(C_AND); - aCondition.append(quoteTableAlias(true,pData->GetAliasName(JTCS_FROM),aQuote)); - aCondition.append(::dbtools::quoteName(aQuote, lineData->GetFieldName(JTCS_FROM) )); - aCondition.append(" = "); - aCondition.append(quoteTableAlias(true,pData->GetAliasName(JTCS_TO),aQuote)); - aCondition.append(::dbtools::quoteName(aQuote, lineData->GetFieldName(JTCS_TO) )); + aCondition.append( + quoteTableAlias(true,pData->GetAliasName(JTCS_FROM),aQuote) + + ::dbtools::quoteName(aQuote, lineData->GetFieldName(JTCS_FROM) ) + + " = " + + quoteTableAlias(true,pData->GetAliasName(JTCS_TO),aQuote) + + ::dbtools::quoteName(aQuote, lineData->GetFieldName(JTCS_TO) )); } } catch(SQLException&) @@ -668,8 +669,7 @@ namespace field->isNumericOrAggregateFunction() || field->isOtherFunction())) { - aTmpStr.append(" AS "); - aTmpStr.append(::dbtools::quoteName(aQuote, rFieldAlias)); + aTmpStr.append(" AS " + ::dbtools::quoteName(aQuote, rFieldAlias)); } aFieldListStr.append(aTmpStr); aTmpStr.setLength(0); @@ -2771,14 +2771,11 @@ OUString OQueryDesignView::getStatement() OUStringBuffer aSqlCmd("SELECT "); if(rController.isDistinct()) aSqlCmd.append(" DISTINCT "); - aSqlCmd.append(aFieldListStr); - aSqlCmd.append(" FROM "); - aSqlCmd.append(aTableListStr); + aSqlCmd.append(aFieldListStr + " FROM " + aTableListStr); if (!aCriteriaListStr.isEmpty()) { - aSqlCmd.append(" WHERE "); - aSqlCmd.append(aCriteriaListStr); + aSqlCmd.append(" WHERE " + aCriteriaListStr); } Reference<XDatabaseMetaData> xMeta; if ( xConnection.is() ) @@ -2791,8 +2788,7 @@ OUString OQueryDesignView::getStatement() // ----------------- construct GroupBy and attach ------------ if(!aHavingStr.isEmpty()) { - aSqlCmd.append(" HAVING "); - aSqlCmd.append(aHavingStr); + aSqlCmd.append(" HAVING " + aHavingStr); } // ----------------- construct sorting and attach ------------ OUString sOrder; |