Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : */
9 :
10 : #ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MORK_MCONNECTION_HXX
11 : #define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MORK_MCONNECTION_HXX
12 :
13 : #include <connectivity/CommonTools.hxx>
14 :
15 : #include <connectivity/OSubComponent.hxx>
16 : #include "TConnection.hxx"
17 : #include "MColumnAlias.hxx"
18 :
19 : #include <com/sun/star/beans/PropertyValue.hpp>
20 : #include <com/sun/star/sdbc/SQLWarning.hpp>
21 : #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
22 :
23 : #include <cppuhelper/weakref.hxx>
24 :
25 : // do we want here namespace too?
26 : class MorkParser;
27 :
28 : namespace connectivity
29 : {
30 : namespace mork
31 : {
32 : class MorkDriver;
33 : class ProfileAccess;
34 : class ErrorDescriptor;
35 :
36 : typedef connectivity::OMetaConnection OConnection_BASE; // implements basics and text encoding
37 :
38 : class OConnection : public OConnection_BASE,
39 : public connectivity::OSubComponent<OConnection, OConnection_BASE>
40 : {
41 : friend class connectivity::OSubComponent<OConnection, OConnection_BASE>;
42 :
43 : protected:
44 :
45 : // Data attributes
46 :
47 : ::com::sun::star::sdbc::SQLWarning m_aLastWarning;
48 : MorkDriver* m_pDriver; // Pointer to the owning
49 : // driver object
50 : OColumnAlias m_aColumnAlias;
51 : // Profile Access
52 : ProfileAccess* m_pProfileAccess;
53 : // Mork Parser (abook)
54 : MorkParser* m_pBook;
55 : // Mork Parser (history)
56 : MorkParser* m_pHistory;
57 : // Store Catalog
58 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier> m_xCatalog;
59 :
60 : public:
61 : void construct( const OUString& url,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info) throw(::com::sun::star::sdbc::SQLException);
62 : OConnection(MorkDriver* const driver);
63 : virtual ~OConnection();
64 :
65 2 : MorkDriver* getDriver() {return m_pDriver;};
66 165 : MorkParser* getMorkParser(const OString& t) {return t == "CollectedAddressBook" ? m_pHistory : m_pBook;};
67 : void closeAllStatements () throw( ::com::sun::star::sdbc::SQLException);
68 :
69 : // OComponentHelper
70 : virtual void SAL_CALL disposing() SAL_OVERRIDE;
71 : // XInterface
72 : virtual void SAL_CALL release() throw() SAL_OVERRIDE;
73 :
74 : // XServiceInfo
75 : DECLARE_SERVICE_INFO();
76 : // XConnection
77 : 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, std::exception) SAL_OVERRIDE;
78 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
79 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareCall( const OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
80 : virtual OUString SAL_CALL nativeSQL( const OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
81 : virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
82 : virtual sal_Bool SAL_CALL getAutoCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
83 : virtual void SAL_CALL commit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
84 : virtual void SAL_CALL rollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
85 : virtual sal_Bool SAL_CALL isClosed( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
86 : 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, std::exception) SAL_OVERRIDE;
87 : virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
88 : virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
89 : virtual void SAL_CALL setCatalog( const OUString& catalog ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
90 : virtual OUString SAL_CALL getCatalog( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
91 : virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
92 : virtual sal_Int32 SAL_CALL getTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
93 : 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, std::exception) SAL_OVERRIDE;
94 : 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, std::exception) SAL_OVERRIDE;
95 : // XCloseable
96 : virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
97 : // XWarningsSupplier
98 : virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
99 : virtual void SAL_CALL clearWarnings() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
100 :
101 78 : const OColumnAlias & getColumnAlias() const { return m_aColumnAlias; }
102 :
103 : static OUString getDriverImplementationName();
104 :
105 0 : static bool getForceLoadTables() {return true;}
106 :
107 : // Added to enable me to use SQLInterpreter which requires an
108 : // XNameAccess i/f to access tables.
109 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL createCatalog();
110 :
111 : void throwSQLException( const ErrorDescriptor& _rError, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext );
112 : void throwSQLException( const sal_uInt16 _nErrorResourceId, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext );
113 : };
114 : }
115 : }
116 : #endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MORK_MCONNECTION_HXX
117 :
118 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|