update dev300-m58
[ooovba.git] / connectivity / source / drivers / ado / ACatalog.cxx
blob7c01de373274a8bec2d5f7751c6303d79bc3100a
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: ACatalog.cxx,v $
10 * $Revision: 1.13 $
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"
33 #include "ado/ACatalog.hxx"
34 #ifndef _CONNECTIVITY_ADO_BCONNECTION_HXX_
35 #include "ado/AConnection.hxx"
36 #endif
37 #include "ado/AGroups.hxx"
38 #include "ado/AUsers.hxx"
39 #include "ado/ATables.hxx"
40 #include "ado/AViews.hxx"
41 #include <com/sun/star/sdbc/XRow.hpp>
42 #include <com/sun/star/sdbc/XResultSet.hpp>
45 // -------------------------------------------------------------------------
46 using namespace connectivity;
47 using namespace connectivity::ado;
48 // -------------------------------------------------------------------------
49 OCatalog::OCatalog(_ADOCatalog* _pCatalog,OConnection* _pCon) : connectivity::sdbcx::OCatalog(_pCon)
50 ,m_pConnection(_pCon)
51 ,m_aCatalog(_pCatalog)
54 // -----------------------------------------------------------------------------
55 OCatalog::~OCatalog()
57 if(m_aCatalog.IsValid())
58 m_aCatalog.putref_ActiveConnection(NULL);
59 m_aCatalog.clear();
61 // -----------------------------------------------------------------------------
62 void OCatalog::refreshTables()
64 TStringVector aVector;
66 WpADOTables aTables(m_aCatalog.get_Tables());
67 if ( aTables.IsValid() )
69 aTables.Refresh();
70 sal_Int32 nCount = aTables.GetItemCount();
71 aVector.reserve(nCount);
72 for(sal_Int32 i=0;i< nCount;++i)
74 WpADOTable aElement = aTables.GetItem(i);
75 if ( aElement.IsValid() )
77 ::rtl::OUString sTypeName = aElement.get_Type();
78 if ( !sTypeName.equalsIgnoreAsciiCaseAscii("SYSTEM TABLE") && !sTypeName.equalsIgnoreAsciiCaseAscii("ACCESS TABLE") )
79 aVector.push_back(aElement.get_Name());
84 if(m_pTables)
85 m_pTables->reFill(aVector);
86 else
87 m_pTables = new OTables(this,m_aMutex,aVector,aTables,m_pConnection->getMetaData()->storesMixedCaseQuotedIdentifiers());
89 // -------------------------------------------------------------------------
90 void OCatalog::refreshViews()
92 TStringVector aVector;
94 WpADOViews aViews = m_aCatalog.get_Views();
95 aViews.fillElementNames(aVector);
97 if(m_pViews)
98 m_pViews->reFill(aVector);
99 else
100 m_pViews = new OViews(this,m_aMutex,aVector,aViews,m_pConnection->getMetaData()->storesMixedCaseQuotedIdentifiers());
102 // -------------------------------------------------------------------------
103 void OCatalog::refreshGroups()
105 TStringVector aVector;
107 WpADOGroups aGroups = m_aCatalog.get_Groups();
108 aGroups.fillElementNames(aVector);
110 if(m_pGroups)
111 m_pGroups->reFill(aVector);
112 else
113 m_pGroups = new OGroups(this,m_aMutex,aVector,aGroups,m_pConnection->getMetaData()->storesMixedCaseQuotedIdentifiers());
115 // -------------------------------------------------------------------------
116 void OCatalog::refreshUsers()
118 TStringVector aVector;
120 WpADOUsers aUsers = m_aCatalog.get_Users();
121 aUsers.fillElementNames(aVector);
123 if(m_pUsers)
124 m_pUsers->reFill(aVector);
125 else
126 m_pUsers = new OUsers(this,m_aMutex,aVector,aUsers,m_pConnection->getMetaData()->storesMixedCaseQuotedIdentifiers());
128 // -------------------------------------------------------------------------