1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 "ado/AIndexes.hxx"
21 #include "ado/AIndex.hxx"
22 #include "ado/AConnection.hxx"
23 #include <com/sun/star/sdbc/XRow.hpp>
24 #include <com/sun/star/sdbc/XResultSet.hpp>
25 #include <com/sun/star/sdbc/IndexType.hpp>
26 #include "TConnection.hxx"
27 #include <comphelper/types.hxx>
28 #include <connectivity/dbexception.hxx>
29 #include "resource/ado_res.hrc"
30 using namespace ::comphelper
;
33 using namespace connectivity
;
34 using namespace connectivity::ado
;
35 using namespace com::sun::star::uno
;
36 using namespace com::sun::star::lang
;
37 using namespace com::sun::star::beans
;
38 using namespace com::sun::star::sdbc
;
39 using namespace com::sun::star::container
;
41 sdbcx::ObjectType
OIndexes::createObject(const OUString
& _rName
)
43 return new OAdoIndex(isCaseSensitive(),m_pConnection
,m_aCollection
.GetItem(_rName
));
46 void OIndexes::impl_refresh() throw(RuntimeException
)
48 m_aCollection
.Refresh();
51 Reference
< XPropertySet
> OIndexes::createDescriptor()
53 return new OAdoIndex(isCaseSensitive(),m_pConnection
);
57 sdbcx::ObjectType
OIndexes::appendObject( const OUString
& _rForName
, const Reference
< XPropertySet
>& descriptor
)
59 OAdoIndex
* pIndex
= NULL
;
60 if ( !getImplementation(pIndex
,descriptor
) || pIndex
== NULL
)
61 m_pConnection
->throwGenericSQLException( STR_INVALID_INDEX_DESCRIPTOR_ERROR
,static_cast<XTypeProvider
*>(this) );
63 ADOIndexes
* pIndexes
= m_aCollection
;
64 if ( FAILED( pIndexes
->Append( OLEVariant( _rForName
), OLEVariant( pIndex
->getImpl() ) ) ) )
66 ADOS::ThrowException(*m_pConnection
->getConnection(),static_cast<XTypeProvider
*>(this));
67 m_pConnection
->throwGenericSQLException( STR_INVALID_INDEX_DESCRIPTOR_ERROR
,static_cast<XTypeProvider
*>(this) );
70 return new OAdoIndex(isCaseSensitive(),m_pConnection
,pIndex
->getImpl());
74 void OIndexes::dropObject(sal_Int32
/*_nPos*/,const OUString
& _sElementName
)
76 m_aCollection
.Delete(_sElementName
);
81 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */