1 /*************************************************************************
3 * $RCSfile: pq_xtable.hxx,v $
7 * last change: $Author: jbu $ $Date: 2004/06/10 15:27:10 $
9 * The Contents of this file are made available subject to the terms of
10 * either of the following licenses
12 * - GNU Lesser General Public License Version 2.1
13 * - Sun Industry Standards Source License Version 1.1
15 * Sun Microsystems Inc., October, 2000
17 * GNU Lesser General Public License Version 2.1
18 * =============================================
19 * Copyright 2000 by Sun Microsystems, Inc.
20 * 901 San Antonio Road, Palo Alto, CA 94303, USA
22 * This library is free software; you can redistribute it and/or
23 * modify it under the terms of the GNU Lesser General Public
24 * License version 2.1, as published by the Free Software Foundation.
26 * This library is distributed in the hope that it will be useful,
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29 * Lesser General Public License for more details.
31 * You should have received a copy of the GNU Lesser General Public
32 * License along with this library; if not, write to the Free Software
33 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
37 * Sun Industry Standards Source License Version 1.1
38 * =================================================
39 * The contents of this file are subject to the Sun Industry Standards
40 * Source License Version 1.1 (the "License"); You may not use this file
41 * except in compliance with the License. You may obtain a copy of the
42 * License at http://www.openoffice.org/license.html.
44 * Software provided under this License is provided on an "AS IS" basis,
45 * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
46 * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
47 * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
48 * See the License for the specific provisions governing your rights and
49 * obligations concerning the Software.
51 * The Initial Developer of the Original Code is: Joerg Budischewski
53 * Copyright: 2000 by Sun Microsystems, Inc.
55 * All Rights Reserved.
57 * Contributor(s): Joerg Budischewski
60 ************************************************************************/
62 #ifndef _PQ_TABLE_HXX_
63 #define _PQ_TABLE_HXX_
65 #include <cppuhelper/component.hxx>
66 #include <cppuhelper/propshlp.hxx>
68 #include <com/sun/star/lang/XServiceInfo.hpp>
69 #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
70 #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
71 #include <com/sun/star/sdbcx/XIndexesSupplier.hpp>
72 #include <com/sun/star/sdbcx/XKeysSupplier.hpp>
73 #include <com/sun/star/sdbcx/XRename.hpp>
74 #include <com/sun/star/sdbcx/XAlterTable.hpp>
75 #include <com/sun/star/container/XNamed.hpp>
77 #include "pq_xbase.hxx"
79 namespace pq_sdbc_driver
84 class Table
: public ReflectionBase
,
85 public com::sun::star::sdbcx::XColumnsSupplier
,
86 public com::sun::star::sdbcx::XIndexesSupplier
,
87 public com::sun::star::sdbcx::XKeysSupplier
,
88 public com::sun::star::sdbcx::XRename
,
89 public com::sun::star::sdbcx::XAlterTable
91 ::com::sun::star::uno::Reference
< com::sun::star::sdbc::XDatabaseMetaData
> m_meta
;
92 ::com::sun::star::uno::Reference
< com::sun::star::container::XNameAccess
> m_columns
;
93 ::com::sun::star::uno::Reference
< com::sun::star::container::XIndexAccess
> m_keys
;
94 ::com::sun::star::uno::Reference
< com::sun::star::container::XNameAccess
> m_indexes
;
98 Table( const ::rtl::Reference
< RefCountedMutex
> & refMutex
,
99 const ::com::sun::star::uno::Reference
< com::sun::star::sdbc::XConnection
> & connection
,
100 ConnectionSettings
*pSettings
);
104 public: // XInterface
105 virtual void SAL_CALL
acquire() throw() { OComponentHelper::acquire(); }
106 virtual void SAL_CALL
release() throw() { OComponentHelper::release(); }
107 virtual com::sun::star::uno::Any SAL_CALL
queryInterface(
108 const com::sun::star::uno::Type
& reqType
)
109 throw (com::sun::star::uno::RuntimeException
);
111 public: // XTypeProvider, first implemented by OPropertySetHelper
112 virtual com::sun::star::uno::Sequence
< com::sun::star::uno::Type
> SAL_CALL
getTypes()
113 throw( com::sun::star::uno::RuntimeException
);
114 virtual com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId()
115 throw( com::sun::star::uno::RuntimeException
);
117 public: // XDataDescriptorFactory
118 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> SAL_CALL
119 createDataDescriptor( ) throw (::com::sun::star::uno::RuntimeException
);
121 public: // XColumnsSupplier
122 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> SAL_CALL
123 getColumns( ) throw (::com::sun::star::uno::RuntimeException
);
125 public: // XIndexesSupplier
126 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> SAL_CALL
127 getIndexes( ) throw (::com::sun::star::uno::RuntimeException
);
129 public: // XKeysSupplier
130 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XIndexAccess
> SAL_CALL
131 getKeys( ) throw (::com::sun::star::uno::RuntimeException
);
134 virtual void SAL_CALL
rename( const ::rtl::OUString
& newName
)
135 throw (::com::sun::star::sdbc::SQLException
,
136 ::com::sun::star::container::ElementExistException
,
137 ::com::sun::star::uno::RuntimeException
);
139 public: // XAlterTable
141 virtual void SAL_CALL
alterColumnByName(
142 const ::rtl::OUString
& colName
,
143 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& descriptor
)
144 throw (::com::sun::star::sdbc::SQLException
,
145 ::com::sun::star::container::NoSuchElementException
,
146 ::com::sun::star::uno::RuntimeException
);
148 virtual void SAL_CALL
alterColumnByIndex(
150 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& descriptor
)
151 throw (::com::sun::star::sdbc::SQLException
,
152 ::com::sun::star::lang::IndexOutOfBoundsException
,
153 ::com::sun::star::uno::RuntimeException
);
155 public: // TODO: remove again
156 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(const ::rtl::OUString
& aPropertyName
)
157 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
160 virtual ::rtl::OUString SAL_CALL
getName( ) throw (::com::sun::star::uno::RuntimeException
);
161 virtual void SAL_CALL
setName( const ::rtl::OUString
& aName
) throw (::com::sun::star::uno::RuntimeException
);
166 class TableDescriptor
167 : public ReflectionBase
,
168 public com::sun::star::sdbcx::XColumnsSupplier
,
169 public com::sun::star::sdbcx::XIndexesSupplier
,
170 public com::sun::star::sdbcx::XKeysSupplier
172 ::com::sun::star::uno::Reference
< com::sun::star::container::XNameAccess
> m_columns
;
173 ::com::sun::star::uno::Reference
< com::sun::star::container::XIndexAccess
> m_keys
;
174 ::com::sun::star::uno::Reference
< com::sun::star::container::XNameAccess
> m_indexes
;
178 const ::rtl::Reference
< RefCountedMutex
> & refMutex
,
179 const ::com::sun::star::uno::Reference
< com::sun::star::sdbc::XConnection
> & connection
,
180 ConnectionSettings
*pSettings
);
182 public: // XInterface
183 virtual void SAL_CALL
acquire() throw() { OComponentHelper::acquire(); }
184 virtual void SAL_CALL
release() throw() { OComponentHelper::release(); }
185 virtual com::sun::star::uno::Any SAL_CALL
queryInterface(
186 const com::sun::star::uno::Type
& reqType
)
187 throw (com::sun::star::uno::RuntimeException
);
189 public: // XTypeProvider, first implemented by OPropertySetHelper
190 virtual com::sun::star::uno::Sequence
< com::sun::star::uno::Type
> SAL_CALL
getTypes()
191 throw( com::sun::star::uno::RuntimeException
);
192 virtual com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId()
193 throw( com::sun::star::uno::RuntimeException
);
195 public: // XColumnsSupplier
196 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> SAL_CALL
197 getColumns( ) throw (::com::sun::star::uno::RuntimeException
);
199 public: // XIndexesSupplier
200 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> SAL_CALL
201 getIndexes( ) throw (::com::sun::star::uno::RuntimeException
);
203 public: // XKeysSupplier
204 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XIndexAccess
> SAL_CALL
205 getKeys( ) throw (::com::sun::star::uno::RuntimeException
);
207 public: // XDataDescriptorFactory
208 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> SAL_CALL
209 createDataDescriptor( ) throw (::com::sun::star::uno::RuntimeException
);
214 ReflectionBase
*target
,
215 const com::sun::star::uno::Reference
< com::sun::star::beans::XPropertySet
> & source
);