Files
libreoffice/dbaccess/source/core/api/CIndexes.cxx

94 lines
2.8 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2012-06-14 17:39:53 +01:00
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
2000-11-15 14:58:11 +00:00
#include "CIndexes.hxx"
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <com/sun/star/sdbc/IndexType.hpp>
#include "dbastrings.hrc"
#include <connectivity/dbtools.hxx>
#include <comphelper/extract.hxx>
2000-11-15 14:58:11 +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;
ObjectType OIndexes::createObject(const OUString& _rName)
2000-11-15 14:58:11 +00:00
{
ObjectType xRet;
if ( m_xIndexes.is() && m_xIndexes->hasByName(_rName) )
xRet.set(m_xIndexes->getByName(_rName),UNO_QUERY);
2000-11-15 14:58:11 +00:00
else
xRet = OIndexesHelper::createObject(_rName);
2000-11-15 14:58:11 +00:00
return xRet;
}
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
return OIndexesHelper::createDescriptor();
2000-11-15 14:58:11 +00:00
}
2000-11-15 14:58:11 +00:00
// XAppend
ObjectType OIndexes::appendObject( const 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);
if ( !xData.is() )
return OIndexesHelper::appendObject( _rForName, descriptor );
xData->appendByDescriptor(descriptor);
return createObject( _rForName );
2000-11-15 14:58:11 +00:00
}
2000-11-15 14:58:11 +00:00
// XDrop
void OIndexes::dropObject(sal_Int32 _nPos, const OUString& _sElementName)
2000-11-15 14:58:11 +00:00
{
if ( m_xIndexes.is() )
2000-11-15 14:58:11 +00:00
{
Reference<XDrop> xData( m_xIndexes,UNO_QUERY);
if ( xData.is() )
2001-10-12 11:02:56 +00:00
xData->dropByName(_sElementName);
2000-11-15 14:58:11 +00:00
}
else
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)
{
if ( m_xIndexes.is() )
2000-11-15 15:07:40 +00:00
clear_NoDispose();
else
OIndexesHelper::disposing();
2001-10-12 11:02:56 +00:00
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */