2000-09-18 10:18:56 -05:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 02:32:26 -05:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 10:18:56 -05:00
|
|
|
*
|
2008-04-10 02:32:26 -05:00
|
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
2000-09-18 10:18:56 -05:00
|
|
|
*
|
2008-04-10 02:32:26 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 10:18:56 -05:00
|
|
|
*
|
2008-04-10 02:32:26 -05:00
|
|
|
* $RCSfile: DColumns.cxx,v $
|
|
|
|
* $Revision: 1.16 $
|
2000-09-18 10:18:56 -05:00
|
|
|
*
|
2008-04-10 02:32:26 -05:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 10:18:56 -05:00
|
|
|
*
|
2008-04-10 02:32:26 -05: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 10:18:56 -05:00
|
|
|
*
|
2008-04-10 02:32:26 -05: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 10:18:56 -05:00
|
|
|
*
|
2008-04-10 02:32:26 -05: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 10:18:56 -05:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-16 20:21:07 -05:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_connectivity.hxx"
|
2000-09-18 10:18:56 -05:00
|
|
|
#include "dbase/DColumns.hxx"
|
|
|
|
#include "dbase/DTable.hxx"
|
|
|
|
#include "connectivity/sdbcx/VColumn.hxx"
|
2001-03-28 04:32:43 -06:00
|
|
|
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
|
2001-10-12 06:02:56 -05:00
|
|
|
#include <comphelper/property.hxx>
|
2000-09-18 10:18:56 -05:00
|
|
|
|
|
|
|
using namespace connectivity::dbase;
|
|
|
|
using namespace connectivity;
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::beans;
|
2001-03-28 04:32:43 -06:00
|
|
|
using namespace ::com::sun::star::lang;
|
2000-09-18 10:18:56 -05:00
|
|
|
using namespace ::com::sun::star::sdbcx;
|
|
|
|
using namespace ::com::sun::star::sdbc;
|
|
|
|
using namespace ::com::sun::star::container;
|
|
|
|
|
2001-03-28 04:32:43 -06:00
|
|
|
typedef file::OColumns ODbaseColumns_BASE;
|
2005-03-10 08:25:01 -06:00
|
|
|
sdbcx::ObjectType ODbaseColumns::createObject(const ::rtl::OUString& _rName)
|
2000-09-18 10:18:56 -05:00
|
|
|
{
|
|
|
|
|
|
|
|
ODbaseTable* pTable = (ODbaseTable*)m_pTable;
|
|
|
|
|
|
|
|
// Reference< XFastPropertySet> xCol(pTable->getColumns()[_rName],UNO_QUERY);
|
|
|
|
::vos::ORef<OSQLColumns> aCols = pTable->getTableColumns();
|
2008-12-30 07:32:01 -06:00
|
|
|
OSQLColumns::Vector::const_iterator aIter = find(aCols->get().begin(),aCols->get().end(),_rName,::comphelper::UStringMixEqual(isCaseSensitive()));
|
2000-09-18 10:18:56 -05:00
|
|
|
|
2005-03-10 08:25:01 -06:00
|
|
|
sdbcx::ObjectType xRet;
|
2008-12-30 07:32:01 -06:00
|
|
|
if(aIter != aCols->get().end())
|
2005-03-10 08:25:01 -06:00
|
|
|
xRet = sdbcx::ObjectType(*aIter,UNO_QUERY);
|
2000-09-18 10:18:56 -05:00
|
|
|
return xRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void ODbaseColumns::impl_refresh() throw(RuntimeException)
|
|
|
|
{
|
|
|
|
m_pTable->refreshColumns();
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
2006-07-10 08:24:58 -05:00
|
|
|
Reference< XPropertySet > ODbaseColumns::createDescriptor()
|
2000-09-18 10:18:56 -05:00
|
|
|
{
|
2001-08-24 00:19:41 -05:00
|
|
|
return new sdbcx::OColumn(isCaseSensitive());
|
2000-09-18 10:18:56 -05:00
|
|
|
}
|
2001-03-28 04:32:43 -06:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
// XAppend
|
2006-07-10 08:24:58 -05:00
|
|
|
sdbcx::ObjectType ODbaseColumns::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor )
|
2001-03-28 04:32:43 -06:00
|
|
|
{
|
2006-07-10 08:24:58 -05:00
|
|
|
if ( m_pTable->isNew() )
|
|
|
|
return cloneDescriptor( descriptor );
|
|
|
|
|
|
|
|
m_pTable->addColumn( descriptor );
|
|
|
|
return createObject( _rForName );
|
2001-03-28 04:32:43 -06:00
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
// XDrop
|
2006-06-19 19:19:12 -05:00
|
|
|
void ODbaseColumns::dropObject(sal_Int32 _nPos,const ::rtl::OUString /*_sElementName*/)
|
2001-03-28 04:32:43 -06:00
|
|
|
{
|
|
|
|
if(!m_pTable->isNew())
|
2001-10-12 06:02:56 -05:00
|
|
|
m_pTable->dropColumn(_nPos);
|
2001-03-28 04:32:43 -06:00
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
2000-09-18 10:18:56 -05:00
|
|
|
|