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 ************************************************************************/
37 #ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_DRIVER_HXX
38 #define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_DRIVER_HXX
40 #include <osl/mutex.hxx>
42 #include <cppuhelper/compbase.hxx>
44 #include <com/sun/star/lang/XServiceInfo.hpp>
46 #include <com/sun/star/sdbc/XDriver.hpp>
47 #include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp>
49 #include <com/sun/star/uno/XComponentContext.hpp>
51 namespace pq_sdbc_driver
54 #define MY_STRINGIFY( x ) #x
56 #define PQ_SDBC_DRIVER_VERSION MY_STRINGIFY(PQ_SDBC_MAJOR) "." \
57 MY_STRINGIFY(PQ_SDBC_MINOR) "." \
58 MY_STRINGIFY(PQ_SDBC_MICRO)
60 struct MutexHolder
{ osl::Mutex m_mutex
; };
61 // use this to switch off sdbc support !
62 // typedef cppu::WeakComponentImplHelper<
63 // css::sdbc::XDriver,
64 // css::lang::XServiceInfo
66 typedef cppu::WeakComponentImplHelper
<
68 css::lang::XServiceInfo
,
69 css::sdbcx::XDataDefinitionSupplier
> DriverBase
;
70 class Driver
: public MutexHolder
, public DriverBase
72 css::uno::Reference
< css::uno::XComponentContext
> m_ctx
;
73 css::uno::Reference
< css::lang::XMultiComponentFactory
> m_smgr
;
76 explicit Driver ( const css::uno::Reference
< css::uno::XComponentContext
> & ctx
)
77 : DriverBase( m_mutex
),
79 m_smgr( ctx
->getServiceManager() )
83 virtual css::uno::Reference
< css::sdbc::XConnection
> SAL_CALL
connect(
85 const css::uno::Sequence
< css::beans::PropertyValue
>& info
) override
;
87 virtual sal_Bool SAL_CALL
acceptsURL( const OUString
& url
) override
;
89 virtual css::uno::Sequence
< css::sdbc::DriverPropertyInfo
> SAL_CALL
getPropertyInfo(
91 const css::uno::Sequence
< css::beans::PropertyValue
>& info
) override
;
93 virtual sal_Int32 SAL_CALL
getMajorVersion( ) override
;
94 virtual sal_Int32 SAL_CALL
getMinorVersion( ) override
;
96 public: // XServiceInfo
98 virtual OUString SAL_CALL
getImplementationName() override
;
99 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
101 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
103 public: // XDataDefinitionSupplier
104 virtual css::uno::Reference
< css::sdbcx::XTablesSupplier
> SAL_CALL
105 getDataDefinitionByConnection(
106 const css::uno::Reference
< css::sdbc::XConnection
>& connection
) override
;
107 virtual css::uno::Reference
< css::sdbcx::XTablesSupplier
> SAL_CALL
108 getDataDefinitionByURL(
110 const css::uno::Sequence
< css::beans::PropertyValue
>& info
) override
;
113 virtual void SAL_CALL
disposing() override
;
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */