nss: upgrade to release 3.73
[LibreOffice.git] / connectivity / source / drivers / postgresql / pq_xkey.cxx
blobed0b2669e894c23f2df5b8745a902bafff979ade
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 <cppuhelper/typeprovider.hxx>
38 #include <cppuhelper/queryinterface.hxx>
40 #include "pq_xkey.hxx"
41 #include "pq_xkeycolumns.hxx"
42 #include "pq_statics.hxx"
44 using com::sun::star::container::XNameAccess;
46 using com::sun::star::uno::Reference;
47 using com::sun::star::uno::Sequence;
48 using com::sun::star::uno::Any;
49 using com::sun::star::uno::Type;
51 using com::sun::star::beans::XPropertySet;
54 namespace pq_sdbc_driver
56 Key::Key( const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
57 const Reference< css::sdbc::XConnection > & connection,
58 ConnectionSettings *pSettings,
59 const OUString & schemaName,
60 const OUString & tableName )
61 : ReflectionBase(
62 getStatics().refl.key.implName,
63 getStatics().refl.key.serviceNames,
64 refMutex,
65 connection,
66 pSettings,
67 * getStatics().refl.key.pProps ),
68 m_schemaName( schemaName ),
69 m_tableName( tableName )
72 Reference< XPropertySet > Key::createDataDescriptor( )
74 KeyDescriptor * pKeyDescriptor = new KeyDescriptor(
75 m_xMutex, m_conn, m_pSettings );
76 pKeyDescriptor->copyValuesFrom( this );
78 return Reference< XPropertySet > ( pKeyDescriptor );
81 Reference< XNameAccess > Key::getColumns( )
83 // TODO: cash columns object !
84 if( !m_keyColumns.is() )
86 Sequence< OUString > columnNames, foreignColumnNames;
87 getPropertyValue( getStatics().PRIVATE_COLUMNS ) >>= columnNames;
88 getPropertyValue( getStatics().PRIVATE_FOREIGN_COLUMNS ) >>= foreignColumnNames;
90 m_keyColumns = KeyColumns::create(
91 m_xMutex, m_conn, m_pSettings, m_schemaName,
92 m_tableName, columnNames, foreignColumnNames );
94 return m_keyColumns;
97 Sequence<Type > Key::getTypes()
99 static cppu::OTypeCollection collection(
100 cppu::UnoType<css::sdbcx::XColumnsSupplier>::get(),
101 ReflectionBase::getTypes());
103 return collection.getTypes();
106 Sequence< sal_Int8> Key::getImplementationId()
108 return css::uno::Sequence<sal_Int8>();
111 Any Key::queryInterface( const Type & reqType )
113 Any ret = ReflectionBase::queryInterface( reqType );
114 if( ! ret.hasValue() )
115 ret = ::cppu::queryInterface(
116 reqType,
117 static_cast< css::sdbcx::XColumnsSupplier * > ( this ) );
118 return ret;
122 KeyDescriptor::KeyDescriptor( const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
123 const Reference< css::sdbc::XConnection > & connection,
124 ConnectionSettings *pSettings )
125 : ReflectionBase(
126 getStatics().refl.keyDescriptor.implName,
127 getStatics().refl.keyDescriptor.serviceNames,
128 refMutex,
129 connection,
130 pSettings,
131 * getStatics().refl.keyDescriptor.pProps )
135 Reference< XPropertySet > KeyDescriptor::createDataDescriptor( )
137 KeyDescriptor * pKeyDescriptor = new KeyDescriptor(
138 m_xMutex, m_conn, m_pSettings );
139 pKeyDescriptor->copyValuesFrom( this );
141 return Reference< XPropertySet > ( pKeyDescriptor );
144 Reference< XNameAccess > KeyDescriptor::getColumns( )
146 // TODO: cash columns object !
147 if( !m_keyColumns.is() )
149 m_keyColumns = new KeyColumnDescriptors( m_xMutex, m_conn, m_pSettings );
151 return m_keyColumns;
154 Sequence<Type > KeyDescriptor::getTypes()
156 static cppu::OTypeCollection collection(
157 cppu::UnoType<css::sdbcx::XColumnsSupplier>::get(),
158 ReflectionBase::getTypes());
160 return collection.getTypes();
163 Sequence< sal_Int8> KeyDescriptor::getImplementationId()
165 return css::uno::Sequence<sal_Int8>();
168 Any KeyDescriptor::queryInterface( const Type & reqType )
170 Any ret = ReflectionBase::queryInterface( reqType );
171 if( ! ret.hasValue() )
172 ret = ::cppu::queryInterface(
173 reqType,
174 static_cast< css::sdbcx::XColumnsSupplier * > ( this ) );
175 return ret;
181 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */