Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / connectivity / source / drivers / kab / KCatalog.cxx
blob818023d7ebb665204ef04255bc5659aeb05dc44b
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 .
21 #include "KCatalog.hxx"
22 #include "KConnection.hxx"
23 #include "KTables.hxx"
25 using namespace connectivity::kab;
26 using namespace ::com::sun::star::uno;
27 using namespace ::com::sun::star::beans;
28 using namespace ::com::sun::star::sdbcx;
29 using namespace ::com::sun::star::sdbc;
30 using namespace ::com::sun::star::container;
31 using namespace ::com::sun::star::lang;
32 using namespace ::cppu;
35 KabCatalog::KabCatalog(KabConnection* _pCon)
36 : connectivity::sdbcx::OCatalog(_pCon),
37 m_pConnection(_pCon),
38 m_xMetaData(m_pConnection->getMetaData())
42 void KabCatalog::refreshTables()
44 TStringVector aVector;
45 Sequence< OUString > aTypes(1);
46 aTypes[0] = "%";
47 Reference< XResultSet > xResult = m_xMetaData->getTables(
48 Any(),
49 OUString("%"),
50 OUString("%"),
51 aTypes);
53 if (xResult.is())
55 Reference< XRow > xRow(xResult,UNO_QUERY);
56 OUString aName;
58 while (xResult->next())
60 // aName = xRow->getString(2);
61 // aName += sDot;
62 aName = xRow->getString(3);
63 aVector.push_back(aName);
66 if (m_pTables)
67 m_pTables->reFill(aVector);
68 else
69 m_pTables = new KabTables(m_xMetaData,*this,m_aMutex,aVector);
72 void KabCatalog::refreshViews()
76 void KabCatalog::refreshGroups()
80 void KabCatalog::refreshUsers()
85 // XTablesSupplier
86 Reference< XNameAccess > SAL_CALL KabCatalog::getTables( ) throw(RuntimeException, std::exception)
88 ::osl::MutexGuard aGuard(m_aMutex);
89 checkDisposed(rBHelper.bDisposed);
91 try
93 if (!m_pTables)
94 refreshTables();
96 catch( const RuntimeException& )
98 // allowed to leave this method
99 throw;
101 catch( const Exception& )
103 // allowed
106 return m_pTables;
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */