1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_connectivity.hxx" 26 #include "dbase/DIndexColumns.hxx" 27 #include "dbase/DTable.hxx" 28 #include "connectivity/sdbcx/VIndexColumn.hxx" 29 #include <comphelper/types.hxx> 30 #include <comphelper/property.hxx> 31 #include <connectivity/dbexception.hxx> 32 33 using namespace ::comphelper; 34 35 using namespace connectivity::dbase; 36 using namespace connectivity; 37 using namespace ::com::sun::star::uno; 38 using namespace ::com::sun::star::beans; 39 using namespace ::com::sun::star::sdbcx; 40 using namespace ::com::sun::star::sdbc; 41 using namespace ::com::sun::star::container; 42 43 44 sdbcx::ObjectType ODbaseIndexColumns::createObject(const ::rtl::OUString& _rName) 45 { 46 const ODbaseTable* pTable = m_pIndex->getTable(); 47 48 ::vos::ORef<OSQLColumns> aCols = pTable->getTableColumns(); 49 OSQLColumns::Vector::const_iterator aIter = find(aCols->get().begin(),aCols->get().end(),_rName,::comphelper::UStringMixEqual(isCaseSensitive())); 50 51 Reference< XPropertySet > xCol; 52 if(aIter != aCols->get().end()) 53 xCol = *aIter; 54 55 if(!xCol.is()) 56 return sdbcx::ObjectType(); 57 58 sdbcx::ObjectType xRet = new sdbcx::OIndexColumn(sal_True,_rName 59 ,getString(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME))) 60 ,::rtl::OUString() 61 ,getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))) 62 ,getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))) 63 ,getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))) 64 ,getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))) 65 ,sal_False 66 ,sal_False 67 ,sal_False 68 ,pTable->getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers()); 69 70 return xRet; 71 } 72 73 // ------------------------------------------------------------------------- 74 void ODbaseIndexColumns::impl_refresh() throw(RuntimeException) 75 { 76 m_pIndex->refreshColumns(); 77 } 78 // ------------------------------------------------------------------------- 79 Reference< XPropertySet > ODbaseIndexColumns::createDescriptor() 80 { 81 return new sdbcx::OIndexColumn(m_pIndex->getTable()->getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers()); 82 } 83 // ------------------------------------------------------------------------- 84 sdbcx::ObjectType ODbaseIndexColumns::appendObject( const ::rtl::OUString& /*_rForName*/, const Reference< XPropertySet >& descriptor ) 85 { 86 return cloneDescriptor( descriptor ); 87 } 88 // ----------------------------------------------------------------------------- 89 90 91