1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: table.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _DBA_CORE_TABLE_HXX_
32 #define _DBA_CORE_TABLE_HXX_
34 #ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_
35 #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
37 #ifndef _COM_SUN_STAR_SDBCX_XDATADESCRIPTORFACTORY_HPP_
38 #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
40 #ifndef _COM_SUN_STAR_SDBCX_XINDEXESSUPPLIER_HPP_
41 #include <com/sun/star/sdbcx/XIndexesSupplier.hpp>
43 #ifndef _COM_SUN_STAR_SDBCX_XKEYSSUPPLIER_HPP_
44 #include <com/sun/star/sdbcx/XKeysSupplier.hpp>
46 #ifndef _COM_SUN_STAR_SDBCX_XRENAME_HPP_
47 #include <com/sun/star/sdbcx/XRename.hpp>
49 #ifndef _COM_SUN_STAR_SDBCX_XALTERTABLE_HPP_
50 #include <com/sun/star/sdbcx/XAlterTable.hpp>
52 #ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
53 #include <com/sun/star/lang/XServiceInfo.hpp>
55 #ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
56 #include <com/sun/star/sdbc/XRow.hpp>
58 #ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
59 #include <com/sun/star/sdbc/XConnection.hpp>
62 #ifndef _CPPUHELPER_COMPBASE2_HXX_
63 #include <cppuhelper/compbase7.hxx>
65 #ifndef _DBASHARED_APITOOLS_HXX_
66 #include "apitools.hxx"
68 #ifndef _DBA_CORE_DATASETTINGS_HXX_
69 #include "datasettings.hxx"
71 #ifndef _DBA_COREAPI_COLUMN_HXX_
74 #ifndef _CONNECTIVITY_COMMONTOOLS_HXX_
75 #include <connectivity/CommonTools.hxx>
77 #ifndef CONNECTIVITY_TABLEHELPER_HXX
78 #include <connectivity/TTableHelper.hxx>
80 #ifndef _COMPHELPER_UNO3_HXX_
81 #include <comphelper/uno3.hxx>
83 #ifndef COMPHELPER_IDPROPERTYARRAYUSAGEHELPER_HXX
84 #include <comphelper/IdPropArrayHelper.hxx>
90 //==========================================================================
92 //==========================================================================
94 class OContainerMediator
;
95 typedef ::comphelper::OIdPropertyArrayUsageHelper
< ODBTable
> ODBTable_PROP
;
96 typedef ::connectivity::OTableHelper OTable_Base
;
98 class ODBTable
:public ODataSettings_Base
101 ,public IColumnFactory
104 ::rtl::Reference
< OContainerMediator
> m_pColumnMediator
;
107 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> m_xColumnDefinitions
;
108 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> m_xDriverColumns
;
111 sal_Int32 m_nPrivileges
;
114 virtual ::cppu::IPropertyArrayHelper
* createArrayHelper( sal_Int32 _nId
) const;
115 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper();
118 virtual OColumn
* createColumn(const ::rtl::OUString
& _rName
) const;
119 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> createColumnDescriptor();
120 virtual void columnAppended( const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxSourceDescriptor
);
121 virtual void columnDropped(const ::rtl::OUString
& _sName
);
123 /** creates the column collection for the table
127 virtual ::connectivity::sdbcx::OCollection
* createColumns(const ::connectivity::TStringVector
& _rNames
);
129 /** creates the key collection for the table
133 virtual ::connectivity::sdbcx::OCollection
* createKeys(const ::connectivity::TStringVector
& _rNames
);
135 /** creates the index collection for the table
139 virtual ::connectivity::sdbcx::OCollection
* createIndexes(const ::connectivity::TStringVector
& _rNames
);
142 virtual void SAL_CALL
disposing(void);
144 /** constructs a wrapper supporting the com.sun.star.sdb.Table service.<BR>
145 @param _rxConn the connection the table belongs to
146 @param _rxTable the table from the driver can be null
147 @param _rCatalog the name of the catalog the table belongs to. May be empty.
148 @param _rSchema the name of the schema the table belongs to. May be empty.
149 @param _rName the name of the table
150 @param _rType the type of the table, as supplied by the driver
151 @param _rDesc the description of the table, as supplied by the driver
153 ODBTable(connectivity::sdbcx::OCollection
* _pTables
154 ,const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>& _rxConn
155 ,const ::rtl::OUString
& _rCatalog
156 , const ::rtl::OUString
& _rSchema
157 , const ::rtl::OUString
& _rName
158 ,const ::rtl::OUString
& _rType
159 , const ::rtl::OUString
& _rDesc
160 ,const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
>& _rxColumnDefinitions
)
161 throw(::com::sun::star::sdbc::SQLException
);
163 ODBTable(connectivity::sdbcx::OCollection
* _pTables
164 ,const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>& _rxConn
)
165 throw(::com::sun::star::sdbc::SQLException
);
169 virtual void construct();
174 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes( ) throw(::com::sun::star::uno::RuntimeException
);
175 virtual ::com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId() throw (::com::sun::star::uno::RuntimeException
);
176 static ::com::sun::star::uno::Sequence
< sal_Int8
> getUnoTunnelImplementationId();
178 // ::com::sun::star::lang::XServiceInfo
179 DECLARE_SERVICE_INFO();
181 // com::sun::star::beans::XPropertySet
182 // virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
183 virtual void SAL_CALL
getFastPropertyValue(::com::sun::star::uno::Any
& rValue
, sal_Int32 nHandle
) const;
185 // ::com::sun::star::sdbcx::XRename,
186 virtual void SAL_CALL
rename( const ::rtl::OUString
& _rNewName
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::container::ElementExistException
, ::com::sun::star::uno::RuntimeException
);
188 // ::com::sun::star::sdbcx::XAlterTable,
189 virtual void SAL_CALL
alterColumnByName( const ::rtl::OUString
& _rName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxDescriptor
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::container::NoSuchElementException
, ::com::sun::star::uno::RuntimeException
);
191 // com::sun::star::lang::XUnoTunnel
192 virtual sal_Int64 SAL_CALL
getSomething( const ::com::sun::star::uno::Sequence
< sal_Int8
>& aIdentifier
) throw(::com::sun::star::uno::RuntimeException
);
195 using OTable_Base::createArrayHelper
;
196 using OTable_Base::getFastPropertyValue
;
199 #endif // _DBA_CORE_TABLE_HXX_