LibreOffice Module connectivity (master) 1
VCatalog.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
20#pragma once
21
22#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
23#include <com/sun/star/sdbcx/XViewsSupplier.hpp>
24#include <com/sun/star/sdbcx/XUsersSupplier.hpp>
25#include <com/sun/star/sdbcx/XGroupsSupplier.hpp>
27#include <com/sun/star/lang/XServiceInfo.hpp>
31#include <memory>
32
33namespace com::sun::star::sdbc { class XConnection; }
34namespace com::sun::star::sdbc { class XDatabaseMetaData; }
35namespace com::sun::star::sdbc { class XResultSet; }
36namespace com::sun::star::sdbc { class XRow; }
37
38namespace connectivity::sdbcx
39 {
40
41 class OCollection;
42 // OCatalog is a general catalog class
43 // other drivers can be derived their catalog from this class when they want to support sdbcx
44 // it holds already tables, views, groups and users
45
46 typedef ::cppu::WeakComponentImplHelper< css::sdbcx::XTablesSupplier,
47 css::sdbcx::XViewsSupplier,
48 css::sdbcx::XUsersSupplier,
49 css::sdbcx::XGroupsSupplier,
50 css::lang::XServiceInfo> OCatalog_BASE;
51
52
54 public OCatalog_BASE,
55 public IRefreshableGroups,
57 {
58 protected:
59
60 ::osl::Mutex m_aMutex;
61
62 // this members are deleted when the dtor is called
63 // they are hold weak
64 std::unique_ptr<OCollection> m_pTables;
65 std::unique_ptr<OCollection> m_pViews;
66 std::unique_ptr<OCollection> m_pGroups;
67 std::unique_ptr<OCollection> m_pUsers;
68
69 css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData; // just to make things easier
70
76 virtual OUString buildName( const css::uno::Reference< css::sdbc::XRow >& _xRow);
77
85 void fillNames(css::uno::Reference< css::sdbc::XResultSet >& _xResult,::std::vector< OUString>& _rNames);
86
87 public:
88 OCatalog(const css::uno::Reference< css::sdbc::XConnection> &_xConnection);
89 virtual ~OCatalog() override;
90
92
93 // refreshTables is called when the method getTables had been called
94 // the member m_pTables has to be created
95 virtual void refreshTables() = 0;
96 // refreshViews is called when the method getViews had been called
97 virtual void refreshViews() = 0;
98
99 // the other refresh methods come from base classes IRefreshableGroups and IRefreshableUsers
100
101 // ::cppu::OComponentHelper
102 virtual void SAL_CALL disposing() override;
103 // XTablesSupplier
104 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTables( ) override;
105 // XViewsSupplier
106 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getViews( ) override;
107 // XUsersSupplier
108 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getUsers( ) override;
109 // XGroupsSupplier
110 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getGroups( ) override;
111
112 };
113
114}
115
116/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData
Definition: VCatalog.hxx:69
std::unique_ptr< OCollection > m_pTables
Definition: VCatalog.hxx:64
std::unique_ptr< OCollection > m_pGroups
Definition: VCatalog.hxx:66
virtual void refreshTables()=0
OCatalog(const css::uno::Reference< css::sdbc::XConnection > &_xConnection)
std::unique_ptr< OCollection > m_pViews
Definition: VCatalog.hxx:65
virtual void refreshViews()=0
std::unique_ptr< OCollection > m_pUsers
Definition: VCatalog.hxx:67
#define OOO_DLLPUBLIC_DBTOOLS
::cppu::WeakComponentImplHelper< css::sdbcx::XTablesSupplier, css::sdbcx::XViewsSupplier, css::sdbcx::XUsersSupplier, css::sdbcx::XGroupsSupplier, css::lang::XServiceInfo > OCatalog_BASE
Definition: VCatalog.hxx:41
#define SAL_NO_VTABLE