LibreOffice Module connectivity (master) 1
AIndexes.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
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>
28#include <comphelper/types.hxx>
30#include <strings.hrc>
31
32using namespace ::comphelper;
33
34
35using namespace connectivity;
36using namespace connectivity::ado;
37using namespace com::sun::star::uno;
38using namespace com::sun::star::lang;
39using namespace com::sun::star::beans;
40using namespace com::sun::star::sdbc;
41using namespace com::sun::star::container;
42
43sdbcx::ObjectType OIndexes::createObject(const OUString& _rName)
44{
46}
47
49{
51}
52
54{
56}
57
58// XAppend
59sdbcx::ObjectType OIndexes::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
60{
61 OAdoIndex* pIndex = dynamic_cast<OAdoIndex*>(descriptor.get());
62 if ( pIndex == nullptr )
63 m_pConnection->throwGenericSQLException( STR_INVALID_INDEX_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) );
64
65 ADOIndexes* pIndexes = m_aCollection;
66 if ( FAILED( pIndexes->Append( OLEVariant( _rForName ), OLEVariant( pIndex->getImpl() ) ) ) )
67 {
68 ADOS::ThrowException(m_pConnection->getConnection(),static_cast<XTypeProvider*>(this));
69 m_pConnection->throwGenericSQLException( STR_INVALID_INDEX_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) );
70 }
71
72 return new OAdoIndex(isCaseSensitive(),m_pConnection,pIndex->getImpl());
73}
74
75// XDrop
76void OIndexes::dropObject(sal_Int32 /*_nPos*/,const OUString& _sElementName)
77{
78 m_aCollection.Delete(_sElementName);
79}
80
81
82/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void throwGenericSQLException(TranslateId pErrorResourceId, const css::uno::Reference< css::uno::XInterface > &_xContext)
Definition: TConnection.cxx:74
static void ThrowException(ADOConnection *_pAdoCon, const css::uno::Reference< css::uno::XInterface > &_xInterface)
Definition: ADriver.cxx:207
WpADOIndex getImpl() const
Definition: AIndex.hxx:42
WpADOConnection & getConnection()
OConnection * m_pConnection
Definition: AIndexes.hxx:31
virtual void impl_refresh() override
Definition: AIndexes.cxx:48
WpADOIndexes m_aCollection
Definition: AIndexes.hxx:30
virtual sdbcx::ObjectType appendObject(const OUString &_rForName, const css::uno::Reference< css::beans::XPropertySet > &descriptor) override
appends an object described by a descriptor, under a given name
virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override
Definition: AIndexes.cxx:53
virtual void dropObject(sal_Int32 _nPos, const OUString &_sElementName) override
Definition: AIndexes.cxx:76
bool Delete(const OUString &sName)
Definition: Aolewrap.hxx:165
WrapT GetItem(sal_Int32 index) const
Definition: Aolewrap.hxx:102
css::uno::Reference< css::beans::XPropertySet > ObjectType
Definition: VCollection.hxx:59