2000-09-18 15:18:56 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 07:17:09 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
2008-04-10 07:17:09 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
2008-04-10 07:17:09 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
2008-04-10 07:17:09 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
2008-04-10 07:17:09 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
2008-04-10 07:17:09 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-17 01:10:59 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_connectivity.hxx"
|
2000-09-18 15:18:56 +00:00
|
|
|
#include "ado/ACatalog.hxx"
|
|
|
|
#include "ado/AConnection.hxx"
|
|
|
|
#include "ado/AGroups.hxx"
|
|
|
|
#include "ado/AUsers.hxx"
|
|
|
|
#include "ado/ATables.hxx"
|
|
|
|
#include "ado/AViews.hxx"
|
|
|
|
#include <com/sun/star/sdbc/XRow.hpp>
|
|
|
|
#include <com/sun/star/sdbc/XResultSet.hpp>
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
2001-05-14 10:42:44 +00:00
|
|
|
using namespace connectivity;
|
2000-09-18 15:18:56 +00:00
|
|
|
using namespace connectivity::ado;
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
OCatalog::OCatalog(_ADOCatalog* _pCatalog,OConnection* _pCon) : connectivity::sdbcx::OCatalog(_pCon)
|
|
|
|
,m_pConnection(_pCon)
|
|
|
|
,m_aCatalog(_pCatalog)
|
|
|
|
{
|
|
|
|
}
|
2001-11-09 06:15:37 +00:00
|
|
|
// -----------------------------------------------------------------------------
|
2002-01-18 15:35:28 +00:00
|
|
|
OCatalog::~OCatalog()
|
|
|
|
{
|
|
|
|
if(m_aCatalog.IsValid())
|
|
|
|
m_aCatalog.putref_ActiveConnection(NULL);
|
|
|
|
m_aCatalog.clear();
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
2000-09-18 15:18:56 +00:00
|
|
|
void OCatalog::refreshTables()
|
|
|
|
{
|
2001-05-02 11:57:37 +00:00
|
|
|
TStringVector aVector;
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2001-11-09 06:15:37 +00:00
|
|
|
WpADOTables aTables(m_aCatalog.get_Tables());
|
2006-08-15 09:27:50 +00:00
|
|
|
if ( aTables.IsValid() )
|
|
|
|
{
|
|
|
|
aTables.Refresh();
|
|
|
|
sal_Int32 nCount = aTables.GetItemCount();
|
|
|
|
aVector.reserve(nCount);
|
|
|
|
for(sal_Int32 i=0;i< nCount;++i)
|
|
|
|
{
|
|
|
|
WpADOTable aElement = aTables.GetItem(i);
|
|
|
|
if ( aElement.IsValid() )
|
|
|
|
{
|
|
|
|
::rtl::OUString sTypeName = aElement.get_Type();
|
|
|
|
if ( !sTypeName.equalsIgnoreAsciiCaseAscii("SYSTEM TABLE") && !sTypeName.equalsIgnoreAsciiCaseAscii("ACCESS TABLE") )
|
|
|
|
aVector.push_back(aElement.get_Name());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2000-09-18 15:18:56 +00:00
|
|
|
|
|
|
|
if(m_pTables)
|
2001-10-05 05:15:40 +00:00
|
|
|
m_pTables->reFill(aVector);
|
|
|
|
else
|
2001-11-09 06:15:37 +00:00
|
|
|
m_pTables = new OTables(this,m_aMutex,aVector,aTables,m_pConnection->getMetaData()->storesMixedCaseQuotedIdentifiers());
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void OCatalog::refreshViews()
|
|
|
|
{
|
2001-05-02 11:57:37 +00:00
|
|
|
TStringVector aVector;
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2001-11-09 06:15:37 +00:00
|
|
|
WpADOViews aViews = m_aCatalog.get_Views();
|
|
|
|
aViews.fillElementNames(aVector);
|
2000-09-18 15:18:56 +00:00
|
|
|
|
|
|
|
if(m_pViews)
|
2001-10-05 05:15:40 +00:00
|
|
|
m_pViews->reFill(aVector);
|
|
|
|
else
|
2001-11-09 06:15:37 +00:00
|
|
|
m_pViews = new OViews(this,m_aMutex,aVector,aViews,m_pConnection->getMetaData()->storesMixedCaseQuotedIdentifiers());
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void OCatalog::refreshGroups()
|
|
|
|
{
|
2001-05-02 11:57:37 +00:00
|
|
|
TStringVector aVector;
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2001-11-09 06:15:37 +00:00
|
|
|
WpADOGroups aGroups = m_aCatalog.get_Groups();
|
|
|
|
aGroups.fillElementNames(aVector);
|
2000-09-18 15:18:56 +00:00
|
|
|
|
|
|
|
if(m_pGroups)
|
2001-10-05 05:15:40 +00:00
|
|
|
m_pGroups->reFill(aVector);
|
|
|
|
else
|
2001-11-09 06:15:37 +00:00
|
|
|
m_pGroups = new OGroups(this,m_aMutex,aVector,aGroups,m_pConnection->getMetaData()->storesMixedCaseQuotedIdentifiers());
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void OCatalog::refreshUsers()
|
|
|
|
{
|
2001-05-02 11:57:37 +00:00
|
|
|
TStringVector aVector;
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2001-11-09 06:15:37 +00:00
|
|
|
WpADOUsers aUsers = m_aCatalog.get_Users();
|
|
|
|
aUsers.fillElementNames(aVector);
|
2000-09-18 15:18:56 +00:00
|
|
|
|
|
|
|
if(m_pUsers)
|
2001-10-05 05:15:40 +00:00
|
|
|
m_pUsers->reFill(aVector);
|
|
|
|
else
|
2001-11-09 06:15:37 +00:00
|
|
|
m_pUsers = new OUsers(this,m_aMutex,aVector,aUsers,m_pConnection->getMetaData()->storesMixedCaseQuotedIdentifiers());
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|