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 _DBA_CORE_TABLE_HXX_
21 #define _DBA_CORE_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>
45 //==========================================================================
47 //==========================================================================
49 class OContainerMediator
;
50 typedef ::comphelper::OIdPropertyArrayUsageHelper
< ODBTable
> ODBTable_PROP
;
51 typedef ::connectivity::OTableHelper OTable_Base
;
53 class ODBTable
:public ODataSettings_Base
56 ,public IColumnFactory
59 ::rtl::Reference
< OContainerMediator
> m_pColumnMediator
;
62 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> m_xColumnDefinitions
;
63 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> m_xDriverColumns
;
66 sal_Int32 m_nPrivileges
;
69 virtual ::cppu::IPropertyArrayHelper
* createArrayHelper( sal_Int32 _nId
) const;
70 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper();
73 virtual OColumn
* createColumn(const ::rtl::OUString
& _rName
) const;
74 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> createColumnDescriptor();
75 virtual void columnAppended( const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxSourceDescriptor
);
76 virtual void columnDropped(const ::rtl::OUString
& _sName
);
78 /** creates the column collection for the table
82 virtual ::connectivity::sdbcx::OCollection
* createColumns(const ::connectivity::TStringVector
& _rNames
);
84 /** creates the key collection for the table
88 virtual ::connectivity::sdbcx::OCollection
* createKeys(const ::connectivity::TStringVector
& _rNames
);
90 /** creates the index collection for the table
94 virtual ::connectivity::sdbcx::OCollection
* createIndexes(const ::connectivity::TStringVector
& _rNames
);
97 virtual void SAL_CALL
disposing(void);
99 /** constructs a wrapper supporting the com.sun.star.sdb.Table service.<BR>
100 @param _rxConn the connection the table belongs to
101 @param _rxTable the table from the driver can be null
102 @param _rCatalog the name of the catalog the table belongs to. May be empty.
103 @param _rSchema the name of the schema the table belongs to. May be empty.
104 @param _rName the name of the table
105 @param _rType the type of the table, as supplied by the driver
106 @param _rDesc the description of the table, as supplied by the driver
108 ODBTable(connectivity::sdbcx::OCollection
* _pTables
109 ,const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>& _rxConn
110 ,const ::rtl::OUString
& _rCatalog
111 , const ::rtl::OUString
& _rSchema
112 , const ::rtl::OUString
& _rName
113 ,const ::rtl::OUString
& _rType
114 , const ::rtl::OUString
& _rDesc
115 ,const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
>& _rxColumnDefinitions
)
116 throw(::com::sun::star::sdbc::SQLException
);
118 ODBTable(connectivity::sdbcx::OCollection
* _pTables
119 ,const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>& _rxConn
)
120 throw(::com::sun::star::sdbc::SQLException
);
124 virtual void construct();
129 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes( ) throw(::com::sun::star::uno::RuntimeException
);
130 virtual ::com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId() throw (::com::sun::star::uno::RuntimeException
);
131 static ::com::sun::star::uno::Sequence
< sal_Int8
> getUnoTunnelImplementationId();
133 // ::com::sun::star::lang::XServiceInfo
134 DECLARE_SERVICE_INFO();
136 // com::sun::star::beans::XPropertySet
137 virtual void SAL_CALL
getFastPropertyValue(::com::sun::star::uno::Any
& rValue
, sal_Int32 nHandle
) const;
139 // ::com::sun::star::sdbcx::XRename,
140 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
);
142 // ::com::sun::star::sdbcx::XAlterTable,
143 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
);
145 // com::sun::star::lang::XUnoTunnel
146 virtual sal_Int64 SAL_CALL
getSomething( const ::com::sun::star::uno::Sequence
< sal_Int8
>& aIdentifier
) throw(::com::sun::star::uno::RuntimeException
);
149 using OTable_Base::createArrayHelper
;
150 using OTable_Base::getFastPropertyValue
;
153 #endif // _DBA_CORE_TABLE_HXX_
156 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */