diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-04-29 12:24:31 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-04-29 18:25:31 +0200 |
commit | 04aafba860f613c20e7078d038cc83eb02de0b54 (patch) | |
tree | 8153152b87089419bde17313d9ac7b9de6fcce32 /connectivity | |
parent | 76c793d2acf66f46e9edcda43d2f4327e8374841 (diff) |
loplugin:stringadd simplify some *StringBuffer operations
pulled from a larger patch which I created with a more permissive
variant of this plugin
Change-Id: I7abf1f3f09e84703b6e0e52fe9587dff691b2187
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114875
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/commontools/dbconversion.cxx | 5 | ||||
-rw-r--r-- | connectivity/source/drivers/hsqldb/HView.cxx | 11 | ||||
-rw-r--r-- | connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.cxx | 6 |
3 files changed, 9 insertions, 13 deletions
diff --git a/connectivity/source/commontools/dbconversion.cxx b/connectivity/source/commontools/dbconversion.cxx index dbe942a3fd01..13a799e55a9a 100644 --- a/connectivity/source/commontools/dbconversion.cxx +++ b/connectivity/source/commontools/dbconversion.cxx @@ -109,12 +109,9 @@ namespace dbtools OUString DBTypeConversion::toDateTimeString(const css::util::DateTime& _rDateTime) { css::util::Date aDate(_rDateTime.Day,_rDateTime.Month,_rDateTime.Year); - OUStringBuffer aTemp(toDateString(aDate)); - aTemp.append(" "); css::util::Time const aTime(_rDateTime.NanoSeconds, _rDateTime.Seconds, _rDateTime.Minutes, _rDateTime.Hours, _rDateTime.IsUTC); - aTemp.append( toTimeString(aTime) ); - return aTemp.makeStringAndClear(); + return toDateString(aDate) + " " + toTimeString(aTime); } css::util::Date DBTypeConversion::toDate(const sal_Int32 _nVal) diff --git a/connectivity/source/drivers/hsqldb/HView.cxx b/connectivity/source/drivers/hsqldb/HView.cxx index 0a09ec0d201b..29e5a4000a51 100644 --- a/connectivity/source/drivers/hsqldb/HView.cxx +++ b/connectivity/source/drivers/hsqldb/HView.cxx @@ -90,12 +90,11 @@ namespace connectivity::hsqldb // create a statement which can be used to re-create the original view, in case // dropping it succeeds, but creating it with a new statement fails - OUStringBuffer aRestoreCommand; - aRestoreCommand.append( "CREATE VIEW " ); - aRestoreCommand.append ( sQualifiedName ); - aRestoreCommand.append( " AS " ); - aRestoreCommand.append ( impl_getCommand_throwSQLException() ); - OUString sRestoreCommand( aRestoreCommand.makeStringAndClear() ); + OUString sRestoreCommand = + "CREATE VIEW " + + sQualifiedName + + " AS " + + impl_getCommand_throwSQLException(); bool bDropSucceeded( false ); try diff --git a/connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.cxx b/connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.cxx index 124a606a8f9e..3d0ac9ce8411 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.cxx @@ -80,11 +80,11 @@ sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive(sal_Int32 column) { // MYSQL_FIELD::charsetnr is the collation identifier // _ci postfix means it's insensitive - OUStringBuffer sql{ "SHOW COLLATION WHERE Id =" }; - sql.append(static_cast<sal_Int32>(m_fields.at(column - 1).charsetNumber)); + OUString sql + = "SHOW COLLATION WHERE Id =" + OUString::number(m_fields.at(column - 1).charsetNumber); Reference<XStatement> stmt = m_rConnection.createStatement(); - Reference<XResultSet> rs = stmt->executeQuery(sql.makeStringAndClear()); + Reference<XResultSet> rs = stmt->executeQuery(sql); Reference<XRow> xRow(rs, UNO_QUERY_THROW); if (!rs->next()) // fetch first and only row |