Use correct object
[LibreOffice.git] / connectivity / source / drivers / dbase / DIndexColumns.cxx
blob8b20903fa1d384fe01cc0748b726d7bc4916f0f7
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <dbase/DIndexColumns.hxx>
21 #include <dbase/DTable.hxx>
22 #include <sdbcx/VIndexColumn.hxx>
23 #include <comphelper/types.hxx>
25 using namespace ::comphelper;
27 using namespace connectivity::dbase;
28 using namespace connectivity;
29 using namespace ::com::sun::star::uno;
30 using namespace ::com::sun::star::beans;
31 using namespace ::com::sun::star::sdbc;
34 sdbcx::ObjectType ODbaseIndexColumns::createObject(const OUString& _rName)
36 const ODbaseTable* pTable = m_pIndex->getTable();
38 const ::rtl::Reference<OSQLColumns>& aCols = pTable->getTableColumns();
39 OSQLColumns::const_iterator aIter = find(aCols->begin(),aCols->end(),_rName,::comphelper::UStringMixEqual(isCaseSensitive()));
41 Reference< XPropertySet > xCol;
42 if(aIter != aCols->end())
43 xCol = *aIter;
45 if(!xCol.is())
46 return sdbcx::ObjectType();
48 sdbcx::ObjectType xRet = new sdbcx::OIndexColumn(true,_rName
49 ,getString(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)))
50 ,OUString()
51 ,getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)))
52 ,getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)))
53 ,getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)))
54 ,getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))
55 ,pTable->getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers()
56 ,getString(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CATALOGNAME)))
57 ,getString(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME)))
58 ,getString(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TABLENAME))));
60 return xRet;
64 void ODbaseIndexColumns::impl_refresh()
66 m_pIndex->refreshColumns();
69 Reference< XPropertySet > ODbaseIndexColumns::createDescriptor()
71 return new sdbcx::OIndexColumn(m_pIndex->getTable()->getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers());
74 sdbcx::ObjectType ODbaseIndexColumns::appendObject( const OUString& /*_rForName*/, const Reference< XPropertySet >& descriptor )
76 return cloneDescriptor( descriptor );
80 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */