bump product version to 6.3.0.0.beta1
[LibreOffice.git] / connectivity / source / drivers / ado / AIndex.cxx
blob0888fa1bf2b8170ec721ea3ff1a205bf919ad78f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <ado/AColumns.hxx>
25 #include <TConnection.hxx>
26 #include <comphelper/types.hxx>
28 using namespace ::comphelper;
30 using namespace connectivity::ado;
31 using namespace com::sun::star::uno;
32 using namespace com::sun::star::lang;
33 using namespace com::sun::star::beans;
34 using namespace com::sun::star::sdbc;
37 OAdoIndex::OAdoIndex(bool _bCase,OConnection* _pConnection,ADOIndex* _pIndex)
38 : sdbcx::OIndex(OUString(),OUString(),false,false,false,_bCase)
39 ,m_pConnection(_pConnection)
41 construct();
42 m_aIndex = WpADOIndex(_pIndex);
43 fillPropertyValues();
46 OAdoIndex::OAdoIndex(bool _bCase,OConnection* _pConnection)
47 : sdbcx::OIndex(_bCase)
48 ,m_pConnection(_pConnection)
50 construct();
51 m_aIndex.Create();
55 void OAdoIndex::refreshColumns()
57 ::std::vector< OUString> aVector;
59 WpADOColumns aColumns;
60 if ( m_aIndex.IsValid() )
62 aColumns = m_aIndex.get_Columns();
63 aColumns.fillElementNames(aVector);
66 if ( m_pColumns )
67 m_pColumns->reFill(aVector);
68 else
69 m_pColumns.reset(new OColumns(*this, m_aMutex, aVector, aColumns, isCaseSensitive(), m_pConnection));
73 Sequence< sal_Int8 > OAdoIndex::getUnoTunnelImplementationId()
75 static ::cppu::OImplementationId implId;
77 return implId.getImplementationId();
80 // css::lang::XUnoTunnel
82 sal_Int64 OAdoIndex::getSomething( const Sequence< sal_Int8 > & rId )
84 return (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
85 ? reinterpret_cast< sal_Int64 >( this )
86 : sdbcx::OIndex::getSomething(rId);
89 void SAL_CALL OAdoIndex::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue)
91 if(m_aIndex.IsValid())
93 switch(nHandle)
95 case PROPERTY_ID_NAME:
97 OUString aVal;
98 rValue >>= aVal;
99 m_aIndex.put_Name(aVal);
101 break;
102 case PROPERTY_ID_CATALOG:
104 OUString aVal;
105 rValue >>= aVal;
106 m_aIndex.put_Name(aVal);
108 break;
109 case PROPERTY_ID_ISUNIQUE:
110 m_aIndex.put_Unique(getBOOL(rValue));
111 break;
112 case PROPERTY_ID_ISPRIMARYKEYINDEX:
113 m_aIndex.put_PrimaryKey(getBOOL(rValue));
114 break;
115 case PROPERTY_ID_ISCLUSTERED:
116 m_aIndex.put_Clustered(getBOOL(rValue));
117 break;
120 sdbcx::OIndex::setFastPropertyValue_NoBroadcast(nHandle,rValue);
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */