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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_DRIVER_HXX
21 #define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_DRIVER_HXX
23 #include "Connection.hxx"
25 #include <com/sun/star/lang/XServiceInfo.hpp>
26 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
27 #include <com/sun/star/sdbc/XDriver.hpp>
28 #include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp>
29 #include <cppuhelper/compbase.hxx>
30 #include <unotools/tempfile.hxx>
32 namespace connectivity
36 // The SQL dialect in use
37 // Has to be used in various isc_* calls.
38 // 3: Is IB6 -- minimum required for delimited identifiers.
39 static const int FIREBIRD_SQL_DIALECT
= 3;
41 css::uno::Reference
< css::uno::XInterface
> SAL_CALL
FirebirdDriver_CreateInstance(const css::uno::Reference
< css::lang::XMultiServiceFactory
>& _rxFactory
) throw( css::uno::Exception
, std::exception
);
43 typedef ::cppu::WeakComponentImplHelper
< css::sdbc::XDriver
,
44 css::sdbcx::XDataDefinitionSupplier
,
45 css::lang::XServiceInfo
> ODriver_BASE
;
47 class FirebirdDriver
: public ODriver_BASE
50 css::uno::Reference
<css::uno::XComponentContext
> m_aContext
;
51 ::utl::TempFile m_firebirdTMPDirectory
;
52 ::utl::TempFile m_firebirdLockDirectory
;
55 ::osl::Mutex m_aMutex
; // mutex is need to control member access
56 OWeakRefArray m_xConnections
; // vector containing a list
57 // of all the Connection objects
62 explicit FirebirdDriver(const css::uno::Reference
< css::uno::XComponentContext
>& _rxContext
);
63 virtual ~FirebirdDriver() override
;
64 const css::uno::Reference
<css::uno::XComponentContext
>& getContext() const { return m_aContext
; }
67 virtual void SAL_CALL
disposing() override
;
69 static ::rtl::OUString
getImplementationName_Static( ) throw(css::uno::RuntimeException
);
70 static css::uno::Sequence
< ::rtl::OUString
> getSupportedServiceNames_Static( ) throw (css::uno::RuntimeException
);
73 virtual ::rtl::OUString SAL_CALL
getImplementationName( ) throw(css::uno::RuntimeException
, std::exception
) override
;
74 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
) throw(css::uno::RuntimeException
, std::exception
) override
;
75 virtual css::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames( ) throw(css::uno::RuntimeException
, std::exception
) override
;
78 virtual css::uno::Reference
< css::sdbc::XConnection
> SAL_CALL
connect( const ::rtl::OUString
& url
, const css::uno::Sequence
< css::beans::PropertyValue
>& info
) throw(css::sdbc::SQLException
, css::uno::RuntimeException
, std::exception
) override
;
79 virtual sal_Bool SAL_CALL
acceptsURL( const ::rtl::OUString
& url
) throw(css::sdbc::SQLException
, css::uno::RuntimeException
, std::exception
) override
;
80 virtual css::uno::Sequence
< css::sdbc::DriverPropertyInfo
> SAL_CALL
getPropertyInfo( const ::rtl::OUString
& url
, const css::uno::Sequence
< css::beans::PropertyValue
>& info
) throw(css::sdbc::SQLException
, css::uno::RuntimeException
, std::exception
) override
;
81 virtual sal_Int32 SAL_CALL
getMajorVersion( ) throw(css::uno::RuntimeException
, std::exception
) override
;
82 virtual sal_Int32 SAL_CALL
getMinorVersion( ) throw(css::uno::RuntimeException
, std::exception
) override
;
84 // XDataDefinitionSupplier
85 virtual css::uno::Reference
< css::sdbcx::XTablesSupplier
>
86 SAL_CALL
getDataDefinitionByConnection(
87 const css::uno::Reference
< css::sdbc::XConnection
>& rxConnection
)
88 throw(css::sdbc::SQLException
,
89 css::uno::RuntimeException
, std::exception
) override
;
90 virtual css::uno::Reference
< css::sdbcx::XTablesSupplier
>
91 SAL_CALL
getDataDefinitionByURL(
92 const OUString
& rsURL
,
93 const css::uno::Sequence
< css::beans::PropertyValue
>& rInfo
)
94 throw(css::sdbc::SQLException
,
95 css::uno::RuntimeException
, std::exception
) override
;
101 #endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_DRIVER_HXX
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */