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_CONNECTIVITY_SOURCE_INC_HSQLDB_HTABLE_HXX
21 #define INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HTABLE_HXX
23 #include <connectivity/TTableHelper.hxx>
24 #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
25 #include <comphelper/IdPropArrayHelper.hxx>
27 namespace connectivity
32 OUString
getTypeString(const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& xColProp
);
35 typedef ::comphelper::OIdPropertyArrayUsageHelper
< OHSQLTable
> OHSQLTable_PROP
;
36 class OHSQLTable
: public OTableHelper
37 ,public OHSQLTable_PROP
39 sal_Int32 m_nPrivileges
; // we have to set our privileges by our own
41 /** executes the statmenmt.
43 The statement to execute.
45 void executeStatement(const OUString
& _rStatement
);
48 /** creates the column collection for the table
52 virtual sdbcx::OCollection
* createColumns(const TStringVector
& _rNames
) SAL_OVERRIDE
;
54 /** creates the key collection for the table
58 virtual sdbcx::OCollection
* createKeys(const TStringVector
& _rNames
) SAL_OVERRIDE
;
60 /** creates the index collection for the table
64 virtual sdbcx::OCollection
* createIndexes(const TStringVector
& _rNames
) SAL_OVERRIDE
;
66 /** used to implement the creation of the array helper which is shared amongst all instances of the class.
67 This method needs to be implemented in derived classes.
69 The method gets called with s_aMutex acquired.
71 as long as IPropertyArrayHelper has no virtual destructor, the implementation of ~OPropertyArrayUsageHelper
72 assumes that you created an ::cppu::OPropertyArrayHelper when deleting s_pProps.
73 @return an pointer to the newly created array helper. Must not be NULL.
75 virtual ::cppu::IPropertyArrayHelper
* createArrayHelper(sal_Int32 nId
) const SAL_OVERRIDE
;
76 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper() SAL_OVERRIDE
;
79 OHSQLTable( sdbcx::OCollection
* _pTables
,
80 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>& _xConnection
);
81 OHSQLTable( sdbcx::OCollection
* _pTables
,
82 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>& _xConnection
,
83 const OUString
& _Name
,
84 const OUString
& _Type
,
85 const OUString
& _Description
= OUString(),
86 const OUString
& _SchemaName
= OUString(),
87 const OUString
& _CatalogName
= OUString(),
88 sal_Int32 _nPrivileges
= 0
92 virtual void construct() SAL_OVERRIDE
;
93 // com::sun::star::lang::XUnoTunnel
94 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
;
95 static ::com::sun::star::uno::Sequence
< sal_Int8
> getUnoTunnelImplementationId();
97 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
99 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
101 virtual void SAL_CALL
alterColumnByName( const OUString
& colName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& descriptor
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::container::NoSuchElementException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
104 virtual void SAL_CALL
rename( const OUString
& newName
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::container::ElementExistException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
107 returns the ALTER TABLE XXX COLUMN statement
109 OUString
getAlterTableColumnPart();
111 // some methods to alter table structures
112 void alterColumnType(sal_Int32 nNewType
,const OUString
& _rColName
,const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _xDescriptor
);
113 void alterDefaultValue(const OUString
& _sNewDefault
,const OUString
& _rColName
);
114 void dropDefaultValue(const OUString
& _sNewDefault
);
119 #endif // INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HTABLE_HXX
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */