Update ooo320-m1
[ooovba.git] / connectivity / source / drivers / dbase / DIndexColumns.cxx
blob305252cb71ca984c311e448912c021983e39e369
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: DIndexColumns.cxx,v $
10 * $Revision: 1.15 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_connectivity.hxx"
33 #include "dbase/DIndexColumns.hxx"
34 #include "dbase/DTable.hxx"
35 #include "connectivity/sdbcx/VIndexColumn.hxx"
36 #include <comphelper/types.hxx>
37 #include <comphelper/property.hxx>
38 #include <connectivity/dbexception.hxx>
40 using namespace ::comphelper;
42 using namespace connectivity::dbase;
43 using namespace connectivity;
44 using namespace ::com::sun::star::uno;
45 using namespace ::com::sun::star::beans;
46 using namespace ::com::sun::star::sdbcx;
47 using namespace ::com::sun::star::sdbc;
48 using namespace ::com::sun::star::container;
51 sdbcx::ObjectType ODbaseIndexColumns::createObject(const ::rtl::OUString& _rName)
53 const ODbaseTable* pTable = m_pIndex->getTable();
55 ::vos::ORef<OSQLColumns> aCols = pTable->getTableColumns();
56 OSQLColumns::Vector::const_iterator aIter = find(aCols->get().begin(),aCols->get().end(),_rName,::comphelper::UStringMixEqual(isCaseSensitive()));
58 Reference< XPropertySet > xCol;
59 if(aIter != aCols->get().end())
60 xCol = *aIter;
62 if(!xCol.is())
63 return sdbcx::ObjectType();
65 sdbcx::ObjectType xRet = new sdbcx::OIndexColumn(sal_True,_rName
66 ,getString(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)))
67 ,::rtl::OUString()
68 ,getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)))
69 ,getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)))
70 ,getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)))
71 ,getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))
72 ,sal_False
73 ,sal_False
74 ,sal_False
75 ,pTable->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers());
77 return xRet;
80 // -------------------------------------------------------------------------
81 void ODbaseIndexColumns::impl_refresh() throw(RuntimeException)
83 m_pIndex->refreshColumns();
85 // -------------------------------------------------------------------------
86 Reference< XPropertySet > ODbaseIndexColumns::createDescriptor()
88 return new sdbcx::OIndexColumn(m_pIndex->getTable()->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers());
90 // -------------------------------------------------------------------------
91 sdbcx::ObjectType ODbaseIndexColumns::appendObject( const ::rtl::OUString& /*_rForName*/, const Reference< XPropertySet >& descriptor )
93 return cloneDescriptor( descriptor );
95 // -----------------------------------------------------------------------------