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/AIndex.hxx"
21 #include <com/sun/star/sdbc/XRow.hpp>
22 #include <com/sun/star/sdbc/XResultSet.hpp>
23 #include <cppuhelper/typeprovider.hxx>
24 #include <comphelper/sequence.hxx>
25 #include "ado/AColumns.hxx"
26 #include <comphelper/extract.hxx>
27 #include "TConnection.hxx"
28 #include <comphelper/types.hxx>
30 using namespace ::comphelper
;
32 using namespace connectivity::ado
;
33 using namespace com::sun::star::uno
;
34 using namespace com::sun::star::lang
;
35 using namespace com::sun::star::beans
;
36 using namespace com::sun::star::sdbc
;
39 OAdoIndex::OAdoIndex(sal_Bool _bCase
,OConnection
* _pConnection
,ADOIndex
* _pIndex
)
40 : OIndex_ADO(OUString(),OUString(),sal_False
,sal_False
,sal_False
,_bCase
)
41 ,m_pConnection(_pConnection
)
44 m_aIndex
= WpADOIndex(_pIndex
);
48 OAdoIndex::OAdoIndex(sal_Bool _bCase
,OConnection
* _pConnection
)
50 ,m_pConnection(_pConnection
)
58 void OAdoIndex::refreshColumns()
60 TStringVector aVector
;
62 WpADOColumns aColumns
;
63 if ( m_aIndex
.IsValid() )
65 aColumns
= m_aIndex
.get_Columns();
66 aColumns
.fillElementNames(aVector
);
70 m_pColumns
->reFill(aVector
);
72 m_pColumns
= new OColumns(*this,m_aMutex
,aVector
,aColumns
,isCaseSensitive(),m_pConnection
);
76 Sequence
< sal_Int8
> OAdoIndex::getUnoTunnelImplementationId()
78 static ::cppu::OImplementationId
* pId
= 0;
81 ::osl::MutexGuard
aGuard( ::osl::Mutex::getGlobalMutex() );
84 static ::cppu::OImplementationId aId
;
88 return pId
->getImplementationId();
91 // com::sun::star::lang::XUnoTunnel
93 sal_Int64
OAdoIndex::getSomething( const Sequence
< sal_Int8
> & rId
) throw (RuntimeException
)
95 return (rId
.getLength() == 16 && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(), rId
.getConstArray(), 16 ) )
96 ? reinterpret_cast< sal_Int64
>( this )
97 : OIndex_ADO::getSomething(rId
);
100 void SAL_CALL
OAdoIndex::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle
,const Any
& rValue
)throw (Exception
)
102 if(m_aIndex
.IsValid())
106 case PROPERTY_ID_NAME
:
110 m_aIndex
.put_Name(aVal
);
113 case PROPERTY_ID_CATALOG
:
117 m_aIndex
.put_Name(aVal
);
120 case PROPERTY_ID_ISUNIQUE
:
121 m_aIndex
.put_Unique(getBOOL(rValue
));
123 case PROPERTY_ID_ISPRIMARYKEYINDEX
:
124 m_aIndex
.put_PrimaryKey(getBOOL(rValue
));
126 case PROPERTY_ID_ISCLUSTERED
:
127 m_aIndex
.put_Clustered(getBOOL(rValue
));
131 OIndex_ADO::setFastPropertyValue_NoBroadcast(nHandle
,rValue
);
134 void SAL_CALL
OAdoIndex::acquire() throw()
136 OIndex_ADO::acquire();
139 void SAL_CALL
OAdoIndex::release() throw()
141 OIndex_ADO::release();
148 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */