Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*************************************************************************
3 : *
4 : * Effective License of whole file:
5 : *
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.
9 : *
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.
14 : *
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,
18 : * MA 02111-1307 USA
19 : *
20 : * Parts "Copyright by Sun Microsystems, Inc" prior to August 2011:
21 : *
22 : * The Contents of this file are made available subject to the terms of
23 : * the GNU Lesser General Public License Version 2.1
24 : *
25 : * Copyright: 2000 by Sun Microsystems, Inc.
26 : *
27 : * Contributor(s): Joerg Budischewski
28 : *
29 : * All parts contributed on or after August 2011:
30 : *
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/.
34 : *
35 : ************************************************************************/
36 :
37 : #ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_DRIVER_HXX
38 : #define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_DRIVER_HXX
39 :
40 : #include <osl/mutex.hxx>
41 :
42 : #include <cppuhelper/compbase2.hxx>
43 : #include <cppuhelper/compbase3.hxx>
44 :
45 : #include <com/sun/star/lang/XServiceInfo.hpp>
46 :
47 : #include <com/sun/star/sdbc/XDriver.hpp>
48 : #include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp>
49 :
50 : #include <com/sun/star/uno/XComponentContext.hpp>
51 :
52 : namespace pq_sdbc_driver
53 : {
54 :
55 : #define MY_STRINGIFY( x ) #x
56 :
57 : #define PQ_SDBC_DRIVER_VERSION MY_STRINGIFY(PQ_SDBC_MAJOR) "." \
58 : MY_STRINGIFY(PQ_SDBC_MINOR) "." \
59 : MY_STRINGIFY(PQ_SDBC_MICRO)
60 :
61 0 : struct MutexHolder { osl::Mutex m_mutex; };
62 : // use this to switch off sdbc support !
63 : // typedef cppu::WeakComponentImplHelper2<
64 : // com::sun::star::sdbc::XDriver,
65 : // com::sun::star::lang::XServiceInfo
66 : // > DriverBase ;
67 : typedef cppu::WeakComponentImplHelper3<
68 : com::sun::star::sdbc::XDriver,
69 : com::sun::star::lang::XServiceInfo,
70 : com::sun::star::sdbcx::XDataDefinitionSupplier > DriverBase ;
71 0 : class Driver : public MutexHolder, public DriverBase
72 : {
73 : com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_ctx;
74 : com::sun::star::uno::Reference< com::sun::star::lang::XMultiComponentFactory > m_smgr;
75 :
76 : public:
77 0 : Driver ( const com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > & ctx )
78 : : DriverBase( this->m_mutex ),
79 : m_ctx( ctx ),
80 0 : m_smgr( ctx->getServiceManager() )
81 0 : {}
82 :
83 : public: // XDriver
84 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect(
85 : const OUString& url,
86 : const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info )
87 : throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
88 :
89 : virtual sal_Bool SAL_CALL acceptsURL( const OUString& url )
90 : throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
91 :
92 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo(
93 : const OUString& url,
94 : const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info )
95 : throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
96 :
97 : virtual sal_Int32 SAL_CALL getMajorVersion( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
98 : virtual sal_Int32 SAL_CALL getMinorVersion( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
99 :
100 : public: // XServiceInfo
101 : // XServiceInfo
102 : virtual OUString SAL_CALL getImplementationName()
103 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
104 : virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName)
105 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
106 :
107 : virtual com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(void)
108 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
109 :
110 : public: // XDataDefinitionSupplier
111 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL
112 : getDataDefinitionByConnection(
113 : const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& connection )
114 : throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
115 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL
116 : getDataDefinitionByURL(
117 : const OUString& url,
118 : const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info )
119 : throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
120 :
121 : // XComponent
122 : virtual void SAL_CALL disposing() SAL_OVERRIDE;
123 :
124 : };
125 :
126 :
127 : }
128 :
129 : #endif
130 :
131 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|