Line data Source code
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 :
37 : #ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XTABLE_HXX
38 : #define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XTABLE_HXX
39 :
40 : #include <cppuhelper/component.hxx>
41 : #include <cppuhelper/propshlp.hxx>
42 :
43 : #include <com/sun/star/lang/XServiceInfo.hpp>
44 : #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
45 : #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
46 : #include <com/sun/star/sdbcx/XIndexesSupplier.hpp>
47 : #include <com/sun/star/sdbcx/XKeysSupplier.hpp>
48 : #include <com/sun/star/sdbcx/XRename.hpp>
49 : #include <com/sun/star/sdbcx/XAlterTable.hpp>
50 : #include <com/sun/star/container/XNamed.hpp>
51 :
52 : #include "pq_xbase.hxx"
53 :
54 : namespace pq_sdbc_driver
55 : {
56 :
57 : class Columns;
58 :
59 0 : class Table : public ReflectionBase,
60 : public com::sun::star::sdbcx::XColumnsSupplier,
61 : public com::sun::star::sdbcx::XIndexesSupplier,
62 : public com::sun::star::sdbcx::XKeysSupplier,
63 : public com::sun::star::sdbcx::XRename,
64 : public com::sun::star::sdbcx::XAlterTable
65 : {
66 : ::com::sun::star::uno::Reference< com::sun::star::sdbc::XDatabaseMetaData > m_meta;
67 : ::com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > m_columns;
68 : ::com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > m_keys;
69 : ::com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > m_indexes;
70 : Columns *m_pColumns;
71 :
72 : public:
73 : Table( const ::rtl::Reference< RefCountedMutex > & refMutex,
74 : const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & connection,
75 : ConnectionSettings *pSettings);
76 : public:
77 : void refetch();
78 :
79 : public: // XInterface
80 0 : virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { OComponentHelper::acquire(); }
81 0 : virtual void SAL_CALL release() throw() SAL_OVERRIDE { OComponentHelper::release(); }
82 : virtual com::sun::star::uno::Any SAL_CALL queryInterface(
83 : const com::sun::star::uno::Type & reqType )
84 : throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
85 :
86 : public: // XTypeProvider, first implemented by OPropertySetHelper
87 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes()
88 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
89 : virtual com::sun::star::uno::Sequence< sal_Int8> SAL_CALL getImplementationId()
90 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
91 :
92 : public: // XDataDescriptorFactory
93 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL
94 : createDataDescriptor( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
95 :
96 : public: // XColumnsSupplier
97 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL
98 : getColumns( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
99 :
100 : public: // XIndexesSupplier
101 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL
102 : getIndexes( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
103 :
104 : public: // XKeysSupplier
105 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL
106 : getKeys( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
107 :
108 : public: // XRename
109 : virtual void SAL_CALL rename( const OUString& newName )
110 : throw (::com::sun::star::sdbc::SQLException,
111 : ::com::sun::star::container::ElementExistException,
112 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
113 :
114 : public: // XAlterTable
115 : // Methods
116 : virtual void SAL_CALL alterColumnByName(
117 : const OUString& colName,
118 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor )
119 : throw (::com::sun::star::sdbc::SQLException,
120 : ::com::sun::star::container::NoSuchElementException,
121 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
122 :
123 : virtual void SAL_CALL alterColumnByIndex(
124 : sal_Int32 index,
125 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor )
126 : throw (::com::sun::star::sdbc::SQLException,
127 : ::com::sun::star::lang::IndexOutOfBoundsException,
128 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
129 :
130 : public: // TODO: remove again
131 : virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(const OUString& aPropertyName)
132 : throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
133 :
134 : public: // XNamed
135 : virtual OUString SAL_CALL getName( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
136 : virtual void SAL_CALL setName( const OUString& aName ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
137 : };
138 :
139 :
140 :
141 0 : class TableDescriptor
142 : : public ReflectionBase,
143 : public com::sun::star::sdbcx::XColumnsSupplier,
144 : public com::sun::star::sdbcx::XIndexesSupplier,
145 : public com::sun::star::sdbcx::XKeysSupplier
146 : {
147 : ::com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > m_columns;
148 : ::com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > m_keys;
149 : ::com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > m_indexes;
150 :
151 : public:
152 : TableDescriptor(
153 : const ::rtl::Reference< RefCountedMutex > & refMutex,
154 : const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & connection,
155 : ConnectionSettings *pSettings);
156 :
157 : public: // XInterface
158 0 : virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { OComponentHelper::acquire(); }
159 0 : virtual void SAL_CALL release() throw() SAL_OVERRIDE { OComponentHelper::release(); }
160 : virtual com::sun::star::uno::Any SAL_CALL queryInterface(
161 : const com::sun::star::uno::Type & reqType )
162 : throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
163 :
164 : public: // XTypeProvider, first implemented by OPropertySetHelper
165 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes()
166 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
167 : virtual com::sun::star::uno::Sequence< sal_Int8> SAL_CALL getImplementationId()
168 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
169 :
170 : public: // XColumnsSupplier
171 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL
172 : getColumns( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
173 :
174 : public: // XIndexesSupplier
175 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL
176 : getIndexes( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
177 :
178 : public: // XKeysSupplier
179 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL
180 : getKeys( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
181 :
182 : public: // XDataDescriptorFactory
183 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL
184 : createDataDescriptor( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
185 : };
186 :
187 :
188 : void copyProperties(
189 : ReflectionBase *target,
190 : const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > & source );
191 :
192 : }
193 :
194 :
195 : #endif
196 :
197 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|