diff options
-rw-r--r-- | connectivity/source/drivers/ado/AConnection.cxx | 15 | ||||
-rw-r--r-- | connectivity/source/inc/ado/AConnection.hxx | 3 |
2 files changed, 11 insertions, 7 deletions
diff --git a/connectivity/source/drivers/ado/AConnection.cxx b/connectivity/source/drivers/ado/AConnection.cxx index 0287ee9e050f..2756a4c5d0d9 100644 --- a/connectivity/source/drivers/ado/AConnection.cxx +++ b/connectivity/source/drivers/ado/AConnection.cxx @@ -19,6 +19,7 @@ #include <sal/config.h> +#include <cstddef> #include <string_view> #include <ado/AConnection.hxx> @@ -34,6 +35,7 @@ #include <com/sun/star/lang/DisposedException.hpp> #include <comphelper/servicehelper.hxx> #include <connectivity/dbexception.hxx> +#include <o3tl/string_view.hxx> #include <osl/file.hxx> #include <systools/win32/oleauto.hxx> #include <strings.hrc> @@ -81,17 +83,18 @@ OConnection::~OConnection() { } -void OConnection::construct(const OUString& url,const Sequence< PropertyValue >& info) +void OConnection::construct(std::u16string_view url,const Sequence< PropertyValue >& info) { osl_atomic_increment( &m_refCount ); setConnectionInfo(info); - sal_Int32 nLen = url.indexOf(':'); - nLen = url.indexOf(':',nLen+1); - OUString aDSN(url.copy(nLen+1)),aUID,aPWD; - if ( aDSN.startsWith("access:") ) - aDSN = aDSN.copy(7); + std::size_t nLen = url.find(':'); + nLen = url.find(':',nLen == std::u16string_view::npos ? 0 : nLen+1); + std::u16string_view aDSN(url.substr(nLen == std::u16string_view::npos ? 0 : nLen+1)); + OUString aUID,aPWD; + if ( o3tl::starts_with(aDSN, u"access:") ) + aDSN.remove_prefix(7); sal_Int32 nTimeout = 20; const PropertyValue *pIter = info.getConstArray(); diff --git a/connectivity/source/inc/ado/AConnection.hxx b/connectivity/source/inc/ado/AConnection.hxx index 3e7581ec6d03..c2c82100363d 100644 --- a/connectivity/source/inc/ado/AConnection.hxx +++ b/connectivity/source/inc/ado/AConnection.hxx @@ -22,6 +22,7 @@ #include <com/sun/star/sdbcx/XTablesSupplier.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <map> +#include <string_view> #include <connectivity/CommonTools.hxx> #include <OTypeInfo.hxx> #include <TConnection.hxx> @@ -71,7 +72,7 @@ namespace connectivity::ado OConnection(ODriver* _pDriver); // OConnection(const SQLHANDLE _pConnectionHandle); ~OConnection() override; - void construct(const OUString& url,const css::uno::Sequence< css::beans::PropertyValue >& info); + void construct(std::u16string_view url,const css::uno::Sequence< css::beans::PropertyValue >& info); //XUnoTunnel virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; |