update dev300-m58
[ooovba.git] / connectivity / source / drivers / ado / AIndexes.cxx
blob0246348e586a0bd5ed9329078757403430d2e686
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: AIndexes.cxx,v $
10 * $Revision: 1.17.56.1 $
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 "ado/AIndexes.hxx"
34 #include "ado/AIndex.hxx"
35 #include "ado/AConnection.hxx"
36 #include <com/sun/star/sdbc/XRow.hpp>
37 #include <com/sun/star/sdbc/XResultSet.hpp>
38 #include <com/sun/star/sdbc/IndexType.hpp>
39 #include "TConnection.hxx"
40 #include <comphelper/types.hxx>
41 #include <connectivity/dbexception.hxx>
42 #include "resource/ado_res.hrc"
43 using namespace ::comphelper;
46 using namespace connectivity;
47 using namespace connectivity::ado;
48 using namespace com::sun::star::uno;
49 using namespace com::sun::star::lang;
50 using namespace com::sun::star::beans;
51 using namespace com::sun::star::sdbc;
52 using namespace com::sun::star::container;
54 sdbcx::ObjectType OIndexes::createObject(const ::rtl::OUString& _rName)
56 return new OAdoIndex(isCaseSensitive(),m_pConnection,m_aCollection.GetItem(_rName));
58 // -------------------------------------------------------------------------
59 void OIndexes::impl_refresh() throw(RuntimeException)
61 m_aCollection.Refresh();
63 // -------------------------------------------------------------------------
64 Reference< XPropertySet > OIndexes::createDescriptor()
66 return new OAdoIndex(isCaseSensitive(),m_pConnection);
68 // -------------------------------------------------------------------------
69 // XAppend
70 sdbcx::ObjectType OIndexes::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor )
72 OAdoIndex* pIndex = NULL;
73 if ( !getImplementation(pIndex,descriptor) || pIndex == NULL )
74 m_pConnection->throwGenericSQLException( STR_INVALID_INDEX_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) );
76 ADOIndexes* pIndexes = m_aCollection;
77 if ( FAILED( pIndexes->Append( OLEVariant( _rForName ), OLEVariant( pIndex->getImpl() ) ) ) )
79 ADOS::ThrowException(*m_pConnection->getConnection(),static_cast<XTypeProvider*>(this));
80 m_pConnection->throwGenericSQLException( STR_INVALID_INDEX_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) );
83 return new OAdoIndex(isCaseSensitive(),m_pConnection,pIndex->getImpl());
85 // -------------------------------------------------------------------------
86 // XDrop
87 void OIndexes::dropObject(sal_Int32 /*_nPos*/,const ::rtl::OUString _sElementName)
89 m_aCollection.Delete(_sElementName);
91 // -----------------------------------------------------------------------------