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 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_DRIVER_HXX
21 : #define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_DRIVER_HXX
22 :
23 : #include "Connection.hxx"
24 :
25 : #include <com/sun/star/lang/XServiceInfo.hpp>
26 : #include <com/sun/star/sdbc/XDriver.hpp>
27 : #include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp>
28 : #include <cppuhelper/compbase3.hxx>
29 : #include <unotools/tempfile.hxx>
30 :
31 : namespace connectivity
32 : {
33 : namespace firebird
34 : {
35 : // The SQL dialect in use
36 : // Has to be used in various isc_* calls.
37 : // 3: Is IB6 -- minimum required for delimited identifiers.
38 : static const int FIREBIRD_SQL_DIALECT = 3;
39 :
40 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL FirebirdDriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception );
41 :
42 : typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::sdbc::XDriver,
43 : ::com::sun::star::sdbcx::XDataDefinitionSupplier,
44 : ::com::sun::star::lang::XServiceInfo > ODriver_BASE;
45 :
46 : class FirebirdDriver : public ODriver_BASE
47 : {
48 : private:
49 : static const ::rtl::OUString our_sFirebirdTmpVar;
50 : static const ::rtl::OUString our_sFirebirdLockVar;
51 : static const ::rtl::OUString our_sFirebirdMsgVar;
52 :
53 : css::uno::Reference<css::uno::XComponentContext> m_aContext;
54 : ::utl::TempFile m_firebirdTMPDirectory;
55 : ::utl::TempFile m_firebirdLockDirectory;
56 :
57 : protected:
58 : ::osl::Mutex m_aMutex; // mutex is need to control member access
59 : OWeakRefArray m_xConnections; // vector containing a list
60 : // of all the Connection objects
61 : // for this Driver
62 :
63 : public:
64 :
65 : FirebirdDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext);
66 : virtual ~FirebirdDriver();
67 0 : const css::uno::Reference<css::uno::XComponentContext>& getContext() const { return m_aContext; }
68 :
69 : // OComponentHelper
70 : virtual void SAL_CALL disposing(void) SAL_OVERRIDE;
71 : // XInterface
72 : static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException);
73 : static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException);
74 :
75 : // XServiceInfo
76 : virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
77 : virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
78 : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
79 :
80 : // XDriver
81 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
82 : virtual sal_Bool SAL_CALL acceptsURL( const ::rtl::OUString& url ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
83 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
84 : virtual sal_Int32 SAL_CALL getMajorVersion( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
85 : virtual sal_Int32 SAL_CALL getMinorVersion( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
86 :
87 : // XDataDefinitionSupplier
88 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier >
89 : SAL_CALL getDataDefinitionByConnection(
90 : const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& rxConnection)
91 : throw(::com::sun::star::sdbc::SQLException,
92 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
93 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier >
94 : SAL_CALL getDataDefinitionByURL(
95 : const OUString& rsURL,
96 : const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rInfo)
97 : throw(::com::sun::star::sdbc::SQLException,
98 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
99 : };
100 : }
101 :
102 : }
103 :
104 : #endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_DRIVER_HXX
105 :
106 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|