bump product version to 6.3.0.0.beta1
[LibreOffice.git] / connectivity / source / drivers / postgresql / pq_xindex.cxx
blob825950014a2ca683eb1b41fbbd625f41e3927058
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * Effective License of whole file:
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License version 2.1, as published by the Free Software Foundation.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
18 * MA 02111-1307 USA
20 * Parts "Copyright by Sun Microsystems, Inc" prior to August 2011:
22 * The Contents of this file are made available subject to the terms of
23 * the GNU Lesser General Public License Version 2.1
25 * Copyright: 2000 by Sun Microsystems, Inc.
27 * Contributor(s): Joerg Budischewski
29 * All parts contributed on or after August 2011:
31 * This Source Code Form is subject to the terms of the Mozilla Public
32 * License, v. 2.0. If a copy of the MPL was not distributed with this
33 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
35 ************************************************************************/
37 #include <rtl/ustrbuf.hxx>
39 #include <cppuhelper/typeprovider.hxx>
40 #include <cppuhelper/queryinterface.hxx>
42 #include <com/sun/star/beans/PropertyAttribute.hpp>
44 #include "pq_xindex.hxx"
45 #include "pq_xindexcolumns.hxx"
46 #include "pq_tools.hxx"
47 #include "pq_statics.hxx"
49 using com::sun::star::container::XNameAccess;
51 using com::sun::star::uno::Reference;
52 using com::sun::star::uno::Sequence;
53 using com::sun::star::uno::Any;
54 using com::sun::star::uno::Type;
56 using com::sun::star::beans::XPropertySet;
59 namespace pq_sdbc_driver
61 Index::Index( const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
62 const Reference< css::sdbc::XConnection > & connection,
63 ConnectionSettings *pSettings,
64 const OUString & schemaName,
65 const OUString & tableName )
66 : ReflectionBase(
67 getStatics().refl.index.implName,
68 getStatics().refl.index.serviceNames,
69 refMutex,
70 connection,
71 pSettings,
72 * getStatics().refl.index.pProps ),
73 m_schemaName( schemaName ),
74 m_tableName( tableName )
77 Reference< XPropertySet > Index::createDataDescriptor( )
79 IndexDescriptor * pIndex = new IndexDescriptor(
80 m_xMutex, m_conn, m_pSettings );
81 pIndex->copyValuesFrom( this );
83 return Reference< XPropertySet > ( pIndex );
86 Reference< XNameAccess > Index::getColumns( )
88 if( ! m_indexColumns.is() )
90 Sequence< OUString > columnNames;
91 getPropertyValue( getStatics().PRIVATE_COLUMN_INDEXES ) >>= columnNames;
92 OUString indexName = extractStringProperty( this, getStatics().NAME );
93 m_indexColumns = IndexColumns::create(
94 m_xMutex, m_conn, m_pSettings, m_schemaName,
95 m_tableName, indexName, columnNames );
97 return m_indexColumns;
100 Sequence<Type > Index::getTypes()
102 static cppu::OTypeCollection collection(
103 cppu::UnoType<css::sdbcx::XColumnsSupplier>::get(),
104 ReflectionBase::getTypes());
106 return collection.getTypes();
109 Sequence< sal_Int8> Index::getImplementationId()
111 return css::uno::Sequence<sal_Int8>();
114 Any Index::queryInterface( const Type & reqType )
116 Any ret = ReflectionBase::queryInterface( reqType );
117 if( ! ret.hasValue() )
118 ret = ::cppu::queryInterface(
119 reqType,
120 static_cast< css::sdbcx::XColumnsSupplier * > ( this ) );
121 return ret;
125 IndexDescriptor::IndexDescriptor(
126 const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
127 const Reference< css::sdbc::XConnection > & connection,
128 ConnectionSettings *pSettings )
129 : ReflectionBase(
130 getStatics().refl.indexDescriptor.implName,
131 getStatics().refl.indexDescriptor.serviceNames,
132 refMutex,
133 connection,
134 pSettings,
135 * getStatics().refl.indexDescriptor.pProps )
138 Reference< XPropertySet > IndexDescriptor::createDataDescriptor( )
140 IndexDescriptor * pIndex = new IndexDescriptor(
141 m_xMutex, m_conn, m_pSettings );
142 pIndex->copyValuesFrom( this );
143 return Reference< XPropertySet > ( pIndex );
146 Reference< XNameAccess > IndexDescriptor::getColumns( )
148 if( ! m_indexColumns.is() )
150 m_indexColumns = IndexColumnDescriptors::create(
151 m_xMutex, m_conn, m_pSettings );
152 // Sequence< OUString > columnNames;
153 // getPropertyValue( getStatics().PRIVATE_COLUMN_INDEXES ) >>= columnNames;
154 // OUString indexName = extractStringProperty( this, getStatics().NAME );
155 // m_indexColumns = IndexColumns::create(
156 // m_xMutex, m_conn, m_pSettings, m_schemaName,
157 // m_tableName, indexName, columnNames );
159 return m_indexColumns;
162 Sequence<Type > IndexDescriptor::getTypes()
164 static cppu::OTypeCollection collection(
165 cppu::UnoType<css::sdbcx::XColumnsSupplier>::get(),
166 ReflectionBase::getTypes());
168 return collection.getTypes();
171 Sequence< sal_Int8> IndexDescriptor::getImplementationId()
173 return css::uno::Sequence<sal_Int8>();
176 Any IndexDescriptor::queryInterface( const Type & reqType )
178 Any ret = ReflectionBase::queryInterface( reqType );
179 if( ! ret.hasValue() )
180 ret = ::cppu::queryInterface(
181 reqType,
182 static_cast< css::sdbcx::XColumnsSupplier * > ( this ) );
183 return ret;
189 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */