LibreOffice Module connectivity (master) 1
FCatalog.cxx
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#include <file/FCatalog.hxx>
21#include <file/FConnection.hxx>
22#include <file/FTables.hxx>
23#include <com/sun/star/sdbc/XRow.hpp>
24#include <com/sun/star/sdbc/XResultSet.hpp>
25
26using namespace ::com::sun::star::uno;
27using namespace ::com::sun::star::beans;
28using namespace ::com::sun::star::sdbcx;
29using namespace ::com::sun::star::sdbc;
30using namespace ::com::sun::star::container;
31
32
33using namespace connectivity::file;
34
35OFileCatalog::OFileCatalog(OConnection* _pCon) : connectivity::sdbcx::OCatalog(_pCon)
36 ,m_pConnection(_pCon)
37{
38}
39
41{
42 ::osl::MutexGuard aGuard(m_aMutex);
43
44 typedef connectivity::sdbcx::OCatalog OFileCatalog_BASE;
45 m_xMetaData.clear();
46 OFileCatalog_BASE::disposing();
47}
48
50{
51 return _xRow->getString(3);
52}
53
55{
56 ::std::vector< OUString> aVector;
58 Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),
59 "%", "%", aTypes);
60 fillNames(xResult,aVector);
61
62 if(m_pTables)
63 m_pTables->reFill(aVector);
64 else
65 m_pTables.reset( new OTables(m_xMetaData,*this,m_aMutex,aVector) );
66}
67
68
69Any SAL_CALL OFileCatalog::queryInterface( const Type & rType )
70{
74 return Any();
75
76
77 typedef sdbcx::OCatalog OFileCatalog_BASE;
78 return OFileCatalog_BASE::queryInterface(rType);
79}
80
82{
83 typedef sdbcx::OCatalog OFileCatalog_BASE;
84
85 Sequence< Type > aTypes = OFileCatalog_BASE::getTypes();
86 std::vector<Type> aOwnTypes;
87 aOwnTypes.reserve(aTypes.getLength());
88 const Type* pBegin = aTypes.getConstArray();
89 const Type* pEnd = pBegin + aTypes.getLength();
90 for(;pBegin != pEnd;++pBegin)
91 {
92 if(!(*pBegin == cppu::UnoType<XGroupsSupplier>::get()||
95 {
96 aOwnTypes.push_back(*pBegin);
97 }
98 }
99 return Sequence< Type >(aOwnTypes.data(), aOwnTypes.size());
100}
101
102
103/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: FCatalog.cxx:81
virtual void SAL_CALL disposing() override
Definition: FCatalog.cxx:40
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Definition: FCatalog.cxx:69
virtual OUString buildName(const css::uno::Reference< css::sdbc::XRow > &_xRow) override
builds the name which should be used to access the object later on in the collection.
Definition: FCatalog.cxx:49
virtual void refreshTables() override
Definition: FCatalog.cxx:54
void fillNames(css::uno::Reference< css::sdbc::XResultSet > &_xResult,::std::vector< OUString > &_rNames)
fills a vector with the necessary names which can be used in combination with the collections.
Definition: VCatalog.cxx:185
css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData
Definition: VCatalog.hxx:69
std::unique_ptr< OCollection > m_pTables
Definition: VCatalog.hxx:64
Type
const SvXMLTokenMapEntry aTypes[]