xref: /trunk/main/connectivity/source/drivers/evoab2/NConnection.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1  /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _CONNECTIVITY_EVOAB_CONNECTION_HXX_
29 #define _CONNECTIVITY_EVOAB_CONNECTION_HXX_
30 
31 #include "NDriver.hxx"
32 #include <com/sun/star/sdbc/SQLWarning.hpp>
33 #include <com/sun/star/beans/PropertyValue.hpp>
34 #include "OSubComponent.hxx"
35 #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
36 #include "connectivity/CommonTools.hxx"
37 #include "connectivity/warningscontainer.hxx"
38 #include "TConnection.hxx"
39 #include <cppuhelper/weakref.hxx>
40 #include <osl/module.h>
41 #include "EApi.h"
42 
43 namespace connectivity
44 {
45     namespace evoab
46     {
47 
48         namespace SDBCAddress {
49             typedef enum {
50                 Unknown     = 0,
51                 EVO_LOCAL       = 1,
52                 EVO_LDAP    = 2,
53                 EVO_GWISE   = 3
54             } sdbc_address_type;
55         }
56 
57         typedef connectivity::OMetaConnection               OConnection_BASE; // implements basics and text encoding
58 
59         class OEvoabConnection  :public OConnection_BASE
60                                 ,public connectivity::OSubComponent<OEvoabConnection, OConnection_BASE>
61         {
62             friend class connectivity::OSubComponent<OEvoabConnection, OConnection_BASE>;
63 
64         private:
65             const OEvoabDriver&             m_rDriver;
66             SDBCAddress::sdbc_address_type  m_eSDBCAddressType;
67             ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier >
68                                             m_xCatalog;
69             ::rtl::OString                  m_aPassword;
70             ::dbtools::WarningsContainer    m_aWarnings;
71 
72             virtual ~OEvoabConnection();
73 
74         public:
75             OEvoabConnection( OEvoabDriver& _rDriver );
76             virtual void construct(const ::rtl::OUString& _rUrl,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rInfo ) throw( ::com::sun::star::sdbc::SQLException);
77 
78             inline rtl::OString getPassword() { return m_aPassword; }
79             inline void         setPassword( rtl::OString aStr ) { m_aPassword = aStr; }
80             // own methods
81             inline const OEvoabDriver& getDriver() const { return m_rDriver; }
82 
83             SDBCAddress::sdbc_address_type getSDBCAddressType() const { return m_eSDBCAddressType;}
84             void setSDBCAddressType(SDBCAddress::sdbc_address_type _eSDBCAddressType) {m_eSDBCAddressType = _eSDBCAddressType;}
85 
86             // OComponentHelper
87             virtual void SAL_CALL disposing(void);
88             // XInterface
89             virtual void SAL_CALL release() throw();
90 
91             // XServiceInfo
92             DECLARE_SERVICE_INFO();
93 
94             // XConnection
95             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > createCatalog();
96             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement > SAL_CALL createStatement(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
97             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
98             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareCall( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
99             virtual ::rtl::OUString SAL_CALL nativeSQL( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
100             virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
101             virtual sal_Bool SAL_CALL getAutoCommit(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
102             virtual void SAL_CALL commit(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
103             virtual void SAL_CALL rollback(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
104             virtual sal_Bool SAL_CALL isClosed(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
105             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > SAL_CALL getMetaData(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
106             virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
107             virtual sal_Bool SAL_CALL isReadOnly(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
108             virtual void SAL_CALL setCatalog( const ::rtl::OUString& catalog ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
109             virtual ::rtl::OUString SAL_CALL getCatalog(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
110             virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
111             virtual sal_Int32 SAL_CALL getTransactionIsolation(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
112             virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTypeMap(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
113             virtual void SAL_CALL setTypeMap( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
114 
115             // XCloseable
116             virtual void SAL_CALL close(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
117             // XWarningsSupplier
118             virtual ::com::sun::star::uno::Any SAL_CALL getWarnings(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
119             virtual void SAL_CALL clearWarnings(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
120         };
121     }
122 }
123 #endif // _CONNECTIVITY_EVOAB_CONNECTION_HXX_
124