1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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 .
22 #include "Connection.hxx"
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
26 #include <com/sun/star/sdbc/XDriver.hpp>
27 #include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp>
28 #include <cppuhelper/compbase.hxx>
29 #include <unotools/tempfile.hxx>
31 namespace connectivity::firebird
33 // The SQL dialect in use
34 // Has to be used in various isc_* calls.
35 // 3: Is IB6 -- minimum required for delimited identifiers.
36 const int FIREBIRD_SQL_DIALECT
= 3;
38 typedef ::cppu::WeakComponentImplHelper
< css::sdbc::XDriver
,
39 css::sdbcx::XDataDefinitionSupplier
,
40 css::lang::XServiceInfo
> ODriver_BASE
;
42 class FirebirdDriver
: public ODriver_BASE
45 css::uno::Reference
<css::uno::XComponentContext
> m_aContext
;
46 ::utl::TempFile m_firebirdTMPDirectory
;
47 ::utl::TempFile m_firebirdLockDirectory
;
50 ::osl::Mutex m_aMutex
; // mutex is need to control member access
51 OWeakRefArray m_xConnections
; // vector containing a list
52 // of all the Connection objects
57 explicit FirebirdDriver(const css::uno::Reference
< css::uno::XComponentContext
>& _rxContext
);
58 virtual ~FirebirdDriver() override
;
59 const css::uno::Reference
<css::uno::XComponentContext
>& getContext() const { return m_aContext
; }
62 virtual void SAL_CALL
disposing() override
;
65 virtual OUString SAL_CALL
getImplementationName( ) override
;
66 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
67 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) override
;
70 virtual css::uno::Reference
< css::sdbc::XConnection
> SAL_CALL
connect( const OUString
& url
, const css::uno::Sequence
< css::beans::PropertyValue
>& info
) override
;
71 virtual sal_Bool SAL_CALL
acceptsURL( const OUString
& url
) override
;
72 virtual css::uno::Sequence
< css::sdbc::DriverPropertyInfo
> SAL_CALL
getPropertyInfo( const OUString
& url
, const css::uno::Sequence
< css::beans::PropertyValue
>& info
) override
;
73 virtual sal_Int32 SAL_CALL
getMajorVersion( ) override
;
74 virtual sal_Int32 SAL_CALL
getMinorVersion( ) override
;
76 // XDataDefinitionSupplier
77 virtual css::uno::Reference
< css::sdbcx::XTablesSupplier
>
78 SAL_CALL
getDataDefinitionByConnection(
79 const css::uno::Reference
< css::sdbc::XConnection
>& rxConnection
) override
;
80 virtual css::uno::Reference
< css::sdbcx::XTablesSupplier
>
81 SAL_CALL
getDataDefinitionByURL(
82 const OUString
& rsURL
,
83 const css::uno::Sequence
< css::beans::PropertyValue
>& rInfo
) override
;
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */