Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / connectivity / source / drivers / postgresql / pq_xtable.hxx
blobfa2e1f00aba4a3e8381396039a0ad5aee95ddeae
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 #ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XTABLE_HXX
38 #define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_XTABLE_HXX
40 #include <cppuhelper/component.hxx>
41 #include <cppuhelper/propshlp.hxx>
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>
52 #include "pq_xbase.hxx"
54 namespace pq_sdbc_driver
57 class Columns;
59 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
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;
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();
79 public: // XInterface
80 virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { OComponentHelper::acquire(); }
81 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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
141 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
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;
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);
157 public: // XInterface
158 virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { OComponentHelper::acquire(); }
159 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;
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;
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;
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;
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;
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;
188 void copyProperties(
189 ReflectionBase *target,
190 const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > & source );
195 #endif
197 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */