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_dbaccess.hxx" 26 #ifndef DBACCESS_INDEXES_HXX_ 27 #include "CIndexes.hxx" 28 #endif 29 #ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ 30 #include <com/sun/star/sdbc/XRow.hpp> 31 #endif 32 #ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ 33 #include <com/sun/star/sdbc/XResultSet.hpp> 34 #endif 35 #ifndef _COM_SUN_STAR_SDBC_INDEXTYPE_HPP_ 36 #include <com/sun/star/sdbc/IndexType.hpp> 37 #endif 38 #ifndef DBACCESS_SHARED_DBASTRINGS_HRC 39 #include "dbastrings.hrc" 40 #endif 41 #ifndef _CONNECTIVITY_DBTOOLS_HXX_ 42 #include <connectivity/dbtools.hxx> 43 #endif 44 #ifndef _COMPHELPER_EXTRACT_HXX_ 45 #include <comphelper/extract.hxx> 46 #endif 47 #ifndef _TOOLS_DEBUG_HXX 48 #include <tools/debug.hxx> 49 #endif 50 51 52 using namespace connectivity; 53 using namespace connectivity::sdbcx; 54 using namespace ::com::sun::star::uno; 55 using namespace ::com::sun::star::beans; 56 using namespace ::com::sun::star::sdbcx; 57 using namespace ::com::sun::star::sdbc; 58 using namespace ::com::sun::star::container; 59 using namespace ::com::sun::star::lang; 60 using namespace dbaccess; 61 using namespace cppu; 62 63 64 ObjectType OIndexes::createObject(const ::rtl::OUString& _rName) 65 { 66 ObjectType xRet; 67 if ( m_xIndexes.is() && m_xIndexes->hasByName(_rName) ) 68 xRet.set(m_xIndexes->getByName(_rName),UNO_QUERY); 69 else 70 xRet = OIndexesHelper::createObject(_rName); 71 72 return xRet; 73 } 74 // ------------------------------------------------------------------------- 75 Reference< XPropertySet > OIndexes::createDescriptor() 76 { 77 Reference<XDataDescriptorFactory> xData( m_xIndexes,UNO_QUERY); 78 if(xData.is()) 79 return xData->createDataDescriptor(); 80 else 81 return OIndexesHelper::createDescriptor(); 82 } 83 // ------------------------------------------------------------------------- 84 // XAppend 85 ObjectType OIndexes::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor ) 86 { 87 Reference<XAppend> xData( m_xIndexes,UNO_QUERY); 88 if ( !xData.is() ) 89 return OIndexesHelper::appendObject( _rForName, descriptor ); 90 91 xData->appendByDescriptor(descriptor); 92 return createObject( _rForName ); 93 } 94 // ------------------------------------------------------------------------- 95 // XDrop 96 void OIndexes::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) 97 { 98 if ( m_xIndexes.is() ) 99 { 100 Reference<XDrop> xData( m_xIndexes,UNO_QUERY); 101 if ( xData.is() ) 102 xData->dropByName(_sElementName); 103 } 104 else 105 OIndexesHelper::dropObject(_nPos,_sElementName); 106 } 107 // ------------------------------------------------------------------------- 108 void SAL_CALL OIndexes::disposing(void) 109 { 110 if ( m_xIndexes.is() ) 111 clear_NoDispose(); 112 else 113 OIndexesHelper::disposing(); 114 } 115 // ----------------------------------------------------------------------------- 116 117 118 119 120