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 CONNECTIVITY_SCONNECTION_HXX
11 : #define CONNECTIVITY_SCONNECTION_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 : #include <memory>
26 :
27 : // do we want here namespace too?
28 : class MorkParser;
29 :
30 : namespace connectivity
31 : {
32 : namespace mork
33 : {
34 : class MorkDriver;
35 : class ProfileAccess;
36 : class ErrorDescriptor;
37 :
38 : typedef connectivity::OMetaConnection OConnection_BASE; // implements basics and text encoding
39 :
40 : class OConnection : public OConnection_BASE,
41 : public connectivity::OSubComponent<OConnection, OConnection_BASE>
42 : {
43 : friend class connectivity::OSubComponent<OConnection, OConnection_BASE>;
44 :
45 : protected:
46 : //====================================================================
47 : // Data attributes
48 : //====================================================================
49 : ::com::sun::star::sdbc::SQLWarning m_aLastWarning;
50 : MorkDriver* m_pDriver; // Pointer to the owning
51 : // driver object
52 : OColumnAlias m_aColumnAlias;
53 : // Profile Access
54 : ProfileAccess* m_pProfileAccess;
55 : // Mork Parser
56 : MorkParser* m_pMork;
57 : // Store Catalog
58 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier> m_xCatalog;
59 :
60 : public:
61 : virtual void construct( const ::rtl::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 476 : MorkParser* getMorkParser() {return m_pMork;};
67 : void closeAllStatements () throw( ::com::sun::star::sdbc::SQLException);
68 :
69 : // OComponentHelper
70 : virtual void SAL_CALL disposing(void);
71 : // XInterface
72 : virtual void SAL_CALL release() throw();
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);
78 : 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);
79 : 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);
80 : virtual ::rtl::OUString SAL_CALL nativeSQL( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
81 : virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
82 : virtual sal_Bool SAL_CALL getAutoCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
83 : virtual void SAL_CALL commit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
84 : virtual void SAL_CALL rollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
85 : virtual sal_Bool SAL_CALL isClosed( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
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);
87 : virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
88 : virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
89 : virtual void SAL_CALL setCatalog( const ::rtl::OUString& catalog ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
90 : virtual ::rtl::OUString SAL_CALL getCatalog( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
91 : virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
92 : virtual sal_Int32 SAL_CALL getTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
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);
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);
95 : // XCloseable
96 : virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
97 : // XWarningsSupplier
98 : virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
99 : virtual void SAL_CALL clearWarnings() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
100 :
101 78 : const OColumnAlias & getColumnAlias() const { return (m_aColumnAlias); }
102 :
103 : static ::rtl::OUString getDriverImplementationName();
104 :
105 0 : sal_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 // CONNECTIVITY_SCONNECTION_HXX
117 :
118 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|