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 .
22 #include <com/sun/star/sdbc/XConnection.hpp>
24 #include "datasettings.hxx"
26 #include <connectivity/CommonTools.hxx>
27 #include <connectivity/TTableHelper.hxx>
28 #include <comphelper/IdPropArrayHelper.hxx>
35 class OContainerMediator
;
36 typedef ::comphelper::OIdPropertyArrayUsageHelper
< ODBTable
> ODBTable_PROP
;
37 typedef ::connectivity::OTableHelper OTable_Base
;
39 class ODBTable
:public ODataSettings_Base
42 ,public IColumnFactory
45 ::rtl::Reference
< OContainerMediator
> m_pColumnMediator
;
47 css::uno::Reference
< css::container::XNameAccess
> m_xColumnDefinitions
;
48 css::uno::Reference
< css::container::XNameAccess
> m_xDriverColumns
;
51 sal_Int32 m_nPrivileges
;
55 virtual ::cppu::IPropertyArrayHelper
* createArrayHelper( sal_Int32 _nId
) const override
;
56 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper() override
;
59 virtual rtl::Reference
<OColumn
> createColumn(const OUString
& _rName
) const override
;
60 virtual css::uno::Reference
< css::beans::XPropertySet
> createColumnDescriptor() override
;
61 virtual void columnAppended( const css::uno::Reference
< css::beans::XPropertySet
>& _rxSourceDescriptor
) override
;
62 virtual void columnDropped(const OUString
& _sName
) override
;
64 /** creates the column collection for the table
68 virtual ::connectivity::sdbcx::OCollection
* createColumns(const ::std::vector
< OUString
>& _rNames
) override
;
70 /** creates the key collection for the table
74 virtual ::connectivity::sdbcx::OCollection
* createKeys(const ::std::vector
< OUString
>& _rNames
) override
;
76 /** creates the index collection for the table
80 virtual ::connectivity::sdbcx::OCollection
* createIndexes(const ::std::vector
< OUString
>& _rNames
) override
;
83 virtual void SAL_CALL
disposing() override
;
85 /** constructs a wrapper supporting the com.sun.star.sdb.Table service.<BR>
86 @param _rxConn the connection the table belongs to
87 @param _rxTable the table from the driver can be null
88 @param _rCatalog the name of the catalog the table belongs to. May be empty.
89 @param _rSchema the name of the schema the table belongs to. May be empty.
90 @param _rName the name of the table
91 @param _rType the type of the table, as supplied by the driver
92 @param _rDesc the description of the table, as supplied by the driver
93 @throws css::sdbc::SQLException
95 ODBTable(connectivity::sdbcx::OCollection
* _pTables
96 ,const css::uno::Reference
< css::sdbc::XConnection
>& _rxConn
97 ,const OUString
& _rCatalog
98 , const OUString
& _rSchema
99 , const OUString
& _rName
100 ,const OUString
& _rType
101 , const OUString
& _rDesc
102 ,const css::uno::Reference
< css::container::XNameAccess
>& _rxColumnDefinitions
);
104 /// @throws css::sdbc::SQLException
105 ODBTable(connectivity::sdbcx::OCollection
* _pTables
106 ,const css::uno::Reference
< css::sdbc::XConnection
>& _rxConn
);
107 virtual ~ODBTable() override
;
110 virtual void construct() override
;
113 virtual css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& aType
) override
;
115 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes( ) override
;
116 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId() override
;
118 // css::lang::XServiceInfo
119 DECLARE_SERVICE_INFO();
121 // css::beans::XPropertySet
122 virtual void SAL_CALL
getFastPropertyValue(css::uno::Any
& rValue
, sal_Int32 nHandle
) const override
;
124 // css::sdbcx::XRename,
125 virtual void SAL_CALL
rename( const OUString
& _rNewName
) override
;
127 // css::sdbcx::XAlterTable,
128 virtual void SAL_CALL
alterColumnByName( const OUString
& _rName
, const css::uno::Reference
< css::beans::XPropertySet
>& _rxDescriptor
) override
;
131 using OTable_Base::createArrayHelper
;
132 using OTable_Base::getFastPropertyValue
;
136 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */