summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-12-28 17:56:40 +0100
committerStephan Bergmann <sbergman@redhat.com>2020-12-29 16:42:33 +0100
commit042033f1e6da22616cb76c8d950c20c9efecbad5 (patch)
tree26b3f1f42d067506f44550b410f3fb9640616a5b /connectivity
parentccfd8e9d09f9ac0a0ea92d0f378391006faaf934 (diff)
loplugin:stringviewparam: operator +
Change-Id: I044dd21b63d7eb03224675584fa143009c6b6008 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108418 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/qa/connectivity/ado/DriverTest.cxx2
-rw-r--r--connectivity/source/commontools/TColumnsHelper.cxx2
-rw-r--r--connectivity/source/commontools/dbtools2.cxx6
-rw-r--r--connectivity/source/drivers/firebird/DatabaseMetaData.cxx6
-rw-r--r--connectivity/source/drivers/firebird/DatabaseMetaData.hxx6
-rw-r--r--connectivity/source/drivers/firebird/Table.cxx2
-rw-r--r--connectivity/source/drivers/firebird/Table.hxx6
-rw-r--r--connectivity/source/drivers/hsqldb/HTable.cxx2
-rw-r--r--connectivity/source/drivers/mysql_jdbc/YTable.cxx2
-rw-r--r--connectivity/source/drivers/postgresql/pq_databasemetadata.cxx8
-rw-r--r--connectivity/source/drivers/postgresql/pq_statement.cxx2
-rw-r--r--connectivity/source/drivers/postgresql/pq_statement.hxx7
-rw-r--r--connectivity/source/drivers/postgresql/pq_tools.cxx4
-rw-r--r--connectivity/source/drivers/postgresql/pq_tools.hxx2
-rw-r--r--connectivity/source/inc/hsqldb/HTable.hxx6
-rw-r--r--connectivity/source/inc/mysql/YTable.hxx6
-rw-r--r--connectivity/source/parse/sqlnode.cxx4
17 files changed, 49 insertions, 24 deletions
diff --git a/connectivity/qa/connectivity/ado/DriverTest.cxx b/connectivity/qa/connectivity/ado/DriverTest.cxx
index f4dd0ebc2791..1be8c04c7fb5 100644
--- a/connectivity/qa/connectivity/ado/DriverTest.cxx
+++ b/connectivity/qa/connectivity/ado/DriverTest.cxx
@@ -62,7 +62,7 @@ void AdoDriverTest::setUp()
CPPUNIT_ASSERT_MESSAGE("no ado component!", m_xAdoComponent.is());
OUString url = "sdbc:ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" +
- m_directories.getPathFromWorkdir("/CppunitTest/TS001018407.mdb");
+ m_directories.getPathFromWorkdir(u"/CppunitTest/TS001018407.mdb");
Sequence< PropertyValue > info;
Reference< XDriver> xDriver(m_xAdoComponent, UNO_QUERY);
diff --git a/connectivity/source/commontools/TColumnsHelper.cxx b/connectivity/source/commontools/TColumnsHelper.cxx
index f06393778953..8671df0b042f 100644
--- a/connectivity/source/commontools/TColumnsHelper.cxx
+++ b/connectivity/source/commontools/TColumnsHelper.cxx
@@ -84,7 +84,7 @@ sdbcx::ObjectType OColumnsHelper::createObject(const OUString& _rName)
if ( aFind == m_pImpl->m_aColumnInfo.end() ) // we have to fill it
{
OUString sComposedName = ::dbtools::composeTableNameForSelect( xConnection, m_pTable );
- collectColumnInformation(xConnection,sComposedName,"*" ,m_pImpl->m_aColumnInfo);
+ collectColumnInformation(xConnection,sComposedName,u"*" ,m_pImpl->m_aColumnInfo);
aFind = m_pImpl->m_aColumnInfo.find(_rName);
}
if ( aFind != m_pImpl->m_aColumnInfo.end() )
diff --git a/connectivity/source/commontools/dbtools2.cxx b/connectivity/source/commontools/dbtools2.cxx
index db6e81a7400a..a57ca9749770 100644
--- a/connectivity/source/commontools/dbtools2.cxx
+++ b/connectivity/source/commontools/dbtools2.cxx
@@ -798,11 +798,11 @@ sal_Int32 getTablePrivileges(const Reference< XDatabaseMetaData>& _xMetaData,
// we need some more information about the column
void collectColumnInformation(const Reference< XConnection>& _xConnection,
- const OUString& _sComposedName,
- const OUString& _rName,
+ std::u16string_view _sComposedName,
+ std::u16string_view _rName,
ColumnInformationMap& _rInfo)
{
- OUString sSelect = "SELECT " + _rName +
+ OUString sSelect = OUString::Concat("SELECT ") + _rName +
" FROM " + _sComposedName +
" WHERE 0 = 1";
diff --git a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
index d06e7cc71985..fdea4e4026eb 100644
--- a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
+++ b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
@@ -1475,7 +1475,7 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getImportedKeys(
return ODatabaseMetaData::lcl_getKeys(true, table);
}
-uno::Reference< XResultSet > ODatabaseMetaData::lcl_getKeys(const bool& bIsImport, const OUString& table )
+uno::Reference< XResultSet > ODatabaseMetaData::lcl_getKeys(const bool& bIsImport, std::u16string_view table )
{
ODatabaseMetaDataResultSet* pResultSet = new
ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eImportedKeys);
@@ -1506,9 +1506,9 @@ uno::Reference< XResultSet > ODatabaseMetaData::lcl_getKeys(const bool& bIsImpor
"ON FOREI.RDB$INDEX_NAME = FOREIGN_INDEX.RDB$INDEX_NAME "
"WHERE FOREI.RDB$CONSTRAINT_TYPE = 'FOREIGN KEY' ";
if (bIsImport)
- sSQL += "AND FOREI.RDB$RELATION_NAME = '"+ table +"'";
+ sSQL += OUString::Concat("AND FOREI.RDB$RELATION_NAME = '")+ table +"'";
else
- sSQL += "AND PRIM.RDB$RELATION_NAME = '"+ table +"'";
+ sSQL += OUString::Concat("AND PRIM.RDB$RELATION_NAME = '")+ table +"'";
uno::Reference< XResultSet > rs = statement->executeQuery(sSQL);
uno::Reference< XRow > xRow( rs, UNO_QUERY_THROW );
diff --git a/connectivity/source/drivers/firebird/DatabaseMetaData.hxx b/connectivity/source/drivers/firebird/DatabaseMetaData.hxx
index ccad90f3925f..fda5bb31bc88 100644
--- a/connectivity/source/drivers/firebird/DatabaseMetaData.hxx
+++ b/connectivity/source/drivers/firebird/DatabaseMetaData.hxx
@@ -20,6 +20,10 @@
#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_DATABASEMETADATA_HXX
#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_DATABASEMETADATA_HXX
+#include <sal/config.h>
+
+#include <string_view>
+
#include "Connection.hxx"
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
@@ -38,7 +42,7 @@ namespace connectivity::firebird
{
::rtl::Reference<Connection> m_pConnection;
private:
- css::uno::Reference< css::sdbc::XResultSet > lcl_getKeys( const bool& bIsImport, const OUString& table );
+ css::uno::Reference< css::sdbc::XResultSet > lcl_getKeys( const bool& bIsImport, std::u16string_view table );
public:
explicit ODatabaseMetaData(Connection* _pCon);
diff --git a/connectivity/source/drivers/firebird/Table.cxx b/connectivity/source/drivers/firebird/Table.cxx
index e0eba9d7e264..02718c78e731 100644
--- a/connectivity/source/drivers/firebird/Table.cxx
+++ b/connectivity/source/drivers/firebird/Table.cxx
@@ -254,7 +254,7 @@ uno::Sequence< Type > SAL_CALL Table::getTypes()
return OTableHelper::getTypes();
}
-OUString Table::getAlterTableColumn(const OUString& rColumn)
+OUString Table::getAlterTableColumn(std::u16string_view rColumn)
{
return ("ALTER TABLE \"" + getName() + "\" ALTER COLUMN \"" + rColumn + "\" ");
}
diff --git a/connectivity/source/drivers/firebird/Table.hxx b/connectivity/source/drivers/firebird/Table.hxx
index 8cf0ff53f90d..d2646dcd168d 100644
--- a/connectivity/source/drivers/firebird/Table.hxx
+++ b/connectivity/source/drivers/firebird/Table.hxx
@@ -10,6 +10,10 @@
#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_TABLE_HXX
#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_TABLE_HXX
+#include <sal/config.h>
+
+#include <string_view>
+
#include "Tables.hxx"
#include <connectivity/TTableHelper.hxx>
@@ -31,7 +35,7 @@ namespace connectivity::firebird
* Get the ALTER TABLE [TABLE] ALTER [COLUMN] String.
* Includes a trailing space.
*/
- OUString getAlterTableColumn(const OUString& rColumn);
+ OUString getAlterTableColumn(std::u16string_view rColumn);
protected:
void construct() override;
diff --git a/connectivity/source/drivers/hsqldb/HTable.cxx b/connectivity/source/drivers/hsqldb/HTable.cxx
index f8dee57c510c..0049ff919fc3 100644
--- a/connectivity/source/drivers/hsqldb/HTable.cxx
+++ b/connectivity/source/drivers/hsqldb/HTable.cxx
@@ -269,7 +269,7 @@ void OHSQLTable::alterColumnType(sal_Int32 nNewType,const OUString& _rColName, c
executeStatement(sSql);
}
-void OHSQLTable::alterDefaultValue(const OUString& _sNewDefault,const OUString& _rColName)
+void OHSQLTable::alterDefaultValue(std::u16string_view _sNewDefault,const OUString& _rColName)
{
const OUString sQuote = getMetaData()->getIdentifierQuoteString( );
OUString sSql = getAlterTableColumnPart() +
diff --git a/connectivity/source/drivers/mysql_jdbc/YTable.cxx b/connectivity/source/drivers/mysql_jdbc/YTable.cxx
index 79da47723258..374825d32abb 100644
--- a/connectivity/source/drivers/mysql_jdbc/YTable.cxx
+++ b/connectivity/source/drivers/mysql_jdbc/YTable.cxx
@@ -281,7 +281,7 @@ void OMySQLTable::alterColumnType(sal_Int32 nNewType, const OUString& _rColName,
OUString OMySQLTable::getTypeCreatePattern() const { return "(M,D)"; }
-void OMySQLTable::alterDefaultValue(const OUString& _sNewDefault, const OUString& _rColName)
+void OMySQLTable::alterDefaultValue(std::u16string_view _sNewDefault, const OUString& _rColName)
{
const OUString sQuote = getMetaData()->getIdentifierQuoteString();
OUString sSql = getAlterTableColumnPart() + " ALTER " + ::dbtools::quoteName(sQuote, _rColName)
diff --git a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
index 22130ed7c6d8..07e0e85815c1 100644
--- a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
+++ b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
@@ -65,6 +65,8 @@
************************************************************************/
#include <algorithm>
+#include <string_view>
+
#include <sal/log.hxx>
#include "pq_databasemetadata.hxx"
#include "pq_driver.hxx"
@@ -2162,12 +2164,12 @@ namespace
return ret;
}
- OUString construct_full_typename(const OUString &ns, const OUString &tn)
+ OUString construct_full_typename(std::u16string_view ns, const OUString &tn)
{
- if(ns.isEmpty() || ns == "pg_catalog")
+ if(ns.empty() || ns == u"pg_catalog")
return tn;
else
- return ns + "." + tn;
+ return OUString::Concat(ns) + "." + tn;
}
void pgTypeInfo2ResultSet(
diff --git a/connectivity/source/drivers/postgresql/pq_statement.cxx b/connectivity/source/drivers/postgresql/pq_statement.cxx
index ff3b05dc8190..946d25b0c91e 100644
--- a/connectivity/source/drivers/postgresql/pq_statement.cxx
+++ b/connectivity/source/drivers/postgresql/pq_statement.cxx
@@ -210,7 +210,7 @@ void Statement::close( )
}
void Statement::raiseSQLException(
- const OUString & sql, const char * errorMsg )
+ std::u16string_view sql, const char * errorMsg )
{
OUString error = "pq_driver: "
+ OUString( errorMsg, strlen(errorMsg), ConnectionSettings::encoding )
diff --git a/connectivity/source/drivers/postgresql/pq_statement.hxx b/connectivity/source/drivers/postgresql/pq_statement.hxx
index 8e93c07b7125..6f9fb3bb1ecc 100644
--- a/connectivity/source/drivers/postgresql/pq_statement.hxx
+++ b/connectivity/source/drivers/postgresql/pq_statement.hxx
@@ -36,6 +36,11 @@
#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_STATEMENT_HXX
#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_STATEMENT_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+
#include <cppuhelper/propshlp.hxx>
#include <cppuhelper/compbase.hxx>
#include <cppuhelper/component.hxx>
@@ -161,7 +166,7 @@ private:
/// @throws css::uno::RuntimeException
void checkClosed();
/// @throws css::sdbc::SQLException
- void raiseSQLException( const OUString & sql, const char * errorMsg );
+ void raiseSQLException( std::u16string_view sql, const char * errorMsg );
};
diff --git a/connectivity/source/drivers/postgresql/pq_tools.cxx b/connectivity/source/drivers/postgresql/pq_tools.cxx
index 543f042f921e..1bb089a5407a 100644
--- a/connectivity/source/drivers/postgresql/pq_tools.cxx
+++ b/connectivity/source/drivers/postgresql/pq_tools.cxx
@@ -87,9 +87,9 @@ using com::sun::star::container::XEnumerationAccess;
namespace pq_sdbc_driver
{
-OUString concatQualified( const OUString & a, const OUString &b)
+OUString concatQualified( std::u16string_view a, std::u16string_view b)
{
- return a + "." + b;
+ return OUString::Concat(a) + "." + b;
}
static OString iOUStringToOString( std::u16string_view str, ConnectionSettings const *settings) {
diff --git a/connectivity/source/drivers/postgresql/pq_tools.hxx b/connectivity/source/drivers/postgresql/pq_tools.hxx
index 18b105870705..6d11e9b40425 100644
--- a/connectivity/source/drivers/postgresql/pq_tools.hxx
+++ b/connectivity/source/drivers/postgresql/pq_tools.hxx
@@ -63,7 +63,7 @@ namespace pq_sdbc_driver
{
bool isWhitespace( sal_Unicode c );
-OUString concatQualified( const OUString & a, const OUString &b);
+OUString concatQualified( std::u16string_view a, std::u16string_view b);
OString OUStringToOString( std::u16string_view str, ConnectionSettings const *settings);
diff --git a/connectivity/source/inc/hsqldb/HTable.hxx b/connectivity/source/inc/hsqldb/HTable.hxx
index 455a048110fa..ff947cbf484c 100644
--- a/connectivity/source/inc/hsqldb/HTable.hxx
+++ b/connectivity/source/inc/hsqldb/HTable.hxx
@@ -20,6 +20,10 @@
#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HTABLE_HXX
#define INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HTABLE_HXX
+#include <sal/config.h>
+
+#include <string_view>
+
#include <connectivity/TTableHelper.hxx>
#include <comphelper/IdPropArrayHelper.hxx>
@@ -102,7 +106,7 @@ namespace connectivity::hsqldb
// some methods to alter table structures
void alterColumnType(sal_Int32 nNewType,const OUString& _rColName,const css::uno::Reference< css::beans::XPropertySet >& _xDescriptor);
- void alterDefaultValue(const OUString& _sNewDefault,const OUString& _rColName);
+ void alterDefaultValue(std::u16string_view _sNewDefault,const OUString& _rColName);
void dropDefaultValue(const OUString& _sNewDefault);
};
diff --git a/connectivity/source/inc/mysql/YTable.hxx b/connectivity/source/inc/mysql/YTable.hxx
index a971a9f9c8f1..7df10ead2af3 100644
--- a/connectivity/source/inc/mysql/YTable.hxx
+++ b/connectivity/source/inc/mysql/YTable.hxx
@@ -20,6 +20,10 @@
#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_MYSQL_YTABLE_HXX
#define INCLUDED_CONNECTIVITY_SOURCE_INC_MYSQL_YTABLE_HXX
+#include <sal/config.h>
+
+#include <string_view>
+
#include <connectivity/TTableHelper.hxx>
#include <comphelper/IdPropArrayHelper.hxx>
@@ -101,7 +105,7 @@ namespace connectivity::mysql
// some methods to alter table structures
void alterColumnType(sal_Int32 nNewType,const OUString& _rColName,const css::uno::Reference< css::beans::XPropertySet >& _xDescriptor);
- void alterDefaultValue(const OUString& _sNewDefault,const OUString& _rColName);
+ void alterDefaultValue(std::u16string_view _sNewDefault,const OUString& _rColName);
void dropDefaultValue(const OUString& _sNewDefault);
virtual OUString getTypeCreatePattern() const override;
diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx
index 544d14e6491a..77c1306d699d 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -55,6 +55,8 @@
#include <algorithm>
#include <functional>
#include <memory>
+#include <string_view>
+
#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
@@ -104,7 +106,7 @@ namespace
@return
The quoted string.
*/
- OUString SetQuotation(const OUString& rValue, const OUString& rQuot, const OUString& rQuotToReplace)
+ OUString SetQuotation(std::u16string_view rValue, const OUString& rQuot, const OUString& rQuotToReplace)
{
OUString rNewValue = rQuot + rValue;
sal_Int32 nIndex = sal_Int32(-1); // Replace quotes with double quotes or the parser gets into problems