merge the formfield patch from ooo-build
[ooovba.git] / connectivity / source / drivers / macab / MacabCatalog.cxx
blob17b8e014cf727fe4d42b8c4e059744f8f7764d1f
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: MacabCatalog.cxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_connectivity.hxx"
34 #include "MacabCatalog.hxx"
35 #include "MacabConnection.hxx"
36 #include "MacabTables.hxx"
38 using namespace connectivity::macab;
39 using namespace ::com::sun::star::uno;
40 using namespace ::com::sun::star::beans;
41 using namespace ::com::sun::star::sdbcx;
42 using namespace ::com::sun::star::sdbc;
43 using namespace ::com::sun::star::container;
44 using namespace ::com::sun::star::lang;
45 using namespace ::cppu;
47 // -------------------------------------------------------------------------
48 MacabCatalog::MacabCatalog(MacabConnection* _pCon)
49 : connectivity::sdbcx::OCatalog(_pCon),
50 m_pConnection(_pCon),
51 m_xMetaData(m_pConnection->getMetaData())
54 // -------------------------------------------------------------------------
55 void MacabCatalog::refreshTables()
57 TStringVector aVector;
58 Sequence< ::rtl::OUString > aTypes(1);
59 aTypes[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%"));
60 Reference< XResultSet > xResult = m_xMetaData->getTables(
61 Any(),
62 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("%")),
63 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("%")),
64 aTypes);
66 if (xResult.is())
68 Reference< XRow > xRow(xResult,UNO_QUERY);
69 ::rtl::OUString aName;
70 // const ::rtl::OUString& sDot = MacabCatalog::getDot();
72 while (xResult->next())
74 // aName = xRow->getString(2);
75 // aName += sDot;
76 aName = xRow->getString(3);
77 aVector.push_back(aName);
80 if (m_pTables)
81 m_pTables->reFill(aVector);
82 else
83 m_pTables = new MacabTables(m_xMetaData,*this,m_aMutex,aVector);
85 // -------------------------------------------------------------------------
86 void MacabCatalog::refreshViews()
89 // -------------------------------------------------------------------------
90 void MacabCatalog::refreshGroups()
93 // -------------------------------------------------------------------------
94 void MacabCatalog::refreshUsers()
97 // -------------------------------------------------------------------------
98 const ::rtl::OUString& MacabCatalog::getDot()
100 static const ::rtl::OUString sDot = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("."));
101 return sDot;
103 // -----------------------------------------------------------------------------
105 // XTablesSupplier
106 Reference< XNameAccess > SAL_CALL MacabCatalog::getTables( ) throw(RuntimeException)
108 ::osl::MutexGuard aGuard(m_aMutex);
109 checkDisposed(rBHelper.bDisposed);
113 if (!m_pTables)
114 refreshTables();
116 catch( const RuntimeException& )
118 // allowed to leave this method
119 throw;
121 catch( const Exception& )
123 // allowed
126 return m_pTables;