summaryrefslogtreecommitdiff
path: root/connectivity/source/commontools
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-11-12 08:13:40 +0100
committerStephan Bergmann <sbergman@redhat.com>2020-11-12 16:53:30 +0100
commitf34ac579fac16fff37bf00fe85d43ad6b938eca7 (patch)
tree0747c4d86bbf40a5093fb7a3215dd52a8e8586b2 /connectivity/source/commontools
parentc45753847dfc2b4645dc2f7500a18ec2c5d438df (diff)
New loplugin:stringviewparam
...to "Find functions that take rtl::O[U]String parameters that can be generalized to take std::[u16]string_view instead." (Which in turn can avoid costly O[U]String constructions, see e.g. loplugin:stringview and subView.) Some of those functions' call sites, passing plain char string literals, needed to be adapted when converting them. Change-Id: I644ab546d7a0ce9e470ab9b3196e3e60d1e812bc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105622 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'connectivity/source/commontools')
-rw-r--r--connectivity/source/commontools/dbtools2.cxx10
-rw-r--r--connectivity/source/commontools/predicateinput.cxx9
2 files changed, 10 insertions, 9 deletions
diff --git a/connectivity/source/commontools/dbtools2.cxx b/connectivity/source/commontools/dbtools2.cxx
index a9e0caff2eeb..b2626dd6fbe6 100644
--- a/connectivity/source/commontools/dbtools2.cxx
+++ b/connectivity/source/commontools/dbtools2.cxx
@@ -64,7 +64,7 @@ namespace dbtools
using namespace connectivity;
using namespace comphelper;
-OUString createStandardTypePart(const Reference< XPropertySet >& xColProp,const Reference< XConnection>& _xConnection,const OUString& _sCreatePattern)
+OUString createStandardTypePart(const Reference< XPropertySet >& xColProp,const Reference< XConnection>& _xConnection,std::u16string_view _sCreatePattern)
{
Reference<XDatabaseMetaData> xMetaData = _xConnection->getMetaData();
@@ -141,10 +141,10 @@ OUString createStandardTypePart(const Reference< XPropertySet >& xColProp,const
if ( nPrecision > 0 && nDataType != DataType::TIMESTAMP )
{
aSql.append(nPrecision);
- if ( (nScale > 0) || (!_sCreatePattern.isEmpty() && sCreateParams.indexOf(_sCreatePattern) != -1) )
+ if ( (nScale > 0) || (!_sCreatePattern.empty() && sCreateParams.indexOf(_sCreatePattern) != -1) )
aSql.append(",");
}
- if ( (nScale > 0) || ( !_sCreatePattern.isEmpty() && sCreateParams.indexOf(_sCreatePattern) != -1 ) || nDataType == DataType::TIMESTAMP )
+ if ( (nScale > 0) || ( !_sCreatePattern.empty() && sCreateParams.indexOf(_sCreatePattern) != -1 ) || nDataType == DataType::TIMESTAMP )
aSql.append(nScale);
if ( nParenPos == -1 )
@@ -170,7 +170,7 @@ OUString createStandardTypePart(const Reference< XPropertySet >& xColProp,const
return aSql.makeStringAndClear();
}
-OUString createStandardColumnPart(const Reference< XPropertySet >& xColProp,const Reference< XConnection>& _xConnection,ISQLStatementHelper* _pHelper,const OUString& _sCreatePattern)
+OUString createStandardColumnPart(const Reference< XPropertySet >& xColProp,const Reference< XConnection>& _xConnection,ISQLStatementHelper* _pHelper,std::u16string_view _sCreatePattern)
{
Reference<XDatabaseMetaData> xMetaData = _xConnection->getMetaData();
@@ -208,7 +208,7 @@ OUString createStandardColumnPart(const Reference< XPropertySet >& xColProp,cons
}
-OUString createStandardCreateStatement(const Reference< XPropertySet >& descriptor,const Reference< XConnection>& _xConnection,ISQLStatementHelper* _pHelper,const OUString& _sCreatePattern)
+OUString createStandardCreateStatement(const Reference< XPropertySet >& descriptor,const Reference< XConnection>& _xConnection,ISQLStatementHelper* _pHelper,std::u16string_view _sCreatePattern)
{
OUStringBuffer aSql("CREATE TABLE ");
OUString sCatalog,sSchema,sTable,sComposedName;
diff --git a/connectivity/source/commontools/predicateinput.cxx b/connectivity/source/commontools/predicateinput.cxx
index 0b229aa9ec5a..8ab37a3f76f3 100644
--- a/connectivity/source/commontools/predicateinput.cxx
+++ b/connectivity/source/commontools/predicateinput.cxx
@@ -33,7 +33,7 @@
#include <tools/diagnose_ex.h>
#include <memory>
-
+#include <string_view>
namespace dbtools
{
@@ -59,12 +59,13 @@ namespace dbtools
using ::connectivity::OSQLParseNode;
- static sal_Unicode lcl_getSeparatorChar( const OUString& _rSeparator, sal_Unicode _nFallback )
+ static sal_Unicode lcl_getSeparatorChar(
+ std::u16string_view _rSeparator, sal_Unicode _nFallback )
{
- OSL_ENSURE( !_rSeparator.isEmpty(), "::lcl_getSeparatorChar: invalid separator string!" );
+ OSL_ENSURE( !_rSeparator.empty(), "::lcl_getSeparatorChar: invalid separator string!" );
sal_Unicode nReturn( _nFallback );
- if ( !_rSeparator.isEmpty() )
+ if ( !_rSeparator.empty() )
nReturn = _rSeparator[0];
return nReturn;
}