LibreOffice Module connectivity (master) 1
pq_xkey.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_xkey.hxx"
43#include "pq_xkeycolumns.hxx"
44#include "pq_statics.hxx"
45
46using com::sun::star::container::XNameAccess;
47
50using com::sun::star::uno::Any;
51using com::sun::star::uno::Type;
52
54
55
56namespace pq_sdbc_driver
57{
58Key::Key( const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
59 const Reference< css::sdbc::XConnection > & connection,
60 ConnectionSettings *pSettings,
61 OUString schemaName,
62 OUString tableName )
63 : ReflectionBase(
64 getStatics().refl.key.implName,
65 getStatics().refl.key.serviceNames,
66 refMutex,
67 connection,
68 pSettings,
69 * getStatics().refl.key.pProps ),
70 m_schemaName(std::move( schemaName )),
71 m_tableName(std::move( tableName ))
72{}
73
74Reference< XPropertySet > Key::createDataDescriptor( )
75{
77 m_xMutex, m_conn, m_pSettings );
78 pKeyDescriptor->copyValuesFrom( this );
79
80 return Reference< XPropertySet > ( pKeyDescriptor );
81}
82
83Reference< XNameAccess > Key::getColumns( )
84{
85 // TODO: cash columns object !
86 if( !m_keyColumns.is() )
87 {
88 Sequence< OUString > columnNames, foreignColumnNames;
89 getPropertyValue( getStatics().PRIVATE_COLUMNS ) >>= columnNames;
90 getPropertyValue( getStatics().PRIVATE_FOREIGN_COLUMNS ) >>= foreignColumnNames;
91
92 m_keyColumns = KeyColumns::create(
93 m_xMutex, m_conn, m_pSettings, m_schemaName,
94 m_tableName, columnNames, foreignColumnNames );
95 }
96 return m_keyColumns;
97}
98
99Sequence<Type > Key::getTypes()
100{
101 static cppu::OTypeCollection collection(
103 ReflectionBase::getTypes());
104
105 return collection.getTypes();
106}
107
108Sequence< sal_Int8> Key::getImplementationId()
109{
110 return css::uno::Sequence<sal_Int8>();
111}
112
113Any Key::queryInterface( const Type & reqType )
114{
115 Any ret = ReflectionBase::queryInterface( reqType );
116 if( ! ret.hasValue() )
117 ret = ::cppu::queryInterface(
118 reqType,
119 static_cast< css::sdbcx::XColumnsSupplier * > ( this ) );
120 return ret;
121}
122
123
124KeyDescriptor::KeyDescriptor( const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
125 const Reference< css::sdbc::XConnection > & connection,
126 ConnectionSettings *pSettings )
128 getStatics().refl.keyDescriptor.implName,
129 getStatics().refl.keyDescriptor.serviceNames,
130 refMutex,
131 connection,
132 pSettings,
133 * getStatics().refl.keyDescriptor.pProps )
134{
135}
136
138{
139 rtl::Reference<KeyDescriptor> pKeyDescriptor = new KeyDescriptor(
141 pKeyDescriptor->copyValuesFrom( this );
142
143 return Reference< XPropertySet > ( pKeyDescriptor );
144}
145
147{
148 // TODO: cash columns object !
149 if( !m_keyColumns.is() )
150 {
152 }
153 return m_keyColumns;
154}
155
157{
158 static cppu::OTypeCollection collection(
161
162 return collection.getTypes();
163}
164
166{
167 return css::uno::Sequence<sal_Int8>();
168}
169
171{
172 Any ret = ReflectionBase::queryInterface( reqType );
173 if( ! ret.hasValue() )
174 ret = ::cppu::queryInterface(
175 reqType,
176 static_cast< css::sdbcx::XColumnsSupplier * > ( this ) );
177 return ret;
178}
179
180
181}
182
183/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Sequence< css::uno::Type > SAL_CALL getTypes()
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: pq_xkey.cxx:156
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
Definition: pq_xkey.cxx:165
css::uno::Reference< css::container::XNameAccess > m_keyColumns
Definition: pq_xkey.hxx:90
virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL createDataDescriptor() override
Definition: pq_xkey.cxx:137
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &reqType) override
Definition: pq_xkey.cxx:170
KeyDescriptor(const ::rtl::Reference< comphelper::RefCountedMutex > &refMutex, const css::uno::Reference< css::sdbc::XConnection > &connection, ConnectionSettings *pSettings)
Definition: pq_xkey.cxx:124
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getColumns() override
Definition: pq_xkey.cxx:146
Key(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
Statics & getStatics()
Definition: pq_statics.cxx:112
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