diff options
Diffstat (limited to 'connectivity/source/drivers/mysql/Yservices.cxx')
-rw-r--r-- | connectivity/source/drivers/mysql/Yservices.cxx | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/connectivity/source/drivers/mysql/Yservices.cxx b/connectivity/source/drivers/mysql/Yservices.cxx index ee2be92e9e06..ff6fe08804b1 100644 --- a/connectivity/source/drivers/mysql/Yservices.cxx +++ b/connectivity/source/drivers/mysql/Yservices.cxx @@ -80,24 +80,29 @@ extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL mysql_component_getFactory( void* pServiceManager, void* /*pRegistryKey*/) { - void* pRet = 0; - if (pServiceManager) + if (!pServiceManager) { - ProviderRequest aReq(pServiceManager,pImplementationName); + return 0; + } - aReq.CREATE_PROVIDER( - ODriverDelegator::getImplementationName_Static(), - ODriverDelegator::getSupportedServiceNames_Static(), - ODriverDelegator_CreateInstance, ::cppu::createSingleFactory) - ; + Reference< XSingleServiceFactory > xRet; + const Reference< XMultiServiceFactory > xServiceManager( reinterpret_cast<XMultiServiceFactory*>(pServiceManager) ); + const OUString sImplementationName( OUString::createFromAscii(pImplementationName) ); - if(aReq.xRet.is()) - aReq.xRet->acquire(); + if( ODriverDelegator::getImplementationName_Static() == sImplementationName ) + try + { + xRet = ::cppu::createSingleFactory( xServiceManager, sImplementationName, ODriverDelegator_CreateInstance, + ODriverDelegator::getSupportedServiceNames_Static(), 0); + } + catch(...) + { + } - pRet = aReq.getProvider(); - } + if(xRet.is()) + xRet->acquire(); - return pRet; + return xRet.get(); }; |