LibreOffice Module connectivity (master) 1
MacabCatalog.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
21#include "MacabCatalog.hxx"
22#include "MacabConnection.hxx"
23#include "MacabTables.hxx"
24#include <com/sun/star/sdbc/XRow.hpp>
25
26using namespace connectivity::macab;
27using namespace ::com::sun::star::uno;
28using namespace ::com::sun::star::beans;
29using namespace ::com::sun::star::sdbcx;
30using namespace ::com::sun::star::sdbc;
31using namespace ::com::sun::star::container;
32using namespace ::com::sun::star::lang;
33using namespace ::cppu;
34
35
36MacabCatalog::MacabCatalog(MacabConnection* _pCon)
37 : connectivity::sdbcx::OCatalog(_pCon),
38 m_pConnection(_pCon)
39{
40}
41
43{
44 ::std::vector< OUString> aVector;
45 Sequence< OUString > aTypes { "%" };
46 Reference< XResultSet > xResult = m_xMetaData->getTables(
47 Any(), "%", "%", aTypes);
48
49 if (xResult.is())
50 {
51 Reference< XRow > xRow(xResult,UNO_QUERY);
52 OUString aName;
53 // const OUString& sDot = MacabCatalog::getDot();
54
55 while (xResult->next())
56 {
57 // aName = xRow->getString(2);
58 // aName += sDot;
59 aName = xRow->getString(3);
60 aVector.push_back(aName);
61 }
62 }
63 if (m_pTables)
64 m_pTables->reFill(aVector);
65 else
66 m_pTables.reset( new MacabTables(m_xMetaData,*this,m_aMutex,aVector) );
67}
68
70{
71}
72
74{
75}
76
78{
79}
80
81const OUString& MacabCatalog::getDot()
82{
83 static const OUString sDot = ".";
84 return sDot;
85}
86
87
88// XTablesSupplier
89Reference< XNameAccess > SAL_CALL MacabCatalog::getTables( )
90{
91 ::osl::MutexGuard aGuard(m_aMutex);
92 checkDisposed(rBHelper.bDisposed);
93
94 try
95 {
96 if (!m_pTables)
98 }
99 catch( const RuntimeException& )
100 {
101 // allowed to leave this method
102 throw;
103 }
104 catch( const Exception& )
105 {
106 // allowed
107 }
108
109 return m_pTables.get();
110}
111
112/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void refreshTables() override
virtual void refreshGroups() override
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTables() override
virtual void refreshViews() override
virtual void refreshUsers() override
static const OUString & getDot()
css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData
Definition: VCatalog.hxx:69
std::unique_ptr< OCollection > m_pTables
Definition: VCatalog.hxx:64
OUString aName
@ Exception
void checkDisposed(bool _bThrow)
Definition: dbtools.cxx:1951
const SvXMLTokenMapEntry aTypes[]