Branch data 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 : : * Version: MPL 1.1 / GPLv3+ / LGPLv2.1+
32 : : *
33 : : * The contents of this file are subject to the Mozilla Public License Version
34 : : * 1.1 (the "License"); you may not use this file except in compliance with
35 : : * the License or as specified alternatively below. You may obtain a copy of
36 : : * the License at http://www.mozilla.org/MPL/
37 : : *
38 : : * Software distributed under the License is distributed on an "AS IS" basis,
39 : : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
40 : : * for the specific language governing rights and limitations under the
41 : : * License.
42 : : *
43 : : * Major Contributor(s):
44 : : * [ Copyright (C) 2011 Lionel Elie Mamane <lionel@mamane.lu> ]
45 : : *
46 : : * All Rights Reserved.
47 : : *
48 : : * For minor contributions see the git repository.
49 : : *
50 : : * Alternatively, the contents of this file may be used under the terms of
51 : : * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
52 : : * the GNU Lesser General Public License Version 2.1 or later (the "LGPLv2.1+"),
53 : : * in which case the provisions of the GPLv3+ or the LGPLv2.1+ are applicable
54 : : * instead of those above.
55 : : *
56 : : ************************************************************************/
57 : :
58 : : #ifndef _PQ_TABLE_HXX_
59 : : #define _PQ_TABLE_HXX_
60 : :
61 : : #include <cppuhelper/component.hxx>
62 : : #include <cppuhelper/propshlp.hxx>
63 : :
64 : : #include <com/sun/star/lang/XServiceInfo.hpp>
65 : : #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
66 : : #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
67 : : #include <com/sun/star/sdbcx/XIndexesSupplier.hpp>
68 : : #include <com/sun/star/sdbcx/XKeysSupplier.hpp>
69 : : #include <com/sun/star/sdbcx/XRename.hpp>
70 : : #include <com/sun/star/sdbcx/XAlterTable.hpp>
71 : : #include <com/sun/star/container/XNamed.hpp>
72 : :
73 : : #include "pq_xbase.hxx"
74 : :
75 : : namespace pq_sdbc_driver
76 : : {
77 : :
78 : : class Columns;
79 : :
80 : 0 : class Table : public ReflectionBase,
81 : : public com::sun::star::sdbcx::XColumnsSupplier,
82 : : public com::sun::star::sdbcx::XIndexesSupplier,
83 : : public com::sun::star::sdbcx::XKeysSupplier,
84 : : public com::sun::star::sdbcx::XRename,
85 : : public com::sun::star::sdbcx::XAlterTable
86 : : {
87 : : ::com::sun::star::uno::Reference< com::sun::star::sdbc::XDatabaseMetaData > m_meta;
88 : : ::com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > m_columns;
89 : : ::com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > m_keys;
90 : : ::com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > m_indexes;
91 : : Columns *m_pColumns;
92 : :
93 : : public:
94 : : Table( const ::rtl::Reference< RefCountedMutex > & refMutex,
95 : : const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & connection,
96 : : ConnectionSettings *pSettings);
97 : : public:
98 : : void refetch();
99 : :
100 : : public: // XInterface
101 : 0 : virtual void SAL_CALL acquire() throw() { OComponentHelper::acquire(); }
102 : 0 : virtual void SAL_CALL release() throw() { OComponentHelper::release(); }
103 : : virtual com::sun::star::uno::Any SAL_CALL queryInterface(
104 : : const com::sun::star::uno::Type & reqType )
105 : : throw (com::sun::star::uno::RuntimeException);
106 : :
107 : : public: // XTypeProvider, first implemented by OPropertySetHelper
108 : : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes()
109 : : throw( com::sun::star::uno::RuntimeException );
110 : : virtual com::sun::star::uno::Sequence< sal_Int8> SAL_CALL getImplementationId()
111 : : throw( com::sun::star::uno::RuntimeException );
112 : :
113 : : public: // XDataDescriptorFactory
114 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL
115 : : createDataDescriptor( ) throw (::com::sun::star::uno::RuntimeException);
116 : :
117 : : public: // XColumnsSupplier
118 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL
119 : : getColumns( ) throw (::com::sun::star::uno::RuntimeException);
120 : :
121 : : public: // XIndexesSupplier
122 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL
123 : : getIndexes( ) throw (::com::sun::star::uno::RuntimeException);
124 : :
125 : : public: // XKeysSupplier
126 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL
127 : : getKeys( ) throw (::com::sun::star::uno::RuntimeException);
128 : :
129 : : public: // XRename
130 : : virtual void SAL_CALL rename( const ::rtl::OUString& newName )
131 : : throw (::com::sun::star::sdbc::SQLException,
132 : : ::com::sun::star::container::ElementExistException,
133 : : ::com::sun::star::uno::RuntimeException);
134 : :
135 : : public: // XAlterTable
136 : : // Methods
137 : : virtual void SAL_CALL alterColumnByName(
138 : : const ::rtl::OUString& colName,
139 : : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor )
140 : : throw (::com::sun::star::sdbc::SQLException,
141 : : ::com::sun::star::container::NoSuchElementException,
142 : : ::com::sun::star::uno::RuntimeException);
143 : :
144 : : virtual void SAL_CALL alterColumnByIndex(
145 : : sal_Int32 index,
146 : : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor )
147 : : throw (::com::sun::star::sdbc::SQLException,
148 : : ::com::sun::star::lang::IndexOutOfBoundsException,
149 : : ::com::sun::star::uno::RuntimeException);
150 : :
151 : : public: // TODO: remove again
152 : : virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(const ::rtl::OUString& aPropertyName)
153 : : throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
154 : :
155 : : public: // XNamed
156 : : virtual ::rtl::OUString SAL_CALL getName( ) throw (::com::sun::star::uno::RuntimeException);
157 : : virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException);
158 : : };
159 : :
160 : :
161 : :
162 : 0 : class TableDescriptor
163 : : : public ReflectionBase,
164 : : public com::sun::star::sdbcx::XColumnsSupplier,
165 : : public com::sun::star::sdbcx::XIndexesSupplier,
166 : : public com::sun::star::sdbcx::XKeysSupplier
167 : : {
168 : : ::com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > m_columns;
169 : : ::com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > m_keys;
170 : : ::com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > m_indexes;
171 : :
172 : : public:
173 : : TableDescriptor(
174 : : const ::rtl::Reference< RefCountedMutex > & refMutex,
175 : : const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & connection,
176 : : ConnectionSettings *pSettings);
177 : :
178 : : public: // XInterface
179 : 0 : virtual void SAL_CALL acquire() throw() { OComponentHelper::acquire(); }
180 : 0 : virtual void SAL_CALL release() throw() { OComponentHelper::release(); }
181 : : virtual com::sun::star::uno::Any SAL_CALL queryInterface(
182 : : const com::sun::star::uno::Type & reqType )
183 : : throw (com::sun::star::uno::RuntimeException);
184 : :
185 : : public: // XTypeProvider, first implemented by OPropertySetHelper
186 : : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes()
187 : : throw( com::sun::star::uno::RuntimeException );
188 : : virtual com::sun::star::uno::Sequence< sal_Int8> SAL_CALL getImplementationId()
189 : : throw( com::sun::star::uno::RuntimeException );
190 : :
191 : : public: // XColumnsSupplier
192 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL
193 : : getColumns( ) throw (::com::sun::star::uno::RuntimeException);
194 : :
195 : : public: // XIndexesSupplier
196 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL
197 : : getIndexes( ) throw (::com::sun::star::uno::RuntimeException);
198 : :
199 : : public: // XKeysSupplier
200 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL
201 : : getKeys( ) throw (::com::sun::star::uno::RuntimeException);
202 : :
203 : : public: // XDataDescriptorFactory
204 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL
205 : : createDataDescriptor( ) throw (::com::sun::star::uno::RuntimeException);
206 : : };
207 : :
208 : :
209 : : void copyProperties(
210 : : ReflectionBase *target,
211 : : const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > & source );
212 : :
213 : : }
214 : :
215 : :
216 : : #endif
|