merge the formfield patch from ooo-build
[ooovba.git] / connectivity / source / drivers / postgresql / pq_driver.hxx
bloba030a77e4385d4922877416bc2e03017f94ee50b
1 /*************************************************************************
3 * $RCSfile: pq_driver.hxx,v $
5 * $Revision: 1.1.2.2 $
7 * last change: $Author: jbu $ $Date: 2004/05/09 19:47:14 $
9 * The Contents of this file are made available subject to the terms of
10 * either of the following licenses
12 * - GNU Lesser General Public License Version 2.1
13 * - Sun Industry Standards Source License Version 1.1
15 * Sun Microsystems Inc., October, 2000
17 * GNU Lesser General Public License Version 2.1
18 * =============================================
19 * Copyright 2000 by Sun Microsystems, Inc.
20 * 901 San Antonio Road, Palo Alto, CA 94303, USA
22 * This library is free software; you can redistribute it and/or
23 * modify it under the terms of the GNU Lesser General Public
24 * License version 2.1, as published by the Free Software Foundation.
26 * This library is distributed in the hope that it will be useful,
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29 * Lesser General Public License for more details.
31 * You should have received a copy of the GNU Lesser General Public
32 * License along with this library; if not, write to the Free Software
33 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
34 * MA 02111-1307 USA
37 * Sun Industry Standards Source License Version 1.1
38 * =================================================
39 * The contents of this file are subject to the Sun Industry Standards
40 * Source License Version 1.1 (the "License"); You may not use this file
41 * except in compliance with the License. You may obtain a copy of the
42 * License at http://www.openoffice.org/license.html.
44 * Software provided under this License is provided on an "AS IS" basis,
45 * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
46 * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
47 * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
48 * See the License for the specific provisions governing your rights and
49 * obligations concerning the Software.
51 * The Initial Developer of the Original Code is: Joerg Budischewski
53 * Copyright: 2000 by Sun Microsystems, Inc.
55 * All Rights Reserved.
57 * Contributor(s): Joerg Budischewski
60 ************************************************************************/
61 #ifndef _PG_DRIVER_HXX_
62 #define _PG_DRIVER_HXX_
64 #include <osl/mutex.hxx>
66 #include <cppuhelper/compbase2.hxx>
67 #include <cppuhelper/compbase3.hxx>
69 #include <com/sun/star/lang/XServiceInfo.hpp>
71 #include <com/sun/star/sdbc/XDriver.hpp>
72 #include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp>
74 #include <com/sun/star/uno/XComponentContext.hpp>
76 namespace pq_sdbc_driver
79 #define MY_STRINGIFY( x ) #x
81 #define PQ_SDBC_DRIVER_VERSION MY_STRINGIFY(PQ_SDBC_MAJOR) "." \
82 MY_STRINGIFY(PQ_SDBC_MINOR) "." \
83 MY_STRINGIFY(PQ_SDBC_MICRO)
85 #define POSTGRES_MAJOR 7
86 #define POSTGRES_MINOR 3
87 #define POSTGRES_MICRO 2
88 #define POSTGRESQL_VERSION MY_STRINGIFY(POSTGRESQL_MAJOR) "." \
89 MY_STRINGIFY(POSTGRESQL_MINOR) "." \
90 MY_STRINGIFY(POSTGRESQL_MICRO)
93 struct MutexHolder { osl::Mutex m_mutex; };
94 // use this to switch off sdbc support !
95 // typedef cppu::WeakComponentImplHelper2<
96 // com::sun::star::sdbc::XDriver,
97 // com::sun::star::lang::XServiceInfo
98 // > DriverBase ;
99 typedef cppu::WeakComponentImplHelper3<
100 com::sun::star::sdbc::XDriver,
101 com::sun::star::lang::XServiceInfo,
102 com::sun::star::sdbcx::XDataDefinitionSupplier > DriverBase ;
103 class Driver : public MutexHolder, public DriverBase
105 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_ctx;
106 com::sun::star::uno::Reference< com::sun::star::lang::XMultiComponentFactory > m_smgr;
108 public:
109 Driver ( const com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > & ctx )
110 : DriverBase( this->m_mutex ),
111 m_ctx( ctx ),
112 m_smgr( ctx->getServiceManager() )
115 public: // XDriver
116 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect(
117 const ::rtl::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);
121 virtual sal_Bool SAL_CALL acceptsURL( const ::rtl::OUString& url )
122 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
124 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo(
125 const ::rtl::OUString& url,
126 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info )
127 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
129 virtual sal_Int32 SAL_CALL getMajorVersion( ) throw (::com::sun::star::uno::RuntimeException);
130 virtual sal_Int32 SAL_CALL getMinorVersion( ) throw (::com::sun::star::uno::RuntimeException);
132 public: // XServiceInfo
133 // XServiceInfo
134 virtual rtl::OUString SAL_CALL getImplementationName()
135 throw(::com::sun::star::uno::RuntimeException);
136 virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName)
137 throw(::com::sun::star::uno::RuntimeException);
139 virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void)
140 throw(::com::sun::star::uno::RuntimeException);
142 public: // XDataDefinitionSupplier
143 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL
144 getDataDefinitionByConnection(
145 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& connection )
146 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
147 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL
148 getDataDefinitionByURL(
149 const ::rtl::OUString& url,
150 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info )
151 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
153 // XComponent
154 virtual void SAL_CALL disposing();
161 #endif