bump product version to 7.2.5.1
[LibreOffice.git] / connectivity / inc / sdbcx / VCatalog.hxx
blob3c87a08700b6a556cb86f032dcc0504bedfa3a8a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
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>
26 #include <cppuhelper/compbase.hxx>
27 #include <com/sun/star/lang/XServiceInfo.hpp>
28 #include <connectivity/CommonTools.hxx>
29 #include <connectivity/sdbcx/IRefreshable.hxx>
30 #include <connectivity/dbtoolsdllapi.hxx>
31 #include <memory>
33 namespace com::sun::star::sdbc { class XConnection; }
34 namespace com::sun::star::sdbc { class XDatabaseMetaData; }
35 namespace com::sun::star::sdbc { class XResultSet; }
36 namespace com::sun::star::sdbc { class XRow; }
38 namespace connectivity::sdbcx
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
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;
53 class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE OCatalog :
54 public OCatalog_BASE,
55 public IRefreshableGroups,
56 public IRefreshableUsers
58 protected:
60 ::osl::Mutex m_aMutex;
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;
69 css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData; // just to make things easier
71 /** builds the name which should be used to access the object later on in the collection.
72 Will only be called in fillNames.
73 @param _xRow
74 The current row from the resultset given to fillNames.
76 virtual OUString buildName( const css::uno::Reference< css::sdbc::XRow >& _xRow);
78 /** fills a vector with the necessary names which can be used in combination with the collections.
79 For each row buildName will be called.
80 @param _xResult
81 The resultset which should be used to fill the names. Will be disposed after return and set to NULL.
82 @param _rNames
83 The vector who will be filled.
85 void fillNames(css::uno::Reference< css::sdbc::XResultSet >& _xResult,::std::vector< OUString>& _rNames);
87 public:
88 OCatalog(const css::uno::Reference< css::sdbc::XConnection> &_xConnection);
89 virtual ~OCatalog() override;
91 DECLARE_SERVICE_INFO();
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;
99 // the other refresh methods come from base classes IRefreshableGroups and IRefreshableUsers
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;
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */