Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / connectivity / source / drivers / ado / AIndex.cxx
blobb183d49c2435221c109f11cd5ef0eb3d46155353
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 <ado/AColumns.hxx>
24 #include <TConnection.hxx>
25 #include <comphelper/servicehelper.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.set(_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 void SAL_CALL OAdoIndex::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue)
75 if(m_aIndex.IsValid())
77 switch(nHandle)
79 case PROPERTY_ID_NAME:
81 OUString aVal;
82 rValue >>= aVal;
83 m_aIndex.put_Name(aVal);
85 break;
86 case PROPERTY_ID_CATALOG:
88 OUString aVal;
89 rValue >>= aVal;
90 m_aIndex.put_Name(aVal);
92 break;
93 case PROPERTY_ID_ISUNIQUE:
94 m_aIndex.put_Unique(getBOOL(rValue));
95 break;
96 case PROPERTY_ID_ISPRIMARYKEYINDEX:
97 m_aIndex.put_PrimaryKey(getBOOL(rValue));
98 break;
99 case PROPERTY_ID_ISCLUSTERED:
100 m_aIndex.put_Clustered(getBOOL(rValue));
101 break;
104 sdbcx::OIndex::setFastPropertyValue_NoBroadcast(nHandle,rValue);
107 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */