2000-11-15 14:58:11 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 11:19:20 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-11-15 14:58:11 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-11-15 14:58:11 +00:00
|
|
|
*
|
2008-04-10 11:19:20 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-11-15 14:58:11 +00:00
|
|
|
*
|
2008-04-10 11:19:20 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-11-15 14:58:11 +00:00
|
|
|
*
|
2008-04-10 11:19:20 +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-11-15 14:58:11 +00:00
|
|
|
*
|
2008-04-10 11:19:20 +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-11-15 14:58:11 +00:00
|
|
|
*
|
2008-04-10 11:19:20 +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-11-15 14:58:11 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
2006-09-17 05:29:42 +00:00
|
|
|
|
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_dbaccess.hxx"
|
2000-11-15 14:58:11 +00:00
|
|
|
#ifndef DBACCESS_INDEXES_HXX_
|
|
|
|
#include "CIndexes.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
|
|
|
|
#include <com/sun/star/sdbc/XRow.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_
|
|
|
|
#include <com/sun/star/sdbc/XResultSet.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_SDBC_INDEXTYPE_HPP_
|
|
|
|
#include <com/sun/star/sdbc/IndexType.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef DBACCESS_SHARED_DBASTRINGS_HRC
|
|
|
|
#include "dbastrings.hrc"
|
|
|
|
#endif
|
|
|
|
#ifndef _CONNECTIVITY_DBTOOLS_HXX_
|
|
|
|
#include <connectivity/dbtools.hxx>
|
|
|
|
#endif
|
2001-03-15 07:29:16 +00:00
|
|
|
#ifndef _COMPHELPER_EXTRACT_HXX_
|
|
|
|
#include <comphelper/extract.hxx>
|
2000-11-15 14:58:11 +00:00
|
|
|
#endif
|
2005-09-23 11:01:27 +00:00
|
|
|
#ifndef _TOOLS_DEBUG_HXX
|
|
|
|
#include <tools/debug.hxx>
|
|
|
|
#endif
|
|
|
|
|
2000-11-15 14:58:11 +00:00
|
|
|
|
2002-10-25 07:55:22 +00:00
|
|
|
using namespace connectivity;
|
2000-11-15 14:58:11 +00:00
|
|
|
using namespace connectivity::sdbcx;
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::beans;
|
|
|
|
using namespace ::com::sun::star::sdbcx;
|
|
|
|
using namespace ::com::sun::star::sdbc;
|
|
|
|
using namespace ::com::sun::star::container;
|
|
|
|
using namespace ::com::sun::star::lang;
|
|
|
|
using namespace dbaccess;
|
|
|
|
using namespace cppu;
|
|
|
|
|
|
|
|
|
2005-03-10 15:27:32 +00:00
|
|
|
ObjectType OIndexes::createObject(const ::rtl::OUString& _rName)
|
2000-11-15 14:58:11 +00:00
|
|
|
{
|
2005-03-10 15:27:32 +00:00
|
|
|
ObjectType xRet;
|
2002-10-25 07:55:22 +00:00
|
|
|
if ( m_xIndexes.is() && m_xIndexes->hasByName(_rName) )
|
2004-08-02 13:58:26 +00:00
|
|
|
xRet.set(m_xIndexes->getByName(_rName),UNO_QUERY);
|
2000-11-15 14:58:11 +00:00
|
|
|
else
|
2002-10-25 07:55:22 +00:00
|
|
|
xRet = OIndexesHelper::createObject(_rName);
|
2000-11-15 14:58:11 +00:00
|
|
|
|
|
|
|
return xRet;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
2006-07-10 14:00:36 +00:00
|
|
|
Reference< XPropertySet > OIndexes::createDescriptor()
|
2000-11-15 14:58:11 +00:00
|
|
|
{
|
2001-11-06 11:48:49 +00:00
|
|
|
Reference<XDataDescriptorFactory> xData( m_xIndexes,UNO_QUERY);
|
|
|
|
if(xData.is())
|
2000-11-15 14:58:11 +00:00
|
|
|
return xData->createDataDescriptor();
|
|
|
|
else
|
2006-07-10 14:00:36 +00:00
|
|
|
return OIndexesHelper::createDescriptor();
|
2000-11-15 14:58:11 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
// XAppend
|
2006-07-10 14:00:36 +00:00
|
|
|
ObjectType OIndexes::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor )
|
2000-11-15 14:58:11 +00:00
|
|
|
{
|
2001-11-06 11:48:49 +00:00
|
|
|
Reference<XAppend> xData( m_xIndexes,UNO_QUERY);
|
2006-07-10 14:00:36 +00:00
|
|
|
if ( !xData.is() )
|
|
|
|
return OIndexesHelper::appendObject( _rForName, descriptor );
|
|
|
|
|
|
|
|
xData->appendByDescriptor(descriptor);
|
|
|
|
return createObject( _rForName );
|
2000-11-15 14:58:11 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
// XDrop
|
2001-10-12 11:02:56 +00:00
|
|
|
void OIndexes::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName)
|
2000-11-15 14:58:11 +00:00
|
|
|
{
|
2002-10-25 07:55:22 +00:00
|
|
|
if ( m_xIndexes.is() )
|
2000-11-15 14:58:11 +00:00
|
|
|
{
|
|
|
|
Reference<XDrop> xData( m_xIndexes,UNO_QUERY);
|
2002-10-25 07:55:22 +00:00
|
|
|
if ( xData.is() )
|
2001-10-12 11:02:56 +00:00
|
|
|
xData->dropByName(_sElementName);
|
2000-11-15 14:58:11 +00:00
|
|
|
}
|
|
|
|
else
|
2002-10-25 07:55:22 +00:00
|
|
|
OIndexesHelper::dropObject(_nPos,_sElementName);
|
2000-11-15 14:58:11 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
2000-11-15 15:07:40 +00:00
|
|
|
void SAL_CALL OIndexes::disposing(void)
|
|
|
|
{
|
2002-10-25 07:55:22 +00:00
|
|
|
if ( m_xIndexes.is() )
|
2000-11-15 15:07:40 +00:00
|
|
|
clear_NoDispose();
|
|
|
|
else
|
2002-10-25 07:55:22 +00:00
|
|
|
OIndexesHelper::disposing();
|
2001-10-12 11:02:56 +00:00
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2000-11-15 14:58:11 +00:00
|
|
|
|
|
|
|
|
2002-10-25 07:55:22 +00:00
|
|
|
|