1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef CONNECTIVITY_HSQLDB_TABLE_HXX 29*cdf0e10cSrcweir #define CONNECTIVITY_HSQLDB_TABLE_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "connectivity/TTableHelper.hxx" 32*cdf0e10cSrcweir #include <com/sun/star/sdbc/XDatabaseMetaData.hpp> 33*cdf0e10cSrcweir #include <comphelper/IdPropArrayHelper.hxx> 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir namespace connectivity 36*cdf0e10cSrcweir { 37*cdf0e10cSrcweir namespace hsqldb 38*cdf0e10cSrcweir { 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir ::rtl::OUString getTypeString(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xColProp); 41*cdf0e10cSrcweir 42*cdf0e10cSrcweir class OHSQLTable; 43*cdf0e10cSrcweir typedef ::comphelper::OIdPropertyArrayUsageHelper< OHSQLTable > OHSQLTable_PROP; 44*cdf0e10cSrcweir class OHSQLTable : public OTableHelper 45*cdf0e10cSrcweir ,public OHSQLTable_PROP 46*cdf0e10cSrcweir { 47*cdf0e10cSrcweir sal_Int32 m_nPrivileges; // we have to set our privileges by our own 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir /** executes the statmenmt. 50*cdf0e10cSrcweir @param _rStatement 51*cdf0e10cSrcweir The statement to execute. 52*cdf0e10cSrcweir */ 53*cdf0e10cSrcweir void executeStatement(const ::rtl::OUString& _rStatement ); 54*cdf0e10cSrcweir protected: 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir /** creates the column collection for the table 57*cdf0e10cSrcweir @param _rNames 58*cdf0e10cSrcweir The column names. 59*cdf0e10cSrcweir */ 60*cdf0e10cSrcweir virtual sdbcx::OCollection* createColumns(const TStringVector& _rNames); 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir /** creates the key collection for the table 63*cdf0e10cSrcweir @param _rNames 64*cdf0e10cSrcweir The key names. 65*cdf0e10cSrcweir */ 66*cdf0e10cSrcweir virtual sdbcx::OCollection* createKeys(const TStringVector& _rNames); 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir /** creates the index collection for the table 69*cdf0e10cSrcweir @param _rNames 70*cdf0e10cSrcweir The index names. 71*cdf0e10cSrcweir */ 72*cdf0e10cSrcweir virtual sdbcx::OCollection* createIndexes(const TStringVector& _rNames); 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir /** used to implement the creation of the array helper which is shared amongst all instances of the class. 75*cdf0e10cSrcweir This method needs to be implemented in derived classes. 76*cdf0e10cSrcweir <BR> 77*cdf0e10cSrcweir The method gets called with s_aMutex acquired. 78*cdf0e10cSrcweir <BR> 79*cdf0e10cSrcweir as long as IPropertyArrayHelper has no virtual destructor, the implementation of ~OPropertyArrayUsageHelper 80*cdf0e10cSrcweir assumes that you created an ::cppu::OPropertyArrayHelper when deleting s_pProps. 81*cdf0e10cSrcweir @return an pointer to the newly created array helper. Must not be NULL. 82*cdf0e10cSrcweir */ 83*cdf0e10cSrcweir virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 nId) const; 84*cdf0e10cSrcweir virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir public: 87*cdf0e10cSrcweir OHSQLTable( sdbcx::OCollection* _pTables, 88*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection); 89*cdf0e10cSrcweir OHSQLTable( sdbcx::OCollection* _pTables, 90*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection, 91*cdf0e10cSrcweir const ::rtl::OUString& _Name, 92*cdf0e10cSrcweir const ::rtl::OUString& _Type, 93*cdf0e10cSrcweir const ::rtl::OUString& _Description = ::rtl::OUString(), 94*cdf0e10cSrcweir const ::rtl::OUString& _SchemaName = ::rtl::OUString(), 95*cdf0e10cSrcweir const ::rtl::OUString& _CatalogName = ::rtl::OUString(), 96*cdf0e10cSrcweir sal_Int32 _nPrivileges = 0 97*cdf0e10cSrcweir ); 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir // ODescriptor 100*cdf0e10cSrcweir virtual void construct(); 101*cdf0e10cSrcweir // com::sun::star::lang::XUnoTunnel 102*cdf0e10cSrcweir virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); 103*cdf0e10cSrcweir static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); 106*cdf0e10cSrcweir //XTypeProvider 107*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); 108*cdf0e10cSrcweir // XAlterTable 109*cdf0e10cSrcweir 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); 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir // XRename 112*cdf0e10cSrcweir 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); 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir /** 115*cdf0e10cSrcweir returns the ALTER TABLE XXX COLUMN statement 116*cdf0e10cSrcweir */ 117*cdf0e10cSrcweir ::rtl::OUString getAlterTableColumnPart(); 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir // some methods to alter table structures 120*cdf0e10cSrcweir void alterColumnType(sal_Int32 nNewType,const ::rtl::OUString& _rColName,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDescriptor); 121*cdf0e10cSrcweir void alterDefaultValue(const ::rtl::OUString& _sNewDefault,const ::rtl::OUString& _rColName); 122*cdf0e10cSrcweir void dropDefaultValue(const ::rtl::OUString& _sNewDefault); 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir }; 125*cdf0e10cSrcweir } 126*cdf0e10cSrcweir } 127*cdf0e10cSrcweir #endif // CONNECTIVITY_HSQLDB_TABLE_HXX 128*cdf0e10cSrcweir 129