From 9fc4553b6433fbb6565a5b946c4256c0bfe345f1 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 6 Dec 2012 16:37:57 +0200 Subject: fdo#46808, Adapt sdbc::DriverManager UNO service to new style Change-Id: Ic2be6bd08aaabc81d0fbe0269ca577868defe934 --- connectivity/source/cpool/ZPoolCollection.cxx | 26 +++++++++++--------------- connectivity/source/cpool/ZPoolCollection.hxx | 4 ++-- 2 files changed, 13 insertions(+), 17 deletions(-) (limited to 'connectivity/source/cpool') diff --git a/connectivity/source/cpool/ZPoolCollection.cxx b/connectivity/source/cpool/ZPoolCollection.cxx index 68b5448b9506..b7d0abd075d5 100644 --- a/connectivity/source/cpool/ZPoolCollection.cxx +++ b/connectivity/source/cpool/ZPoolCollection.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -75,9 +76,7 @@ OPoolCollection::OPoolCollection(const Reference< XMultiServiceFactory >& _rxF :m_xServiceFactory(_rxFactory) { // bootstrap all objects supporting the .sdb.Driver service - m_xManager = Reference< XDriverManager >(m_xServiceFactory->createInstance(::rtl::OUString("com.sun.star.sdbc.DriverManager") ), UNO_QUERY); - m_xDriverAccess = Reference< XDriverAccess >(m_xManager, UNO_QUERY); - OSL_ENSURE(m_xDriverAccess.is(), "have no (or an invalid) driver manager!"); + m_xManager = DriverManager::create( comphelper::getComponentContext(m_xServiceFactory) ); m_xProxyFactory = ProxyFactory::create( comphelper::getComponentContext(m_xServiceFactory) ); @@ -277,20 +276,17 @@ sal_Bool OPoolCollection::isPoolingEnabledByUrl(const ::rtl::OUString& _sUrl, Reference< XInterface >& _rxDriverNode) { sal_Bool bEnabled = sal_False; - if (m_xDriverAccess.is()) + _rxDriver = m_xManager->getDriverByURL(_sUrl); + if (_rxDriver.is() && isPoolingEnabled()) { - _rxDriver = m_xDriverAccess->getDriverByURL(_sUrl); - if (_rxDriver.is() && isPoolingEnabled()) - { - Reference< XServiceInfo > xSerivceInfo(_rxDriver,UNO_QUERY); - OSL_ENSURE(xSerivceInfo.is(),"Each driver should have a XServiceInfo interface!"); + Reference< XServiceInfo > xSerivceInfo(_rxDriver,UNO_QUERY); + OSL_ENSURE(xSerivceInfo.is(),"Each driver should have a XServiceInfo interface!"); - if(xSerivceInfo.is()) - { - // look for the implementation name of the driver - _rsImplName = xSerivceInfo->getImplementationName(); - bEnabled = isDriverPoolingEnabled(_rsImplName,_rxDriverNode); - } + if(xSerivceInfo.is()) + { + // look for the implementation name of the driver + _rsImplName = xSerivceInfo->getImplementationName(); + bEnabled = isDriverPoolingEnabled(_rsImplName,_rxDriverNode); } } return bEnabled; diff --git a/connectivity/source/cpool/ZPoolCollection.hxx b/connectivity/source/cpool/ZPoolCollection.hxx index 20108fd87b08..6fb05bb31339 100644 --- a/connectivity/source/cpool/ZPoolCollection.hxx +++ b/connectivity/source/cpool/ZPoolCollection.hxx @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -65,8 +66,7 @@ namespace connectivity ::osl::Mutex m_aMutex; OConnectionPools m_aPools; // the driver pools ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory; - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriverManager > m_xManager; - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriverAccess > m_xDriverAccess; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriverManager2 > m_xManager; ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XProxyFactory > m_xProxyFactory; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xConfigNode; // config node for generel connection pooling ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop> m_xDesktop; -- cgit