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 // -------------------------------------------------------------------------
31 using namespace connectivity
;
32 using namespace connectivity::ado
;
33 // -------------------------------------------------------------------------
34 OCatalog::OCatalog(_ADOCatalog
* _pCatalog
,OConnection
* _pCon
) : connectivity::sdbcx::OCatalog(_pCon
)
35 ,m_aCatalog(_pCatalog
)
39 // -----------------------------------------------------------------------------
42 if(m_aCatalog
.IsValid())
43 m_aCatalog
.putref_ActiveConnection(NULL
);
46 // -----------------------------------------------------------------------------
47 void OCatalog::refreshTables()
49 TStringVector aVector
;
51 WpADOTables
aTables(m_aCatalog
.get_Tables());
52 if ( aTables
.IsValid() )
55 sal_Int32 nCount
= aTables
.GetItemCount();
56 aVector
.reserve(nCount
);
57 for(sal_Int32 i
=0;i
< nCount
;++i
)
59 WpADOTable aElement
= aTables
.GetItem(i
);
60 if ( aElement
.IsValid() )
62 OUString sTypeName
= aElement
.get_Type();
63 if ( !sTypeName
.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("SYSTEM TABLE"))
64 && !sTypeName
.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("ACCESS TABLE")) )
65 aVector
.push_back(aElement
.get_Name());
71 m_pTables
->reFill(aVector
);
73 m_pTables
= new OTables(this,m_aMutex
,aVector
,aTables
,m_pConnection
->getMetaData()->supportsMixedCaseQuotedIdentifiers());
75 // -------------------------------------------------------------------------
76 void OCatalog::refreshViews()
78 TStringVector aVector
;
80 WpADOViews aViews
= m_aCatalog
.get_Views();
81 aViews
.fillElementNames(aVector
);
84 m_pViews
->reFill(aVector
);
86 m_pViews
= new OViews(this,m_aMutex
,aVector
,aViews
,m_pConnection
->getMetaData()->supportsMixedCaseQuotedIdentifiers());
88 // -------------------------------------------------------------------------
89 void OCatalog::refreshGroups()
91 TStringVector aVector
;
93 WpADOGroups aGroups
= m_aCatalog
.get_Groups();
94 aGroups
.fillElementNames(aVector
);
97 m_pGroups
->reFill(aVector
);
99 m_pGroups
= new OGroups(this,m_aMutex
,aVector
,aGroups
,m_pConnection
->getMetaData()->supportsMixedCaseQuotedIdentifiers());
101 // -------------------------------------------------------------------------
102 void OCatalog::refreshUsers()
104 TStringVector aVector
;
106 WpADOUsers aUsers
= m_aCatalog
.get_Users();
107 aUsers
.fillElementNames(aVector
);
110 m_pUsers
->reFill(aVector
);
112 m_pUsers
= new OUsers(this,m_aMutex
,aVector
,aUsers
,m_pConnection
->getMetaData()->supportsMixedCaseQuotedIdentifiers());
114 // -------------------------------------------------------------------------
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */