bump product version to 7.2.5.1
[LibreOffice.git] / connectivity / source / drivers / dbase / DIndexColumns.cxx
blob886c7273db31c684fd7ff26f429977c2f320a78a
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::sdbcx;
32 using namespace ::com::sun::star::sdbc;
33 using namespace ::com::sun::star::container;
36 sdbcx::ObjectType ODbaseIndexColumns::createObject(const OUString& _rName)
38 const ODbaseTable* pTable = m_pIndex->getTable();
40 const ::rtl::Reference<OSQLColumns>& aCols = pTable->getTableColumns();
41 OSQLColumns::const_iterator aIter = find(aCols->begin(),aCols->end(),_rName,::comphelper::UStringMixEqual(isCaseSensitive()));
43 Reference< XPropertySet > xCol;
44 if(aIter != aCols->end())
45 xCol = *aIter;
47 if(!xCol.is())
48 return sdbcx::ObjectType();
50 sdbcx::ObjectType xRet = new sdbcx::OIndexColumn(true,_rName
51 ,getString(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)))
52 ,OUString()
53 ,getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)))
54 ,getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)))
55 ,getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)))
56 ,getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))
57 ,pTable->getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers()
58 ,getString(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CATALOGNAME)))
59 ,getString(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME)))
60 ,getString(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TABLENAME))));
62 return xRet;
66 void ODbaseIndexColumns::impl_refresh()
68 m_pIndex->refreshColumns();
71 Reference< XPropertySet > ODbaseIndexColumns::createDescriptor()
73 return new sdbcx::OIndexColumn(m_pIndex->getTable()->getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers());
76 sdbcx::ObjectType ODbaseIndexColumns::appendObject( const OUString& /*_rForName*/, const Reference< XPropertySet >& descriptor )
78 return cloneDescriptor( descriptor );
82 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */