diff options
Diffstat (limited to 'connectivity/source/drivers/ado/AConnection.cxx')
-rw-r--r-- | connectivity/source/drivers/ado/AConnection.cxx | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/connectivity/source/drivers/ado/AConnection.cxx b/connectivity/source/drivers/ado/AConnection.cxx index 5b44d9e6f4fb..b879e1b11801 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,7 +35,9 @@ #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> using namespace dbtools; @@ -59,12 +62,12 @@ OConnection::OConnection(ODriver* _pDriver) osl_atomic_increment( &m_refCount ); sal::systools::COMReference<IClassFactory2> pIUnknown; - if (!FAILED(pIUnknown.TryCoGetClassObject(ADOS::CLSID_ADOCONNECTION_21, CLSCTX_INPROC_SERVER))) + if (!FAILED(pIUnknown.CoGetClassObject(ADOS::CLSID_ADOCONNECTION_21, CLSCTX_INPROC_SERVER))) { HRESULT hr = pIUnknown->CreateInstanceLic(nullptr, nullptr, ADOS::IID_ADOCONNECTION_21, - ADOS::GetKeyStr().asBSTR(), + ADOS::GetKeyStr(), reinterpret_cast<void**>(&m_aAdoConnection)); if( !FAILED( hr ) ) @@ -80,17 +83,17 @@ 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; + o3tl::starts_with(aDSN, u"access:", &aDSN); sal_Int32 nTimeout = 20; const PropertyValue *pIter = info.getConstArray(); @@ -118,9 +121,9 @@ void OConnection::construct(const OUString& url,const Sequence< PropertyValue >& WpADOProperties aProps = m_aAdoConnection.get_Properties(); if(aProps.IsValid()) { - OTools::putValue(aProps, std::u16string_view(u"Jet OLEDB:ODBC Parsing"), true); + OTools::putValue(aProps, std::u16string_view(u"ACE OLEDB:ODBC Parsing"), true); OLEVariant aVar( - OTools::getValue(aProps, std::u16string_view(u"Jet OLEDB:Engine Type"))); + OTools::getValue(aProps, std::u16string_view(u"ACE OLEDB:Engine Type"))); if(!aVar.isNull() && !aVar.isEmpty()) m_nEngineType = aVar.getInt32(); } @@ -181,7 +184,7 @@ OUString SAL_CALL OConnection::nativeSQL( const OUString& _sql ) WpADOProperties aProps = m_aAdoConnection.get_Properties(); if(aProps.IsValid()) { - OTools::putValue(aProps, std::u16string_view(u"Jet OLEDB:ODBC Parsing"), true); + OTools::putValue(aProps, std::u16string_view(u"ACE OLEDB:ODBC Parsing"), true); WpADOCommand aCommand; aCommand.Create(); aCommand.put_ActiveConnection(static_cast<IDispatch*>(m_aAdoConnection)); |