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/sdbc/XDriver.hpp>
27 #include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp>
28 #include <cppuhelper/compbase3.hxx>
29 #include <unotools/tempfile.hxx>
31 namespace connectivity
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;
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
);
42 typedef ::cppu::WeakComponentImplHelper3
< ::com::sun::star::sdbc::XDriver
,
43 ::com::sun::star::sdbcx::XDataDefinitionSupplier
,
44 ::com::sun::star::lang::XServiceInfo
> ODriver_BASE
;
46 class FirebirdDriver
: public ODriver_BASE
49 static const ::rtl::OUString our_sFirebirdTmpVar
;
50 static const ::rtl::OUString our_sFirebirdLockVar
;
51 static const ::rtl::OUString our_sFirebirdMsgVar
;
53 css::uno::Reference
<css::uno::XComponentContext
> m_aContext
;
54 ::utl::TempFile m_firebirdTMPDirectory
;
55 ::utl::TempFile m_firebirdLockDirectory
;
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
65 FirebirdDriver(const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& _rxContext
);
66 const css::uno::Reference
<css::uno::XComponentContext
>& getContext() const { return m_aContext
; }
69 virtual void SAL_CALL
disposing(void) SAL_OVERRIDE
;
71 static ::rtl::OUString
getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException
);
72 static ::com::sun::star::uno::Sequence
< ::rtl::OUString
> getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException
);
75 virtual ::rtl::OUString SAL_CALL
getImplementationName( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
76 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
77 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
80 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
;
81 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
;
82 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
;
83 virtual sal_Int32 SAL_CALL
getMajorVersion( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
84 virtual sal_Int32 SAL_CALL
getMinorVersion( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
86 // XDataDefinitionSupplier
87 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::sdbcx::XTablesSupplier
>
88 SAL_CALL
getDataDefinitionByConnection(
89 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>& rxConnection
)
90 throw(::com::sun::star::sdbc::SQLException
,
91 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
92 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::sdbcx::XTablesSupplier
>
93 SAL_CALL
getDataDefinitionByURL(
94 const OUString
& rsURL
,
95 const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& rInfo
)
96 throw(::com::sun::star::sdbc::SQLException
,
97 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
103 #endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_DRIVER_HXX
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */