1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * Effective License of whole file:
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License version 2.1, as published by the Free Software Foundation.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20 * Parts "Copyright by Sun Microsystems, Inc" prior to August 2011:
22 * The Contents of this file are made available subject to the terms of
23 * the GNU Lesser General Public License Version 2.1
25 * Copyright: 2000 by Sun Microsystems, Inc.
27 * Contributor(s): Joerg Budischewski
29 * All parts contributed on or after August 2011:
31 * This Source Code Form is subject to the terms of the Mozilla Public
32 * License, v. 2.0. If a copy of the MPL was not distributed with this
33 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
35 ************************************************************************/
39 #include <sal/macros.h>
40 #include <cppuhelper/compbase.hxx>
41 #include <cppuhelper/basemutex.hxx>
43 #include <com/sun/star/lang/XServiceInfo.hpp>
45 #include <com/sun/star/sdbc/XDriver.hpp>
46 #include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp>
48 #include <com/sun/star/uno/XComponentContext.hpp>
50 namespace pq_sdbc_driver
53 #define PQ_SDBC_DRIVER_VERSION SAL_STRINGIFY(PQ_SDBC_MAJOR) "." \
54 SAL_STRINGIFY(PQ_SDBC_MINOR) "." \
55 SAL_STRINGIFY(PQ_SDBC_MICRO)
57 // use this to switch off sdbc support !
58 // typedef cppu::WeakComponentImplHelper<
59 // css::sdbc::XDriver,
60 // css::lang::XServiceInfo
62 typedef cppu::WeakComponentImplHelper
<
64 css::lang::XServiceInfo
,
65 css::sdbcx::XDataDefinitionSupplier
> DriverBase
;
66 class Driver
: public cppu::BaseMutex
, public DriverBase
68 css::uno::Reference
< css::uno::XComponentContext
> m_ctx
;
69 css::uno::Reference
< css::lang::XMultiComponentFactory
> m_smgr
;
72 explicit Driver ( const css::uno::Reference
< css::uno::XComponentContext
> & ctx
)
73 : DriverBase( m_aMutex
),
75 m_smgr( ctx
->getServiceManager() )
79 virtual css::uno::Reference
< css::sdbc::XConnection
> SAL_CALL
connect(
81 const css::uno::Sequence
< css::beans::PropertyValue
>& info
) override
;
83 virtual sal_Bool SAL_CALL
acceptsURL( const OUString
& url
) override
;
85 virtual css::uno::Sequence
< css::sdbc::DriverPropertyInfo
> SAL_CALL
getPropertyInfo(
87 const css::uno::Sequence
< css::beans::PropertyValue
>& info
) override
;
89 virtual sal_Int32 SAL_CALL
getMajorVersion( ) override
;
90 virtual sal_Int32 SAL_CALL
getMinorVersion( ) override
;
94 virtual OUString SAL_CALL
getImplementationName() override
;
95 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
97 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
99 // XDataDefinitionSupplier
100 virtual css::uno::Reference
< css::sdbcx::XTablesSupplier
> SAL_CALL
101 getDataDefinitionByConnection(
102 const css::uno::Reference
< css::sdbc::XConnection
>& connection
) override
;
103 virtual css::uno::Reference
< css::sdbcx::XTablesSupplier
> SAL_CALL
104 getDataDefinitionByURL(
106 const css::uno::Sequence
< css::beans::PropertyValue
>& info
) override
;
109 virtual void SAL_CALL
disposing() override
;
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */