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: HTable.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 CONNECTIVITY_HSQLDB_TABLE_HXX
32 #define CONNECTIVITY_HSQLDB_TABLE_HXX
34 #include "connectivity/TTableHelper.hxx"
35 #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
36 #include <comphelper/IdPropArrayHelper.hxx>
38 namespace connectivity
43 ::rtl::OUString
getTypeString(const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& xColProp
);
46 typedef ::comphelper::OIdPropertyArrayUsageHelper
< OHSQLTable
> OHSQLTable_PROP
;
47 class OHSQLTable
: public OTableHelper
48 ,public OHSQLTable_PROP
50 sal_Int32 m_nPrivileges
; // we have to set our privileges by our own
52 /** executes the statmenmt.
54 The statement to execute.
56 void executeStatement(const ::rtl::OUString
& _rStatement
);
59 /** creates the column collection for the table
63 virtual sdbcx::OCollection
* createColumns(const TStringVector
& _rNames
);
65 /** creates the key collection for the table
69 virtual sdbcx::OCollection
* createKeys(const TStringVector
& _rNames
);
71 /** creates the index collection for the table
75 virtual sdbcx::OCollection
* createIndexes(const TStringVector
& _rNames
);
77 /** used to implement the creation of the array helper which is shared amongst all instances of the class.
78 This method needs to be implemented in derived classes.
80 The method gets called with s_aMutex acquired.
82 as long as IPropertyArrayHelper has no virtual destructor, the implementation of ~OPropertyArrayUsageHelper
83 assumes that you created an ::cppu::OPropertyArrayHelper when deleting s_pProps.
84 @return an pointer to the newly created array helper. Must not be NULL.
86 virtual ::cppu::IPropertyArrayHelper
* createArrayHelper(sal_Int32 nId
) const;
87 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper();
90 OHSQLTable( sdbcx::OCollection
* _pTables
,
91 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>& _xConnection
);
92 OHSQLTable( sdbcx::OCollection
* _pTables
,
93 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>& _xConnection
,
94 const ::rtl::OUString
& _Name
,
95 const ::rtl::OUString
& _Type
,
96 const ::rtl::OUString
& _Description
= ::rtl::OUString(),
97 const ::rtl::OUString
& _SchemaName
= ::rtl::OUString(),
98 const ::rtl::OUString
& _CatalogName
= ::rtl::OUString(),
99 sal_Int32 _nPrivileges
= 0
103 virtual void construct();
104 // com::sun::star::lang::XUnoTunnel
105 virtual sal_Int64 SAL_CALL
getSomething( const ::com::sun::star::uno::Sequence
< sal_Int8
>& aIdentifier
) throw(::com::sun::star::uno::RuntimeException
);
106 static ::com::sun::star::uno::Sequence
< sal_Int8
> getUnoTunnelImplementationId();
108 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
);
110 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes( ) throw(::com::sun::star::uno::RuntimeException
);
112 virtual void SAL_CALL
alterColumnByName( const ::rtl::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
);
115 virtual void SAL_CALL
rename( const ::rtl::OUString
& newName
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::container::ElementExistException
, ::com::sun::star::uno::RuntimeException
);
118 returns the ALTER TABLE XXX COLUMN statement
120 ::rtl::OUString
getAlterTableColumnPart();
122 // some methods to alter table structures
123 void alterColumnType(sal_Int32 nNewType
,const ::rtl::OUString
& _rColName
,const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _xDescriptor
);
124 void alterDefaultValue(const ::rtl::OUString
& _sNewDefault
,const ::rtl::OUString
& _rColName
);
125 void dropDefaultValue(const ::rtl::OUString
& _sNewDefault
);
130 #endif // CONNECTIVITY_HSQLDB_TABLE_HXX