Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / connectivity / source / drivers / mork / MConnection.hxx
bloba7d9c8528c748d79cfa256b1b4f3d8c7846029b3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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 */
10 #ifndef CONNECTIVITY_SCONNECTION_HXX
11 #define CONNECTIVITY_SCONNECTION_HXX
13 #include "connectivity/CommonTools.hxx"
15 #include "connectivity/OSubComponent.hxx"
16 #include "TConnection.hxx"
17 #include "MColumnAlias.hxx"
19 #include <com/sun/star/beans/PropertyValue.hpp>
20 #include <com/sun/star/sdbc/SQLWarning.hpp>
21 #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
23 #include <cppuhelper/weakref.hxx>
25 // do we want here namespace too?
26 class MorkParser;
28 namespace connectivity
30 namespace mork
32 class MorkDriver;
33 class ProfileAccess;
34 class ErrorDescriptor;
36 typedef connectivity::OMetaConnection OConnection_BASE; // implements basics and text encoding
38 class OConnection : public OConnection_BASE,
39 public connectivity::OSubComponent<OConnection, OConnection_BASE>
41 friend class connectivity::OSubComponent<OConnection, OConnection_BASE>;
43 protected:
45 // Data attributes
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;
60 public:
61 virtual 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();
65 MorkDriver* getDriver() {return m_pDriver;};
66 MorkParser* getMorkParser(const OString& t) {return t == "CollectedAddressBook" ? m_pHistory : m_pBook;};
67 void closeAllStatements () throw( ::com::sun::star::sdbc::SQLException);
69 // OComponentHelper
70 virtual void SAL_CALL disposing(void) SAL_OVERRIDE;
71 // XInterface
72 virtual void SAL_CALL release() throw() SAL_OVERRIDE;
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;
101 const OColumnAlias & getColumnAlias() const { return (m_aColumnAlias); }
103 static OUString getDriverImplementationName();
105 bool getForceLoadTables() {return true;}
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();
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 );
116 #endif // CONNECTIVITY_SCONNECTION_HXX
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */