LibreOffice Module connectivity (master) 1
YDriver.hxx
Go to the documentation of this file.
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#pragma once
20
21#include <sal/config.h>
22
23#include <map>
24
25#include <com/sun/star/sdbc/XDriver.hpp>
26#include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp>
27#include <com/sun/star/lang/XServiceInfo.hpp>
28#include <com/sun/star/uno/XComponentContext.hpp>
32
33
34namespace connectivity
35{
36
37
38 class OMetaConnection;
39
40 namespace mysql
41 {
42 typedef ::cppu::WeakComponentImplHelper< css::sdbc::XDriver
43 , css::sdbcx::XDataDefinitionSupplier
44 , css::lang::XServiceInfo
46
47 typedef std::pair< css::uno::WeakReferenceHelper,OMetaConnection*> TWeakConnectionPair;
48 typedef std::pair< css::uno::WeakReferenceHelper,TWeakConnectionPair> TWeakPair;
49 typedef std::vector< TWeakPair > TWeakPairVector;
50 typedef std::map< OUString, css::uno::Reference< css::sdbc::XDriver > > TJDBCDrivers;
51
57 {
58 TJDBCDrivers m_aJdbcDrivers; // all jdbc drivers
59 TWeakPairVector m_aConnections; // vector containing a list
60 // of all the Connection objects
61 // for this Driver
62 css::uno::Reference< css::sdbc::XDriver > m_xODBCDriver;
63 css::uno::Reference< css::sdbc::XDriver > m_xNativeDriver;
64 css::uno::Reference< css::uno::XComponentContext > m_xContext;
65
75 css::uno::Reference< css::sdbc::XDriver > loadDriver( std::u16string_view url, const css::uno::Sequence< css::beans::PropertyValue >& info );
76
77 public:
80 ODriverDelegator(const css::uno::Reference< css::uno::XComponentContext >& _rxContext);
81
82 // XServiceInfo
84
85 // XDriver
86 virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL connect( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override;
87 virtual sal_Bool SAL_CALL acceptsURL( const OUString& url ) override;
88 virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override;
89 virtual sal_Int32 SAL_CALL getMajorVersion( ) override;
90 virtual sal_Int32 SAL_CALL getMinorVersion( ) override;
91
92 // XDataDefinitionSupplier
93 virtual css::uno::Reference< css::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByConnection( const css::uno::Reference< css::sdbc::XConnection >& connection ) override;
94 virtual css::uno::Reference< css::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByURL( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override;
95 protected:
97 virtual ~ODriverDelegator() override;
98 // OComponentHelper
99 virtual void SAL_CALL disposing() override;
100 };
101 }
102
103
104} // namespace connectivity
105
106/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
delegates all calls to the original driver and extend the existing one with the SDBCX layer.
Definition: YDriver.hxx:57
ODriverDelegator(const css::uno::Reference< css::uno::XComponentContext > &_rxContext)
creates a new delegator for a mysql driver
virtual css::uno::Reference< css::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByConnection(const css::uno::Reference< css::sdbc::XConnection > &connection) override
css::uno::Reference< css::sdbc::XDriver > loadDriver(std::u16string_view url, const css::uno::Sequence< css::beans::PropertyValue > &info)
load the driver we want to delegate.
virtual ~ODriverDelegator() override
dtor
virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL connect(const OUString &url, const css::uno::Sequence< css::beans::PropertyValue > &info) override
css::uno::Reference< css::sdbc::XDriver > m_xODBCDriver
Definition: YDriver.hxx:62
css::uno::Reference< css::sdbc::XDriver > m_xNativeDriver
Definition: YDriver.hxx:63
virtual sal_Int32 SAL_CALL getMinorVersion() override
css::uno::Reference< css::uno::XComponentContext > m_xContext
Definition: YDriver.hxx:64
virtual css::uno::Reference< css::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByURL(const OUString &url, const css::uno::Sequence< css::beans::PropertyValue > &info) override
virtual sal_Int32 SAL_CALL getMajorVersion() override
virtual void SAL_CALL disposing() override
virtual sal_Bool SAL_CALL acceptsURL(const OUString &url) override
virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo(const OUString &url, const css::uno::Sequence< css::beans::PropertyValue > &info) override
std::pair< css::uno::WeakReferenceHelper, TWeakConnectionPair > TWeakPair
Definition: YDriver.hxx:48
::cppu::WeakComponentImplHelper< css::sdbc::XDriver, css::sdbcx::XDataDefinitionSupplier, css::lang::XServiceInfo > ODriverDelegator_BASE
Definition: YDriver.hxx:45
std::vector< TWeakPair > TWeakPairVector
Definition: YDriver.hxx:49
std::map< OUString, css::uno::Reference< css::sdbc::XDriver > > TJDBCDrivers
Definition: YDriver.hxx:50
std::pair< css::uno::WeakReferenceHelper, OMetaConnection * > TWeakConnectionPair
Definition: YDriver.hxx:47
unsigned char sal_Bool