LibreOffice Module connectivity (master) 1
pq_xindex.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*************************************************************************
3 *
4 * Effective License of whole file:
5 *
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.
9 *
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.
14 *
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
19 *
20 * Parts "Copyright by Sun Microsystems, Inc" prior to August 2011:
21 *
22 * The Contents of this file are made available subject to the terms of
23 * the GNU Lesser General Public License Version 2.1
24 *
25 * Copyright: 2000 by Sun Microsystems, Inc.
26 *
27 * Contributor(s): Joerg Budischewski
28 *
29 * All parts contributed on or after August 2011:
30 *
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/.
34 *
35 ************************************************************************/
36
39#include <rtl/ref.hxx>
40#include <utility>
41
42#include "pq_xindex.hxx"
43#include "pq_xindexcolumns.hxx"
44#include "pq_tools.hxx"
45#include "pq_statics.hxx"
46
47using com::sun::star::container::XNameAccess;
48
51using com::sun::star::uno::Any;
52using com::sun::star::uno::Type;
53
55
56
57namespace pq_sdbc_driver
58{
59Index::Index( const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
60 const Reference< css::sdbc::XConnection > & connection,
61 ConnectionSettings *pSettings,
62 OUString schemaName,
63 OUString tableName )
64 : ReflectionBase(
66 getStatics().refl.index.serviceNames,
67 refMutex,
68 connection,
69 pSettings,
70 * getStatics().refl.index.pProps ),
71 m_schemaName(std::move( schemaName )),
72 m_tableName(std::move( tableName ))
73{}
74
75Reference< XPropertySet > Index::createDataDescriptor( )
76{
78 m_xMutex, m_conn, m_pSettings );
79 pIndex->copyValuesFrom( this );
80
81 return Reference< XPropertySet > ( pIndex );
82}
83
84Reference< XNameAccess > Index::getColumns( )
85{
86 if( ! m_indexColumns.is() )
87 {
88 Sequence< OUString > columnNames;
89 getPropertyValue( getStatics().PRIVATE_COLUMN_INDEXES ) >>= columnNames;
90 OUString indexName = extractStringProperty( this, getStatics().NAME );
91 m_indexColumns = IndexColumns::create(
92 m_xMutex, m_conn, m_pSettings, m_schemaName,
93 m_tableName, indexName, columnNames );
94 }
95 return m_indexColumns;
96}
97
98Sequence<Type > Index::getTypes()
99{
100 static cppu::OTypeCollection collection(
102 ReflectionBase::getTypes());
103
104 return collection.getTypes();
105}
106
107Sequence< sal_Int8> Index::getImplementationId()
108{
109 return css::uno::Sequence<sal_Int8>();
110}
111
112Any Index::queryInterface( const Type & reqType )
113{
114 Any ret = ReflectionBase::queryInterface( reqType );
115 if( ! ret.hasValue() )
116 ret = ::cppu::queryInterface(
117 reqType,
118 static_cast< css::sdbcx::XColumnsSupplier * > ( this ) );
119 return ret;
120}
121
122
123IndexDescriptor::IndexDescriptor(
124 const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
125 const Reference< css::sdbc::XConnection > & connection,
126 ConnectionSettings *pSettings )
128 getStatics().refl.indexDescriptor.implName,
129 getStatics().refl.indexDescriptor.serviceNames,
130 refMutex,
131 connection,
132 pSettings,
133 * getStatics().refl.indexDescriptor.pProps )
134{}
135
137{
140 pIndex->copyValuesFrom( this );
141 return Reference< XPropertySet > ( pIndex );
142}
143
145{
146 if( ! m_indexColumns.is() )
147 {
150// Sequence< OUString > columnNames;
151// getPropertyValue( getStatics().PRIVATE_COLUMN_INDEXES ) >>= columnNames;
152// OUString indexName = extractStringProperty( this, getStatics().NAME );
153// m_indexColumns = IndexColumns::create(
154// m_xMutex, m_conn, m_pSettings, m_schemaName,
155// m_tableName, indexName, columnNames );
156 }
157 return m_indexColumns;
158}
159
161{
162 static cppu::OTypeCollection collection(
165
166 return collection.getTypes();
167}
168
170{
171 return css::uno::Sequence<sal_Int8>();
172}
173
175{
176 Any ret = ReflectionBase::queryInterface( reqType );
177 if( ! ret.hasValue() )
178 ret = ::cppu::queryInterface(
179 reqType,
180 static_cast< css::sdbcx::XColumnsSupplier * > ( this ) );
181 return ret;
182}
183
184
185}
186
187/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
NAME
css::uno::Sequence< css::uno::Type > SAL_CALL getTypes()
static css::uno::Reference< css::container::XNameAccess > create(const ::rtl::Reference< comphelper::RefCountedMutex > &refMutex, const css::uno::Reference< css::sdbc::XConnection > &origin, ConnectionSettings *pSettings)
IndexDescriptor(const ::rtl::Reference< comphelper::RefCountedMutex > &refMutex, const css::uno::Reference< css::sdbc::XConnection > &connection, ConnectionSettings *pSettings)
Definition: pq_xindex.cxx:123
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &reqType) override
Definition: pq_xindex.cxx:174
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getColumns() override
Definition: pq_xindex.cxx:144
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: pq_xindex.cxx:160
virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL createDataDescriptor() override
Definition: pq_xindex.cxx:136
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
Definition: pq_xindex.cxx:169
css::uno::Reference< css::container::XNameAccess > m_indexColumns
Definition: pq_xindex.hxx:91
Index(const ::rtl::Reference< comphelper::RefCountedMutex > &refMutex, const css::uno::Reference< css::sdbc::XConnection > &connection, ConnectionSettings *pSettings, OUString schemaName, OUString tableName)
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &reqType) override
Definition: pq_xbase.cxx:163
css::uno::Reference< css::sdbc::XConnection > m_conn
Definition: pq_xbase.hxx:62
::rtl::Reference< comphelper::RefCountedMutex > m_xMutex
Definition: pq_xbase.hxx:61
ConnectionSettings * m_pSettings
Definition: pq_xbase.hxx:63
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: pq_xbase.cxx:152
class SAL_NO_VTABLE XPropertySet
Type
index
Statics & getStatics()
Definition: pq_statics.cxx:112
OUString extractStringProperty(const Reference< XPropertySet > &descriptor, const OUString &name)
Definition: pq_tools.cxx:204
bool getPropertyValue(ValueType &rValue, css::uno::Reference< css::beans::XPropertySet > const &xPropSet, OUString const &propName)
rtl::Reference< Connection > m_conn
const char * tableName
Definition: pq_statics.cxx:57
const char * implName