diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-06-03 10:17:13 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-06-03 11:34:19 +0200 |
commit | c1965859c05ccd13859198fe1479167afb4efc7c (patch) | |
tree | a53501190021be0a0a626e8dfdc48cf16143492f /dbaccess | |
parent | 1fc5b6c9bd138d974f1d5fc3546b702bc4fc568c (diff) |
elide some makeStringAndClear() class
when we are passing the result to a string_view, it is pointless.
Change-Id: I4c780bd8dd356bd764b9f88400a41cca6d85f84b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135337
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 | 4 | ||||
-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/ui/dlg/directsql.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/QueryDesignView.cxx | 9 | ||||
-rw-r--r-- | dbaccess/source/ui/uno/copytablewizard.cxx | 2 |
6 files changed, 17 insertions, 16 deletions
diff --git a/dbaccess/source/core/api/CacheSet.cxx b/dbaccess/source/core/api/CacheSet.cxx index 366a727be58d..9774877e6255 100644 --- a/dbaccess/source/core/api/CacheSet.cxx +++ b/dbaccess/source/core/api/CacheSet.cxx @@ -167,7 +167,7 @@ void OCacheSet::insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQ aSql[aSql.getLength() - 1] = ')'; aValues[aValues.getLength() - 1] = ')'; - aSql.append(aValues.makeStringAndClear()); + aSql.append(aValues); // now create end execute the prepared statement { Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql.makeStringAndClear())); @@ -282,7 +282,7 @@ void OCacheSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOri { aCondition.setLength(aCondition.getLength()-5); - aSql.append(" WHERE " + aCondition.makeStringAndClear()); + aSql.append(" WHERE " + aCondition); } else ::dbtools::throwSQLException( diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx index 577088aaad33..338d4d7f87aa 100644 --- a/dbaccess/source/core/api/KeySet.cxx +++ b/dbaccess/source/core/api/KeySet.cxx @@ -512,15 +512,15 @@ 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 + sIndexCondition); } else if(!sKeyCondition.isEmpty()) { - aSql.append(sKeyCondition.makeStringAndClear()); + aSql.append(sKeyCondition); } else if(!sIndexCondition.isEmpty()) { - aSql.append(sIndexCondition.makeStringAndClear()); + aSql.append(sIndexCondition); } aSql.setLength(aSql.getLength()-5); // remove the last AND } @@ -620,7 +620,7 @@ void OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLT aSql[aSql.getLength() - 1] = ')'; aValues[aValues.getLength() - 1] = ')'; - aSql.append(aValues.makeStringAndClear()); + aSql.append(aValues); // now create,fill and execute the prepared statement executeInsert(_rInsertRow,aSql.makeStringAndClear(),u"",bRefetch); } @@ -723,7 +723,7 @@ void OKeySet::executeInsert( const ORowSetRow& _rInsertRow,const OUString& i_sSQ if(!sMaxStmt.isEmpty()) { sMaxStmt[sMaxStmt.getLength()-1] = ' '; - OUString sStmt = "SELECT " + sMaxStmt.makeStringAndClear() + "FROM "; + OUString sStmt = "SELECT " + sMaxStmt + "FROM "; OUString sCatalog,sSchema,sTable; ::dbtools::qualifiedNameComponents(m_xConnection->getMetaData(),m_sUpdateTableName,sCatalog,sSchema,sTable,::dbtools::EComposeRule::InDataManipulation); sStmt += ::dbtools::composeTableNameForSelect( m_xConnection, sCatalog, sSchema, sTable ); @@ -884,7 +884,7 @@ void OKeySet::deleteRow(const ORowSetRow& _rDeleteRow,const connectivity::OSQLTa } } } - aSql.append(sIndexCondition.makeStringAndClear()); + aSql.append(sIndexCondition); aSql.setLength(aSql.getLength()-5); // now create end execute the prepared statement diff --git a/dbaccess/source/core/api/OptimisticSet.cxx b/dbaccess/source/core/api/OptimisticSet.cxx index a95384eed2b7..d1d70955f674 100644 --- a/dbaccess/source/core/api/OptimisticSet.cxx +++ b/dbaccess/source/core/api/OptimisticSet.cxx @@ -544,8 +544,8 @@ void OptimisticSet::fillMissingValues(ORowSetValueVector::Vector& io_aRow) const OUString sCatalog,sSchema,sTable; ::dbtools::qualifiedNameComponents(xMetaData,elem.first,sCatalog,sSchema,sTable,::dbtools::EComposeRule::InDataManipulation); OUString sComposedTableName = ::dbtools::composeTableNameForSelect( m_xConnection, sCatalog, sSchema, sTable ); - OUString sQuery("SELECT " + elem.second + " FROM " + sComposedTableName + " WHERE " + - rCondition.makeStringAndClear()); + OUString sQuery("SELECT " + elem.second + " FROM " + sComposedTableName + " WHERE " + rCondition); + rCondition.setLength(0); try { diff --git a/dbaccess/source/ui/dlg/directsql.cxx b/dbaccess/source/ui/dlg/directsql.cxx index bfc36c44eea1..ba5d9d3be299 100644 --- a/dbaccess/source/ui/dlg/directsql.cxx +++ b/dbaccess/source/ui/dlg/directsql.cxx @@ -328,7 +328,7 @@ namespace dbaui { } // report the output - addOutputText(out.makeStringAndClear()); + addOutputText(out); } } diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index 15a482e91cb2..f5e4288e95d0 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -659,7 +659,7 @@ namespace if ( field->isAggregateFunction() ) { OSL_ENSURE(!field->GetFunction().isEmpty(),"Function name must not be empty! ;-("); - OUStringBuffer aTmpStr2( field->GetFunction() + "(" + aTmpStr.makeStringAndClear() + ")"); + OUStringBuffer aTmpStr2( field->GetFunction() + "(" + aTmpStr + ")"); aTmpStr = aTmpStr2; } @@ -671,7 +671,8 @@ namespace aTmpStr.append(" AS "); aTmpStr.append(::dbtools::quoteName(aQuote, rFieldAlias)); } - aFieldListStr.append(aTmpStr.makeStringAndClear()); + aFieldListStr.append(aTmpStr); + aTmpStr.setLength(0); aFieldListStr.append(", "); } } @@ -2777,7 +2778,7 @@ OUString OQueryDesignView::getStatement() if (!aCriteriaListStr.isEmpty()) { aSqlCmd.append(" WHERE "); - aSqlCmd.append(aCriteriaListStr.makeStringAndClear()); + aSqlCmd.append(aCriteriaListStr); } Reference<XDatabaseMetaData> xMeta; if ( xConnection.is() ) @@ -2791,7 +2792,7 @@ OUString OQueryDesignView::getStatement() if(!aHavingStr.isEmpty()) { aSqlCmd.append(" HAVING "); - aSqlCmd.append(aHavingStr.makeStringAndClear()); + aSqlCmd.append(aHavingStr); } // ----------------- construct sorting and attach ------------ OUString sOrder; diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx index 2645952f4b5e..6196cba6678c 100644 --- a/dbaccess/source/ui/uno/copytablewizard.cxx +++ b/dbaccess/source/ui/uno/copytablewizard.cxx @@ -1441,7 +1441,7 @@ OUString CopyTableWizard::impl_getServerSideCopyStatement_throw(const Reference< } } const OUString sComposedTableName = ::dbtools::composeTableName( xDestMetaData, _xTable, ::dbtools::EComposeRule::InDataManipulation, true ); - OUString sSql("INSERT INTO " + sComposedTableName + " ( " + sColumns.makeStringAndClear() + " ) " + m_pSourceObject->getSelectStatement()); + OUString sSql("INSERT INTO " + sComposedTableName + " ( " + sColumns + " ) " + m_pSourceObject->getSelectStatement()); return sSql; } |