2010-10-12 15:53:47 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2000-09-18 15:18:56 +00:00
|
|
|
/*************************************************************************
|
|
|
|
|
*
|
2008-04-10 07:11:17 +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:11:17 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
2008-04-10 07:11:17 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
2008-04-10 07:11:17 +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:11:17 +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:11:17 +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:07:13 +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 "adabas/BIndexColumns.hxx"
|
|
|
|
|
#include "connectivity/sdbcx/VIndexColumn.hxx"
|
|
|
|
|
#include <com/sun/star/sdbc/XRow.hpp>
|
|
|
|
|
#include <com/sun/star/sdbc/XResultSet.hpp>
|
|
|
|
|
#include <com/sun/star/sdbc/DataType.hpp>
|
|
|
|
|
#include <com/sun/star/sdbc/ColumnValue.hpp>
|
|
|
|
|
#include "adabas/BTable.hxx"
|
2001-08-02 09:49:44 +00:00
|
|
|
#include "adabas/BCatalog.hxx"
|
2001-10-02 12:12:32 +00:00
|
|
|
#include <comphelper/types.hxx>
|
2001-10-12 11:02:56 +00:00
|
|
|
#include <comphelper/property.hxx>
|
2000-09-18 15:18:56 +00:00
|
|
|
|
|
|
|
|
using namespace connectivity::adabas;
|
|
|
|
|
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;
|
|
|
|
|
// -------------------------------------------------------------------------
|
2005-03-10 14:20:12 +00:00
|
|
|
ObjectType OIndexColumns::createObject(const ::rtl::OUString& _rName)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
|
|
|
|
|
2001-10-02 12:12:32 +00:00
|
|
|
Reference< XResultSet > xResult = m_pIndex->getTable()->getConnection()->getMetaData()->getIndexInfo(Any(),
|
|
|
|
|
m_pIndex->getTable()->getSchema(),m_pIndex->getTable()->getTableName(),sal_False,sal_False);
|
2000-09-18 15:18:56 +00:00
|
|
|
|
|
|
|
|
sal_Bool bAsc = sal_True;
|
|
|
|
|
if(xResult.is())
|
|
|
|
|
{
|
|
|
|
|
Reference< XRow > xRow(xResult,UNO_QUERY);
|
|
|
|
|
::rtl::OUString aD(::rtl::OUString::createFromAscii("D"));
|
|
|
|
|
while(xResult->next())
|
|
|
|
|
{
|
|
|
|
|
if(xRow->getString(9) == _rName)
|
|
|
|
|
bAsc = xRow->getString(10) != aD;
|
|
|
|
|
}
|
2001-10-02 12:12:32 +00:00
|
|
|
::comphelper::disposeComponent(xResult);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
|
|
2001-08-02 09:49:44 +00:00
|
|
|
xResult = m_pIndex->getTable()->getConnection()->getMetaData()->getColumns(Any(),
|
|
|
|
|
m_pIndex->getTable()->getSchema(),m_pIndex->getTable()->getTableName(),_rName);
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2005-03-10 14:20:12 +00:00
|
|
|
ObjectType xRet = NULL;
|
2000-09-18 15:18:56 +00:00
|
|
|
if(xResult.is())
|
|
|
|
|
{
|
|
|
|
|
Reference< XRow > xRow(xResult,UNO_QUERY);
|
|
|
|
|
while(xResult->next())
|
|
|
|
|
{
|
|
|
|
|
if(xRow->getString(4) == _rName)
|
|
|
|
|
{
|
2001-08-02 09:49:44 +00:00
|
|
|
sal_Int32 nType = xRow->getInt(5);
|
|
|
|
|
::rtl::OUString sTypeName = xRow->getString(6);
|
|
|
|
|
sal_Int32 nPrec = xRow->getInt(7);
|
|
|
|
|
OAdabasCatalog::correctColumnProperties(nPrec,nType,sTypeName);
|
|
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
OIndexColumn* pRet = new OIndexColumn(bAsc,
|
|
|
|
|
_rName,
|
2001-08-02 09:49:44 +00:00
|
|
|
sTypeName,
|
2000-09-18 15:18:56 +00:00
|
|
|
xRow->getString(13),
|
|
|
|
|
xRow->getInt(11),
|
2001-08-02 09:49:44 +00:00
|
|
|
nPrec,
|
2000-09-18 15:18:56 +00:00
|
|
|
xRow->getInt(9),
|
2001-08-02 09:49:44 +00:00
|
|
|
nType,
|
2000-09-18 15:18:56 +00:00
|
|
|
sal_False,sal_False,sal_False,sal_True);
|
|
|
|
|
xRet = pRet;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2001-10-02 12:12:32 +00:00
|
|
|
::comphelper::disposeComponent(xResult);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return xRet;
|
|
|
|
|
}
|
|
|
|
|
// -------------------------------------------------------------------------
|
2006-07-10 13:21:53 +00:00
|
|
|
Reference< XPropertySet > OIndexColumns::createDescriptor()
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-10-12 11:02:56 +00:00
|
|
|
return new OIndexColumn(sal_True);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2001-10-12 11:02:56 +00:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
void OIndexColumns::impl_refresh() throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
|
{
|
|
|
|
|
m_pIndex->refreshColumns();
|
|
|
|
|
}
|
|
|
|
|
// -----------------------------------------------------------------------------
|
2006-07-10 13:21:53 +00:00
|
|
|
ObjectType OIndexColumns::appendObject( const ::rtl::OUString& /*_rForName*/, const Reference< XPropertySet >& descriptor )
|
2001-10-12 11:02:56 +00:00
|
|
|
{
|
2006-07-10 13:21:53 +00:00
|
|
|
return cloneDescriptor( descriptor );
|
2001-10-12 11:02:56 +00:00
|
|
|
}
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2010-10-12 15:53:47 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|