diff --git a/connectivity/Library_firebird_sdbc.mk b/connectivity/Library_firebird_sdbc.mk index 2c6eb559b033..5fb596ef8fb4 100644 --- a/connectivity/Library_firebird_sdbc.mk +++ b/connectivity/Library_firebird_sdbc.mk @@ -54,7 +54,6 @@ $(eval $(call gb_Library_add_exception_objects,firebird_sdbc,\ connectivity/source/drivers/firebird/PreparedStatement \ connectivity/source/drivers/firebird/ResultSet \ connectivity/source/drivers/firebird/ResultSetMetaData \ - connectivity/source/drivers/firebird/Services \ connectivity/source/drivers/firebird/Statement \ connectivity/source/drivers/firebird/StatementCommonBase \ connectivity/source/drivers/firebird/Table \ diff --git a/connectivity/source/drivers/firebird/Driver.cxx b/connectivity/source/drivers/firebird/Driver.cxx index aa6f0d9d5c57..71613408df24 100644 --- a/connectivity/source/drivers/firebird/Driver.cxx +++ b/connectivity/source/drivers/firebird/Driver.cxx @@ -44,16 +44,6 @@ using namespace ::osl; using namespace connectivity::firebird; -namespace connectivity::firebird -{ - Reference< XInterface > FirebirdDriver_CreateInstance( - const Reference< XMultiServiceFactory >& _rxFactory) - { - SAL_INFO("connectivity.firebird", "FirebirdDriver_CreateInstance()" ); - return *(new FirebirdDriver(comphelper::getComponentContext(_rxFactory))); - } -} - // Static const variables namespace { const char our_sFirebirdTmpVar[] = "FIREBIRD_TMP"; @@ -133,20 +123,9 @@ void FirebirdDriver::disposing() ODriver_BASE::disposing(); } -//----- static ServiceInfo --------------------------------------------------- -OUString FirebirdDriver::getImplementationName_Static() -{ - return "com.sun.star.comp.sdbc.firebird.Driver"; -} - -Sequence< OUString > FirebirdDriver::getSupportedServiceNames_Static() -{ - return { "com.sun.star.sdbc.Driver", "com.sun.star.sdbcx.Driver" }; -} - OUString SAL_CALL FirebirdDriver::getImplementationName() { - return getImplementationName_Static(); + return "com.sun.star.comp.sdbc.firebird.Driver"; } sal_Bool SAL_CALL FirebirdDriver::supportsService(const OUString& _rServiceName) @@ -156,7 +135,7 @@ sal_Bool SAL_CALL FirebirdDriver::supportsService(const OUString& _rServiceName) Sequence< OUString > SAL_CALL FirebirdDriver::getSupportedServiceNames() { - return getSupportedServiceNames_Static(); + return { "com.sun.star.sdbc.Driver", "com.sun.star.sdbcx.Driver" }; } // ---- XDriver ------------------------------------------------------------- @@ -238,5 +217,16 @@ namespace connectivity::firebird } // namespace +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +connectivity_FirebirdDriver_get_implementation( + css::uno::XComponentContext* context , css::uno::Sequence const&) +{ + try { + return cppu::acquire(new FirebirdDriver(context)); + } catch (...) { + return nullptr; + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/firebird/Driver.hxx b/connectivity/source/drivers/firebird/Driver.hxx index 39534c3a1c6d..acace9d13298 100644 --- a/connectivity/source/drivers/firebird/Driver.hxx +++ b/connectivity/source/drivers/firebird/Driver.hxx @@ -38,9 +38,6 @@ namespace connectivity // 3: Is IB6 -- minimum required for delimited identifiers. const int FIREBIRD_SQL_DIALECT = 3; - /// @throws css::uno::Exception - css::uno::Reference< css::uno::XInterface > FirebirdDriver_CreateInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& _rxFactory); - typedef ::cppu::WeakComponentImplHelper< css::sdbc::XDriver, css::sdbcx::XDataDefinitionSupplier, css::lang::XServiceInfo > ODriver_BASE; @@ -66,11 +63,6 @@ namespace connectivity // OComponentHelper virtual void SAL_CALL disposing() override; - // XInterface - /// @throws css::uno::RuntimeException - static OUString getImplementationName_Static( ); - /// @throws css::uno::RuntimeException - static css::uno::Sequence< OUString > getSupportedServiceNames_Static( ); // XServiceInfo virtual OUString SAL_CALL getImplementationName( ) override; diff --git a/connectivity/source/drivers/firebird/Services.cxx b/connectivity/source/drivers/firebird/Services.cxx deleted file mode 100644 index e72133692f07..000000000000 --- a/connectivity/source/drivers/firebird/Services.cxx +++ /dev/null @@ -1,109 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "Driver.hxx" - -#include -#include -#include - -using namespace connectivity::firebird; -using ::com::sun::star::uno::Reference; -using ::com::sun::star::uno::Sequence; -using ::com::sun::star::lang::XSingleServiceFactory; -using ::com::sun::star::lang::XMultiServiceFactory; - -typedef Reference< XSingleServiceFactory > (*createFactoryFunc) - ( - const Reference< XMultiServiceFactory > & rServiceManager, - const OUString & rComponentName, - ::cppu::ComponentInstantiation pCreateFunction, - const Sequence< OUString > & rServiceNames, - rtl_ModuleCount* _pTemp - ); - -namespace { - -struct ProviderRequest -{ - Reference< XSingleServiceFactory > xRet; - Reference< XMultiServiceFactory > const xServiceManager; - OUString const sImplementationName; - - ProviderRequest( - void* pServiceManager, - char const* pImplementationName - ) - : xServiceManager(static_cast(pServiceManager)) - , sImplementationName(OUString::createFromAscii(pImplementationName)) - { - } - - bool CREATE_PROVIDER( - const OUString& Implname, - const Sequence< OUString > & Services, - ::cppu::ComponentInstantiation Factory, - createFactoryFunc creator - ) - { - if (!xRet.is() && (Implname == sImplementationName)) - { - try - { - xRet = creator( xServiceManager, sImplementationName,Factory, Services,nullptr); - } - catch(...) - { - } - } - return xRet.is(); - } - - void* getProvider() const { return xRet.get(); } -}; - -} - -extern "C" SAL_DLLPUBLIC_EXPORT void* firebird_sdbc_component_getFactory( - const char* pImplementationName, - void* pServiceManager, - void*) -{ - void* pRet = nullptr; - if (pServiceManager) - { - ProviderRequest aReq(pServiceManager,pImplementationName); - - aReq.CREATE_PROVIDER( - FirebirdDriver::getImplementationName_Static(), - FirebirdDriver::getSupportedServiceNames_Static(), - FirebirdDriver_CreateInstance, ::cppu::createSingleFactory) - ; - - if(aReq.xRet.is()) - aReq.xRet->acquire(); - - pRet = aReq.getProvider(); - } - - return pRet; -}; - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/firebird/firebird_sdbc.component b/connectivity/source/drivers/firebird/firebird_sdbc.component index b56d4e0bcae7..d80755a24d0d 100644 --- a/connectivity/source/drivers/firebird/firebird_sdbc.component +++ b/connectivity/source/drivers/firebird/firebird_sdbc.component @@ -9,8 +9,9 @@ --> - + xmlns="http://openoffice.org/2010/uno-components"> +