1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
20 #include <ado/ACatalog.hxx>
21 #include <ado/AConnection.hxx>
22 #include <ado/AGroups.hxx>
23 #include <ado/AUsers.hxx>
24 #include <ado/ATables.hxx>
25 #include <ado/AViews.hxx>
26 #include <com/sun/star/sdbc/XRow.hpp>
27 #include <com/sun/star/sdbc/XResultSet.hpp>
30 using namespace connectivity
;
31 using namespace connectivity::ado
;
33 OCatalog::OCatalog(_ADOCatalog
* _pCatalog
,OConnection
* _pCon
) : connectivity::sdbcx::OCatalog(_pCon
)
34 ,m_aCatalog(_pCatalog
)
41 if(m_aCatalog
.IsValid())
42 m_aCatalog
.putref_ActiveConnection(nullptr);
46 void OCatalog::refreshTables()
48 ::std::vector
< OUString
> aVector
;
50 WpADOTables
aTables(m_aCatalog
.get_Tables());
51 if ( aTables
.IsValid() )
54 sal_Int32 nCount
= aTables
.GetItemCount();
55 aVector
.reserve(nCount
);
56 for(sal_Int32 i
=0;i
< nCount
;++i
)
58 WpADOTable aElement
= aTables
.GetItem(i
);
59 if ( aElement
.IsValid() )
61 OUString sTypeName
= aElement
.get_Type();
62 if ( !sTypeName
.equalsIgnoreAsciiCase("SYSTEM TABLE")
63 && !sTypeName
.equalsIgnoreAsciiCase("ACCESS TABLE") )
64 aVector
.push_back(aElement
.get_Name());
70 m_pTables
->reFill(aVector
);
72 m_pTables
.reset( new OTables(this,m_aMutex
,aVector
,aTables
,m_pConnection
->getMetaData()->supportsMixedCaseQuotedIdentifiers()) );
75 void OCatalog::refreshViews()
77 ::std::vector
< OUString
> aVector
;
79 WpADOViews aViews
= m_aCatalog
.get_Views();
80 aViews
.fillElementNames(aVector
);
83 m_pViews
->reFill(aVector
);
85 m_pViews
.reset( new OViews(this,m_aMutex
,aVector
,aViews
,m_pConnection
->getMetaData()->supportsMixedCaseQuotedIdentifiers()) );
88 void OCatalog::refreshGroups()
90 ::std::vector
< OUString
> aVector
;
92 WpADOGroups aGroups
= m_aCatalog
.get_Groups();
93 aGroups
.fillElementNames(aVector
);
96 m_pGroups
->reFill(aVector
);
98 m_pGroups
.reset( new OGroups(this,m_aMutex
,aVector
,aGroups
,m_pConnection
->getMetaData()->supportsMixedCaseQuotedIdentifiers()) );
101 void OCatalog::refreshUsers()
103 ::std::vector
< OUString
> aVector
;
105 WpADOUsers aUsers
= m_aCatalog
.get_Users();
106 aUsers
.fillElementNames(aVector
);
109 m_pUsers
->reFill(aVector
);
111 m_pUsers
.reset( new OUsers(this,m_aMutex
,aVector
,aUsers
,m_pConnection
->getMetaData()->supportsMixedCaseQuotedIdentifiers()) );
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */