summaryrefslogtreecommitdiff
path: root/connectivity/source/cpool
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-12-06 16:37:57 +0200
committerNoel Grandin <noel@peralex.com>2012-12-10 08:05:36 +0200
commit9fc4553b6433fbb6565a5b946c4256c0bfe345f1 (patch)
tree347cd116da96a13f9087685017f6ee4a5fc7aca7 /connectivity/source/cpool
parentd01fba6afc39092ae3ae85c38ac21bb7d26d63e2 (diff)
fdo#46808, Adapt sdbc::DriverManager UNO service to new style
Change-Id: Ic2be6bd08aaabc81d0fbe0269ca577868defe934
Diffstat (limited to 'connectivity/source/cpool')
-rw-r--r--connectivity/source/cpool/ZPoolCollection.cxx26
-rw-r--r--connectivity/source/cpool/ZPoolCollection.hxx4
2 files changed, 13 insertions, 17 deletions
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 <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/reflection/ProxyFactory.hpp>
+#include <com/sun/star/sdbc/DriverManager.hpp>
#include <comphelper/extract.hxx>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -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 <cppuhelper/implbase4.hxx>
#include <com/sun/star/beans/XPropertyChangeListener.hpp>
#include <com/sun/star/sdbc/XDriver.hpp>
+#include <com/sun/star/sdbc/XDriverManager2.hpp>
#include <com/sun/star/sdbc/XConnectionPool.hpp>
#include <com/sun/star/sdbc/XPooledConnection.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
@@ -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;