1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _CONNECTIVITY_ADABAS_TABLE_HXX_ 29 #define _CONNECTIVITY_ADABAS_TABLE_HXX_ 30 31 #include "connectivity/sdbcx/VTable.hxx" 32 #include <com/sun/star/sdbc/XDatabaseMetaData.hpp> 33 #include "adabas/BConnection.hxx" 34 #include "connectivity/TTableHelper.hxx" 35 36 namespace connectivity 37 { 38 namespace adabas 39 { 40 typedef connectivity::OTableHelper OTable_TYPEDEF; 41 42 ::rtl::OUString getTypeString(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xColProp); 43 44 class OAdabasTable : public OTableHelper 45 { 46 OAdabasConnection* m_pConnection; 47 protected: 48 /** creates the column collection for the table 49 @param _rNames 50 The column names. 51 */ 52 virtual sdbcx::OCollection* createColumns(const TStringVector& _rNames); 53 54 /** creates the key collection for the table 55 @param _rNames 56 The key names. 57 */ 58 virtual sdbcx::OCollection* createKeys(const TStringVector& _rNames); 59 60 /** creates the index collection for the table 61 @param _rNames 62 The index names. 63 */ 64 virtual sdbcx::OCollection* createIndexes(const TStringVector& _rNames); 65 66 public: 67 OAdabasTable( sdbcx::OCollection* _pTables, 68 OAdabasConnection* _pConnection); 69 OAdabasTable( sdbcx::OCollection* _pTables, 70 OAdabasConnection* _pConnection, 71 const ::rtl::OUString& _Name, 72 const ::rtl::OUString& _Type, 73 const ::rtl::OUString& _Description = ::rtl::OUString(), 74 const ::rtl::OUString& _SchemaName = ::rtl::OUString(), 75 const ::rtl::OUString& _CatalogName = ::rtl::OUString() 76 ); 77 78 ::rtl::OUString getTableName() const { return m_Name; } 79 ::rtl::OUString getSchema() const { return m_SchemaName; } 80 81 // com::sun::star::lang::XUnoTunnel 82 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); 83 static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); 84 85 // XAlterTable 86 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); 87 // XNamed 88 virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); 89 /** 90 returns the ALTER TABLE XXX COLUMN statement 91 */ 92 ::rtl::OUString getAlterTableColumnPart(const ::rtl::OUString& _rsColumnName ); 93 94 // starts a sql transaaction 95 void beginTransAction(); 96 // rolls back a sql transaaction 97 void rollbackTransAction(); 98 // ends a sql transaaction 99 void endTransAction(); 100 // some methods to alter table structures 101 void alterColumnType(const ::rtl::OUString& _rColName,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDescriptor); 102 void alterNotNullValue(sal_Int32 _nNewNullable,const ::rtl::OUString& _rColName); 103 void alterDefaultValue(const ::rtl::OUString& _sNewDefault,const ::rtl::OUString& _rColName); 104 void dropDefaultValue(const ::rtl::OUString& _sNewDefault); 105 void addDefaultValue(const ::rtl::OUString& _sNewDefault,const ::rtl::OUString& _rColName); 106 }; 107 } 108 } 109 #endif // _CONNECTIVITY_ADABAS_TABLE_HXX_ 110 111