1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
10 #ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MORK_MCONNECTION_HXX
11 #define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MORK_MCONNECTION_HXX
13 #include <TConnection.hxx>
14 #include "MColumnAlias.hxx"
16 #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
18 // do we want here namespace too?
21 namespace connectivity
26 class ErrorDescriptor
;
28 typedef connectivity::OMetaConnection OConnection_BASE
; // implements basics and text encoding
30 class OConnection final
: public OConnection_BASE
34 rtl::Reference
<MorkDriver
> m_xDriver
; // Pointer to the owning
36 OColumnAlias m_aColumnAlias
;
37 // Mork Parser (abook)
38 std::unique_ptr
<MorkParser
> m_pBook
;
39 // Mork Parser (history)
40 std::unique_ptr
<MorkParser
> m_pHistory
;
42 css::uno::Reference
< css::sdbcx::XTablesSupplier
> m_xCatalog
;
45 /// @throws css::sdbc::SQLException
46 void construct( const OUString
& url
);
47 explicit OConnection(MorkDriver
* const driver
);
48 virtual ~OConnection() override
;
50 const rtl::Reference
<MorkDriver
>& getDriver() {return m_xDriver
;};
51 MorkParser
* getMorkParser(const OString
& t
) {return t
== "CollectedAddressBook" ? m_pHistory
.get() : m_pBook
.get();};
54 virtual void SAL_CALL
disposing() override
;
57 DECLARE_SERVICE_INFO();
59 virtual css::uno::Reference
< css::sdbc::XStatement
> SAL_CALL
createStatement( ) override
;
60 virtual css::uno::Reference
< css::sdbc::XPreparedStatement
> SAL_CALL
prepareStatement( const OUString
& sql
) override
;
61 virtual css::uno::Reference
< css::sdbc::XPreparedStatement
> SAL_CALL
prepareCall( const OUString
& sql
) override
;
62 virtual OUString SAL_CALL
nativeSQL( const OUString
& sql
) override
;
63 virtual void SAL_CALL
setAutoCommit( sal_Bool autoCommit
) override
;
64 virtual sal_Bool SAL_CALL
getAutoCommit( ) override
;
65 virtual void SAL_CALL
commit( ) override
;
66 virtual void SAL_CALL
rollback( ) override
;
67 virtual sal_Bool SAL_CALL
isClosed( ) override
;
68 virtual css::uno::Reference
< css::sdbc::XDatabaseMetaData
> SAL_CALL
getMetaData( ) override
;
69 virtual void SAL_CALL
setReadOnly( sal_Bool readOnly
) override
;
70 virtual sal_Bool SAL_CALL
isReadOnly( ) override
;
71 virtual void SAL_CALL
setCatalog( const OUString
& catalog
) override
;
72 virtual OUString SAL_CALL
getCatalog( ) override
;
73 virtual void SAL_CALL
setTransactionIsolation( sal_Int32 level
) override
;
74 virtual sal_Int32 SAL_CALL
getTransactionIsolation( ) override
;
75 virtual css::uno::Reference
< css::container::XNameAccess
> SAL_CALL
getTypeMap( ) override
;
76 virtual void SAL_CALL
setTypeMap( const css::uno::Reference
< css::container::XNameAccess
>& typeMap
) override
;
78 virtual void SAL_CALL
close( ) override
;
80 virtual css::uno::Any SAL_CALL
getWarnings( ) override
;
81 virtual void SAL_CALL
clearWarnings() override
;
83 const OColumnAlias
& getColumnAlias() const { return m_aColumnAlias
; }
85 static bool getForceLoadTables() {return true;}
87 // Added to enable me to use SQLInterpreter which requires an
88 // XNameAccess i/f to access tables.
89 css::uno::Reference
< css::sdbcx::XTablesSupplier
> createCatalog();
91 void throwSQLException( const ErrorDescriptor
& _rError
, const css::uno::Reference
< css::uno::XInterface
>& _rxContext
);
92 void throwSQLException( const char* pErrorResourceId
, const css::uno::Reference
< css::uno::XInterface
>& _rxContext
);
96 #endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MORK_MCONNECTION_HXX
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */