1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_connectivity.hxx" 26 #include "ado/ACatalog.hxx" 27 #ifndef _CONNECTIVITY_ADO_BCONNECTION_HXX_ 28 #include "ado/AConnection.hxx" 29 #endif 30 #include "ado/AGroups.hxx" 31 #include "ado/AUsers.hxx" 32 #include "ado/ATables.hxx" 33 #include "ado/AViews.hxx" 34 #include <com/sun/star/sdbc/XRow.hpp> 35 #include <com/sun/star/sdbc/XResultSet.hpp> 36 37 38 // ------------------------------------------------------------------------- 39 using namespace connectivity; 40 using namespace connectivity::ado; 41 // ------------------------------------------------------------------------- 42 OCatalog::OCatalog(_ADOCatalog* _pCatalog,OConnection* _pCon) : connectivity::sdbcx::OCatalog(_pCon) 43 ,m_pConnection(_pCon) 44 ,m_aCatalog(_pCatalog) 45 { 46 } 47 // ----------------------------------------------------------------------------- 48 OCatalog::~OCatalog() 49 { 50 if(m_aCatalog.IsValid()) 51 m_aCatalog.putref_ActiveConnection(NULL); 52 m_aCatalog.clear(); 53 } 54 // ----------------------------------------------------------------------------- 55 void OCatalog::refreshTables() 56 { 57 TStringVector aVector; 58 59 WpADOTables aTables(m_aCatalog.get_Tables()); 60 if ( aTables.IsValid() ) 61 { 62 aTables.Refresh(); 63 sal_Int32 nCount = aTables.GetItemCount(); 64 aVector.reserve(nCount); 65 for(sal_Int32 i=0;i< nCount;++i) 66 { 67 WpADOTable aElement = aTables.GetItem(i); 68 if ( aElement.IsValid() ) 69 { 70 ::rtl::OUString sTypeName = aElement.get_Type(); 71 if ( !sTypeName.equalsIgnoreAsciiCaseAscii("SYSTEM TABLE") && !sTypeName.equalsIgnoreAsciiCaseAscii("ACCESS TABLE") ) 72 aVector.push_back(aElement.get_Name()); 73 } 74 } 75 } 76 77 if(m_pTables) 78 m_pTables->reFill(aVector); 79 else 80 m_pTables = new OTables(this,m_aMutex,aVector,aTables,m_pConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers()); 81 } 82 // ------------------------------------------------------------------------- 83 void OCatalog::refreshViews() 84 { 85 TStringVector aVector; 86 87 WpADOViews aViews = m_aCatalog.get_Views(); 88 aViews.fillElementNames(aVector); 89 90 if(m_pViews) 91 m_pViews->reFill(aVector); 92 else 93 m_pViews = new OViews(this,m_aMutex,aVector,aViews,m_pConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers()); 94 } 95 // ------------------------------------------------------------------------- 96 void OCatalog::refreshGroups() 97 { 98 TStringVector aVector; 99 100 WpADOGroups aGroups = m_aCatalog.get_Groups(); 101 aGroups.fillElementNames(aVector); 102 103 if(m_pGroups) 104 m_pGroups->reFill(aVector); 105 else 106 m_pGroups = new OGroups(this,m_aMutex,aVector,aGroups,m_pConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers()); 107 } 108 // ------------------------------------------------------------------------- 109 void OCatalog::refreshUsers() 110 { 111 TStringVector aVector; 112 113 WpADOUsers aUsers = m_aCatalog.get_Users(); 114 aUsers.fillElementNames(aVector); 115 116 if(m_pUsers) 117 m_pUsers->reFill(aVector); 118 else 119 m_pUsers = new OUsers(this,m_aMutex,aVector,aUsers,m_pConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers()); 120 } 121 // ------------------------------------------------------------------------- 122 123 124