1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include "ado/ACatalog.hxx"
30 #include "ado/AConnection.hxx"
31 #include "ado/AGroups.hxx"
32 #include "ado/AUsers.hxx"
33 #include "ado/ATables.hxx"
34 #include "ado/AViews.hxx"
35 #include <com/sun/star/sdbc/XRow.hpp>
36 #include <com/sun/star/sdbc/XResultSet.hpp>
39 // -------------------------------------------------------------------------
40 using namespace connectivity
;
41 using namespace connectivity::ado
;
42 // -------------------------------------------------------------------------
43 OCatalog::OCatalog(_ADOCatalog
* _pCatalog
,OConnection
* _pCon
) : connectivity::sdbcx::OCatalog(_pCon
)
44 ,m_aCatalog(_pCatalog
)
48 // -----------------------------------------------------------------------------
51 if(m_aCatalog
.IsValid())
52 m_aCatalog
.putref_ActiveConnection(NULL
);
55 // -----------------------------------------------------------------------------
56 void OCatalog::refreshTables()
58 TStringVector aVector
;
60 WpADOTables
aTables(m_aCatalog
.get_Tables());
61 if ( aTables
.IsValid() )
64 sal_Int32 nCount
= aTables
.GetItemCount();
65 aVector
.reserve(nCount
);
66 for(sal_Int32 i
=0;i
< nCount
;++i
)
68 WpADOTable aElement
= aTables
.GetItem(i
);
69 if ( aElement
.IsValid() )
71 ::rtl::OUString sTypeName
= aElement
.get_Type();
72 if ( !sTypeName
.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("SYSTEM TABLE"))
73 && !sTypeName
.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("ACCESS TABLE")) )
74 aVector
.push_back(aElement
.get_Name());
80 m_pTables
->reFill(aVector
);
82 m_pTables
= new OTables(this,m_aMutex
,aVector
,aTables
,m_pConnection
->getMetaData()->supportsMixedCaseQuotedIdentifiers());
84 // -------------------------------------------------------------------------
85 void OCatalog::refreshViews()
87 TStringVector aVector
;
89 WpADOViews aViews
= m_aCatalog
.get_Views();
90 aViews
.fillElementNames(aVector
);
93 m_pViews
->reFill(aVector
);
95 m_pViews
= new OViews(this,m_aMutex
,aVector
,aViews
,m_pConnection
->getMetaData()->supportsMixedCaseQuotedIdentifiers());
97 // -------------------------------------------------------------------------
98 void OCatalog::refreshGroups()
100 TStringVector aVector
;
102 WpADOGroups aGroups
= m_aCatalog
.get_Groups();
103 aGroups
.fillElementNames(aVector
);
106 m_pGroups
->reFill(aVector
);
108 m_pGroups
= new OGroups(this,m_aMutex
,aVector
,aGroups
,m_pConnection
->getMetaData()->supportsMixedCaseQuotedIdentifiers());
110 // -------------------------------------------------------------------------
111 void OCatalog::refreshUsers()
113 TStringVector aVector
;
115 WpADOUsers aUsers
= m_aCatalog
.get_Users();
116 aUsers
.fillElementNames(aVector
);
119 m_pUsers
->reFill(aVector
);
121 m_pUsers
= new OUsers(this,m_aMutex
,aVector
,aUsers
,m_pConnection
->getMetaData()->supportsMixedCaseQuotedIdentifiers());
123 // -------------------------------------------------------------------------
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */