bump product version to 6.3.0.0.beta1
[LibreOffice.git] / connectivity / source / drivers / ado / ACatalog.cxx
blobefab28344fe3cf6e5953922542ddf3f2a0292162
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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)
35 ,m_pConnection(_pCon)
39 OCatalog::~OCatalog()
41 if(m_aCatalog.IsValid())
42 m_aCatalog.putref_ActiveConnection(nullptr);
43 m_aCatalog.clear();
46 void OCatalog::refreshTables()
48 ::std::vector< OUString> aVector;
50 WpADOTables aTables(m_aCatalog.get_Tables());
51 if ( aTables.IsValid() )
53 aTables.Refresh();
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());
69 if(m_pTables)
70 m_pTables->reFill(aVector);
71 else
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);
82 if(m_pViews)
83 m_pViews->reFill(aVector);
84 else
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);
95 if(m_pGroups)
96 m_pGroups->reFill(aVector);
97 else
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);
108 if(m_pUsers)
109 m_pUsers->reFill(aVector);
110 else
111 m_pUsers.reset( new OUsers(this,m_aMutex,aVector,aUsers,m_pConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers()) );
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */