xref: /trunk/main/connectivity/source/inc/adabas/BTable.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
1*caf5cd79SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*caf5cd79SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*caf5cd79SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*caf5cd79SAndrew Rist  * distributed with this work for additional information
6*caf5cd79SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*caf5cd79SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*caf5cd79SAndrew Rist  * "License"); you may not use this file except in compliance
9*caf5cd79SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*caf5cd79SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*caf5cd79SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*caf5cd79SAndrew Rist  * software distributed under the License is distributed on an
15*caf5cd79SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*caf5cd79SAndrew Rist  * KIND, either express or implied.  See the License for the
17*caf5cd79SAndrew Rist  * specific language governing permissions and limitations
18*caf5cd79SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*caf5cd79SAndrew Rist  *************************************************************/
21*caf5cd79SAndrew Rist 
22*caf5cd79SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _CONNECTIVITY_ADABAS_TABLE_HXX_
25cdf0e10cSrcweir #define _CONNECTIVITY_ADABAS_TABLE_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "connectivity/sdbcx/VTable.hxx"
28cdf0e10cSrcweir #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
29cdf0e10cSrcweir #include "adabas/BConnection.hxx"
30cdf0e10cSrcweir #include "connectivity/TTableHelper.hxx"
31cdf0e10cSrcweir 
32cdf0e10cSrcweir namespace connectivity
33cdf0e10cSrcweir {
34cdf0e10cSrcweir     namespace adabas
35cdf0e10cSrcweir     {
36cdf0e10cSrcweir         typedef connectivity::OTableHelper OTable_TYPEDEF;
37cdf0e10cSrcweir 
38cdf0e10cSrcweir         ::rtl::OUString getTypeString(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xColProp);
39cdf0e10cSrcweir 
40cdf0e10cSrcweir         class OAdabasTable : public OTableHelper
41cdf0e10cSrcweir         {
42cdf0e10cSrcweir             OAdabasConnection* m_pConnection;
43cdf0e10cSrcweir         protected:
44cdf0e10cSrcweir             /** creates the column collection for the table
45cdf0e10cSrcweir                 @param  _rNames
46cdf0e10cSrcweir                     The column names.
47cdf0e10cSrcweir             */
48cdf0e10cSrcweir             virtual sdbcx::OCollection* createColumns(const TStringVector& _rNames);
49cdf0e10cSrcweir 
50cdf0e10cSrcweir             /** creates the key collection for the table
51cdf0e10cSrcweir                 @param  _rNames
52cdf0e10cSrcweir                     The key names.
53cdf0e10cSrcweir             */
54cdf0e10cSrcweir             virtual sdbcx::OCollection* createKeys(const TStringVector& _rNames);
55cdf0e10cSrcweir 
56cdf0e10cSrcweir             /** creates the index collection for the table
57cdf0e10cSrcweir                 @param  _rNames
58cdf0e10cSrcweir                     The index names.
59cdf0e10cSrcweir             */
60cdf0e10cSrcweir             virtual sdbcx::OCollection* createIndexes(const TStringVector& _rNames);
61cdf0e10cSrcweir 
62cdf0e10cSrcweir         public:
63cdf0e10cSrcweir             OAdabasTable(   sdbcx::OCollection* _pTables,
64cdf0e10cSrcweir                             OAdabasConnection* _pConnection);
65cdf0e10cSrcweir             OAdabasTable(   sdbcx::OCollection* _pTables,
66cdf0e10cSrcweir                             OAdabasConnection* _pConnection,
67cdf0e10cSrcweir                     const ::rtl::OUString& _Name,
68cdf0e10cSrcweir                     const ::rtl::OUString& _Type,
69cdf0e10cSrcweir                     const ::rtl::OUString& _Description = ::rtl::OUString(),
70cdf0e10cSrcweir                     const ::rtl::OUString& _SchemaName = ::rtl::OUString(),
71cdf0e10cSrcweir                     const ::rtl::OUString& _CatalogName = ::rtl::OUString()
72cdf0e10cSrcweir                 );
73cdf0e10cSrcweir 
getTableName() const74cdf0e10cSrcweir             ::rtl::OUString getTableName() const { return m_Name; }
getSchema() const75cdf0e10cSrcweir             ::rtl::OUString getSchema() const { return m_SchemaName; }
76cdf0e10cSrcweir 
77cdf0e10cSrcweir             // com::sun::star::lang::XUnoTunnel
78cdf0e10cSrcweir             virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
79cdf0e10cSrcweir             static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
80cdf0e10cSrcweir 
81cdf0e10cSrcweir             // XAlterTable
82cdf0e10cSrcweir             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);
83cdf0e10cSrcweir             // XNamed
84cdf0e10cSrcweir             virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
85cdf0e10cSrcweir             /**
86cdf0e10cSrcweir                 returns the ALTER TABLE XXX COLUMN statement
87cdf0e10cSrcweir             */
88cdf0e10cSrcweir             ::rtl::OUString getAlterTableColumnPart(const ::rtl::OUString& _rsColumnName );
89cdf0e10cSrcweir 
90cdf0e10cSrcweir             // starts a sql transaaction
91cdf0e10cSrcweir             void beginTransAction();
92cdf0e10cSrcweir             // rolls back a sql transaaction
93cdf0e10cSrcweir             void rollbackTransAction();
94cdf0e10cSrcweir             // ends a sql transaaction
95cdf0e10cSrcweir             void endTransAction();
96cdf0e10cSrcweir             // some methods to alter table structures
97cdf0e10cSrcweir             void alterColumnType(const ::rtl::OUString& _rColName,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDescriptor);
98cdf0e10cSrcweir             void alterNotNullValue(sal_Int32 _nNewNullable,const ::rtl::OUString& _rColName);
99cdf0e10cSrcweir             void alterDefaultValue(const ::rtl::OUString& _sNewDefault,const ::rtl::OUString& _rColName);
100cdf0e10cSrcweir             void dropDefaultValue(const ::rtl::OUString& _sNewDefault);
101cdf0e10cSrcweir             void addDefaultValue(const ::rtl::OUString& _sNewDefault,const ::rtl::OUString& _rColName);
102cdf0e10cSrcweir         };
103cdf0e10cSrcweir     }
104cdf0e10cSrcweir }
105cdf0e10cSrcweir #endif // _CONNECTIVITY_ADABAS_TABLE_HXX_
106