diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-11-30 17:36:17 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-11-30 19:38:40 +0100 |
commit | ae4efac7010c0596a3b03792ce8db6c4c49afffb (patch) | |
tree | ade68a98b884010f4e3aa04440c67036dd817521 /connectivity | |
parent | d7e70e8dffa1945e10d977c5d9d99c754fdb0568 (diff) |
loplugin:stringviewparam (Library_postgresql-sdbc-impl)
Change-Id: I9f37f6abfe7d923f8ca0a2d4fd5b699d7034f9f0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106901
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'connectivity')
3 files changed, 19 insertions, 13 deletions
diff --git a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx index 06d9ed164500..22130ed7c6d8 100644 --- a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx +++ b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx @@ -1285,14 +1285,14 @@ css::uno::Reference< XResultSet > DatabaseMetaData::getTableTypes( ) /** returns the constant from sdbc.DataType */ -sal_Int32 typeNameToDataType( const OUString &typeName, const OUString &typtype ) +sal_Int32 typeNameToDataType( const OUString &typeName, std::u16string_view typtype ) { // sal_Int32 ret = css::sdbc::DataType::DISTINCT; // map all unknown types to memo (longvarchar). This allows to show them in // string representation. Additionally, the edit-table-type-selection-box // is not so unusable anymore. sal_Int32 ret = css::sdbc::DataType::LONGVARCHAR; - if( typtype == "b" ) + if( typtype == u"b" ) { // as long as the OOo framework does not support arrays, // the user is better of with interpreting arrays as strings ! @@ -1310,11 +1310,11 @@ sal_Int32 typeNameToDataType( const OUString &typeName, const OUString &typtype ret = ii->second; } } - else if( typtype == "c" ) + else if( typtype == u"c" ) { ret = css::sdbc::DataType::STRUCT; } - else if( typtype == "d" ) + else if( typtype == u"d" ) { ret = css::sdbc::DataType::LONGVARCHAR; } diff --git a/connectivity/source/drivers/postgresql/pq_tools.hxx b/connectivity/source/drivers/postgresql/pq_tools.hxx index af751f8e633b..0647a1b38f55 100644 --- a/connectivity/source/drivers/postgresql/pq_tools.hxx +++ b/connectivity/source/drivers/postgresql/pq_tools.hxx @@ -47,6 +47,8 @@ #include <rtl/string.hxx> #include "pq_connection.hxx" + +#include <string_view> #include <vector> namespace pq_sdbc_driver @@ -134,7 +136,7 @@ OUString querySingleValue( const OUString &query ); void extractNameValuePairsFromInsert( String2StringMap & map, const OString & lastQuery ); -sal_Int32 typeNameToDataType( const OUString &typeName, const OUString &typtype ); +sal_Int32 typeNameToDataType( const OUString &typeName, std::u16string_view typtype ); // copied from connectivity/source/dbtools, can't use the function directly bool implSetObject( const css::uno::Reference< css::sdbc::XParameters >& _rxParameters, diff --git a/connectivity/source/drivers/postgresql/pq_xkeys.cxx b/connectivity/source/drivers/postgresql/pq_xkeys.cxx index 2297b557e6af..969ce4dd398c 100644 --- a/connectivity/source/drivers/postgresql/pq_xkeys.cxx +++ b/connectivity/source/drivers/postgresql/pq_xkeys.cxx @@ -34,6 +34,10 @@ * ************************************************************************/ +#include <sal/config.h> + +#include <string_view> + #include <sal/log.hxx> #include <rtl/ustrbuf.hxx> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> @@ -83,26 +87,26 @@ Keys::Keys( Keys::~Keys() {} -static sal_Int32 string2keytype( const OUString &type ) +static sal_Int32 string2keytype( std::u16string_view type ) { sal_Int32 ret = css::sdbcx::KeyType::UNIQUE; - if ( type == "p" ) + if ( type == u"p" ) ret = css::sdbcx::KeyType::PRIMARY; - else if ( type == "f" ) + else if ( type == u"f" ) ret = css::sdbcx::KeyType::FOREIGN; return ret; } -static sal_Int32 string2keyrule( const OUString & rule ) +static sal_Int32 string2keyrule( std::u16string_view rule ) { sal_Int32 ret = css::sdbc::KeyRule::NO_ACTION; - if( rule == "r" ) + if( rule == u"r" ) ret = css::sdbc::KeyRule::RESTRICT; - else if( rule == "c" ) + else if( rule == u"c" ) ret = css::sdbc::KeyRule::CASCADE; - else if( rule == "n" ) + else if( rule == u"n" ) ret = css::sdbc::KeyRule::SET_NULL; - else if( rule == "d" ) + else if( rule == u"d" ) ret = css::sdbc::KeyRule::SET_DEFAULT; return ret; } |