1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_TABLE_HXX
21 #define INCLUDED_DBACCESS_SOURCE_CORE_INC_TABLE_HXX
23 #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
24 #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
25 #include <com/sun/star/sdbcx/XIndexesSupplier.hpp>
26 #include <com/sun/star/sdbcx/XKeysSupplier.hpp>
27 #include <com/sun/star/sdbcx/XRename.hpp>
28 #include <com/sun/star/sdbcx/XAlterTable.hpp>
29 #include <com/sun/star/lang/XServiceInfo.hpp>
30 #include <com/sun/star/sdbc/XRow.hpp>
31 #include <com/sun/star/sdbc/XConnection.hpp>
33 #include <cppuhelper/compbase7.hxx>
34 #include "apitools.hxx"
35 #include "datasettings.hxx"
37 #include <connectivity/CommonTools.hxx>
38 #include <connectivity/TTableHelper.hxx>
39 #include <comphelper/uno3.hxx>
40 #include <comphelper/IdPropArrayHelper.hxx>
47 class OContainerMediator
;
48 typedef ::comphelper::OIdPropertyArrayUsageHelper
< ODBTable
> ODBTable_PROP
;
49 typedef ::connectivity::OTableHelper OTable_Base
;
51 class ODBTable
:public ODataSettings_Base
54 ,public IColumnFactory
57 ::rtl::Reference
< OContainerMediator
> m_pColumnMediator
;
60 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> m_xColumnDefinitions
;
61 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> m_xDriverColumns
;
64 sal_Int32 m_nPrivileges
;
67 virtual ::cppu::IPropertyArrayHelper
* createArrayHelper( sal_Int32 _nId
) const SAL_OVERRIDE
;
68 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper() SAL_OVERRIDE
;
71 virtual OColumn
* createColumn(const OUString
& _rName
) const SAL_OVERRIDE
;
72 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> createColumnDescriptor() SAL_OVERRIDE
;
73 virtual void columnAppended( const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxSourceDescriptor
) SAL_OVERRIDE
;
74 virtual void columnDropped(const OUString
& _sName
) SAL_OVERRIDE
;
76 /** creates the column collection for the table
80 virtual ::connectivity::sdbcx::OCollection
* createColumns(const ::connectivity::TStringVector
& _rNames
) SAL_OVERRIDE
;
82 /** creates the key collection for the table
86 virtual ::connectivity::sdbcx::OCollection
* createKeys(const ::connectivity::TStringVector
& _rNames
) SAL_OVERRIDE
;
88 /** creates the index collection for the table
92 virtual ::connectivity::sdbcx::OCollection
* createIndexes(const ::connectivity::TStringVector
& _rNames
) SAL_OVERRIDE
;
95 virtual void SAL_CALL
disposing() SAL_OVERRIDE
;
97 /** constructs a wrapper supporting the com.sun.star.sdb.Table service.<BR>
98 @param _rxConn the connection the table belongs to
99 @param _rxTable the table from the driver can be null
100 @param _rCatalog the name of the catalog the table belongs to. May be empty.
101 @param _rSchema the name of the schema the table belongs to. May be empty.
102 @param _rName the name of the table
103 @param _rType the type of the table, as supplied by the driver
104 @param _rDesc the description of the table, as supplied by the driver
106 ODBTable(connectivity::sdbcx::OCollection
* _pTables
107 ,const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>& _rxConn
108 ,const OUString
& _rCatalog
109 , const OUString
& _rSchema
110 , const OUString
& _rName
111 ,const OUString
& _rType
112 , const OUString
& _rDesc
113 ,const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
>& _rxColumnDefinitions
)
114 throw(::com::sun::star::sdbc::SQLException
);
116 ODBTable(connectivity::sdbcx::OCollection
* _pTables
117 ,const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>& _rxConn
)
118 throw(::com::sun::star::sdbc::SQLException
);
122 virtual void construct() SAL_OVERRIDE
;
127 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
128 virtual ::com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId() throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
129 static ::com::sun::star::uno::Sequence
< sal_Int8
> getUnoTunnelImplementationId();
131 // ::com::sun::star::lang::XServiceInfo
132 DECLARE_SERVICE_INFO();
134 // com::sun::star::beans::XPropertySet
135 virtual void SAL_CALL
getFastPropertyValue(::com::sun::star::uno::Any
& rValue
, sal_Int32 nHandle
) const SAL_OVERRIDE
;
137 // ::com::sun::star::sdbcx::XRename,
138 virtual void SAL_CALL
rename( const OUString
& _rNewName
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::container::ElementExistException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
140 // ::com::sun::star::sdbcx::XAlterTable,
141 virtual void SAL_CALL
alterColumnByName( const 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
, std::exception
) SAL_OVERRIDE
;
143 // com::sun::star::lang::XUnoTunnel
144 virtual sal_Int64 SAL_CALL
getSomething( const ::com::sun::star::uno::Sequence
< sal_Int8
>& aIdentifier
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
147 using OTable_Base::createArrayHelper
;
148 using OTable_Base::getFastPropertyValue
;
151 #endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_TABLE_HXX
153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */