xref: /AOO41X/main/connectivity/source/drivers/adabas/BTable.cxx (revision 9b5730f6ddef7eb82608ca4d31dc0d7678e652cf)
1*9b5730f6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*9b5730f6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*9b5730f6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*9b5730f6SAndrew Rist  * distributed with this work for additional information
6*9b5730f6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*9b5730f6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*9b5730f6SAndrew Rist  * "License"); you may not use this file except in compliance
9*9b5730f6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*9b5730f6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*9b5730f6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*9b5730f6SAndrew Rist  * software distributed under the License is distributed on an
15*9b5730f6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9b5730f6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*9b5730f6SAndrew Rist  * specific language governing permissions and limitations
18*9b5730f6SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*9b5730f6SAndrew Rist  *************************************************************/
21*9b5730f6SAndrew Rist 
22*9b5730f6SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_connectivity.hxx"
26cdf0e10cSrcweir #include "adabas/BTable.hxx"
27cdf0e10cSrcweir #include "adabas/BTables.hxx"
28cdf0e10cSrcweir #include "adabas/BIndexes.hxx"
29cdf0e10cSrcweir #include "adabas/BColumns.hxx"
30cdf0e10cSrcweir #include "adabas/BKeys.hxx"
31cdf0e10cSrcweir #include <com/sun/star/sdbc/XRow.hpp>
32cdf0e10cSrcweir #include <com/sun/star/sdbc/XResultSet.hpp>
33cdf0e10cSrcweir #include <com/sun/star/sdbcx/KeyType.hpp>
34cdf0e10cSrcweir #include <com/sun/star/sdbc/KeyRule.hpp>
35cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx>
36cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp>
37cdf0e10cSrcweir #include <com/sun/star/sdbc/ColumnValue.hpp>
38cdf0e10cSrcweir #include <comphelper/sequence.hxx>
39cdf0e10cSrcweir #include <comphelper/extract.hxx>
40cdf0e10cSrcweir #include <comphelper/types.hxx>
41cdf0e10cSrcweir #include "connectivity/dbtools.hxx"
42cdf0e10cSrcweir #include "adabas/BCatalog.hxx"
43cdf0e10cSrcweir 
44cdf0e10cSrcweir 
45cdf0e10cSrcweir using namespace ::comphelper;
46cdf0e10cSrcweir using namespace connectivity::adabas;
47cdf0e10cSrcweir using namespace connectivity;
48cdf0e10cSrcweir using namespace ::com::sun::star::uno;
49cdf0e10cSrcweir using namespace ::com::sun::star::beans;
50cdf0e10cSrcweir using namespace ::com::sun::star::sdbcx;
51cdf0e10cSrcweir using namespace ::com::sun::star::sdbc;
52cdf0e10cSrcweir using namespace ::com::sun::star::container;
53cdf0e10cSrcweir using namespace ::com::sun::star::lang;
54cdf0e10cSrcweir 
OAdabasTable(sdbcx::OCollection * _pTables,OAdabasConnection * _pConnection)55cdf0e10cSrcweir OAdabasTable::OAdabasTable(	sdbcx::OCollection* _pTables,
56cdf0e10cSrcweir 						   OAdabasConnection* _pConnection)
57cdf0e10cSrcweir 	:OTable_TYPEDEF(_pTables,_pConnection,sal_True)
58cdf0e10cSrcweir 	,m_pConnection(_pConnection)
59cdf0e10cSrcweir {
60cdf0e10cSrcweir 	construct();
61cdf0e10cSrcweir }
62cdf0e10cSrcweir // -------------------------------------------------------------------------
OAdabasTable(sdbcx::OCollection * _pTables,OAdabasConnection * _pConnection,const::rtl::OUString & _Name,const::rtl::OUString & _Type,const::rtl::OUString & _Description,const::rtl::OUString & _SchemaName,const::rtl::OUString & _CatalogName)63cdf0e10cSrcweir OAdabasTable::OAdabasTable(	sdbcx::OCollection* _pTables,
64cdf0e10cSrcweir 						   OAdabasConnection* _pConnection,
65cdf0e10cSrcweir 					const ::rtl::OUString& _Name,
66cdf0e10cSrcweir 					const ::rtl::OUString& _Type,
67cdf0e10cSrcweir 					const ::rtl::OUString& _Description ,
68cdf0e10cSrcweir 					const ::rtl::OUString& _SchemaName,
69cdf0e10cSrcweir 					const ::rtl::OUString& _CatalogName
70cdf0e10cSrcweir 				) : OTableHelper(	_pTables,
71cdf0e10cSrcweir 									_pConnection,
72cdf0e10cSrcweir 									sal_True,
73cdf0e10cSrcweir 									_Name,
74cdf0e10cSrcweir 									_Type,
75cdf0e10cSrcweir 									_Description,
76cdf0e10cSrcweir 									_SchemaName,
77cdf0e10cSrcweir 									_CatalogName)
78cdf0e10cSrcweir 				,m_pConnection(_pConnection)
79cdf0e10cSrcweir {
80cdf0e10cSrcweir 	construct();
81cdf0e10cSrcweir }
82cdf0e10cSrcweir // -----------------------------------------------------------------------------
createColumns(const TStringVector & _rNames)83cdf0e10cSrcweir sdbcx::OCollection* OAdabasTable::createColumns(const TStringVector& _rNames)
84cdf0e10cSrcweir {
85cdf0e10cSrcweir 	return new OColumns(this,m_aMutex,_rNames);
86cdf0e10cSrcweir }
87cdf0e10cSrcweir // -----------------------------------------------------------------------------
createKeys(const TStringVector & _rNames)88cdf0e10cSrcweir sdbcx::OCollection* OAdabasTable::createKeys(const TStringVector& _rNames)
89cdf0e10cSrcweir {
90cdf0e10cSrcweir 	return new OKeys(this,m_aMutex,_rNames);
91cdf0e10cSrcweir }
92cdf0e10cSrcweir // -----------------------------------------------------------------------------
createIndexes(const TStringVector & _rNames)93cdf0e10cSrcweir sdbcx::OCollection* OAdabasTable::createIndexes(const TStringVector& _rNames)
94cdf0e10cSrcweir {
95cdf0e10cSrcweir 	return new OIndexes(this,m_aMutex,_rNames);
96cdf0e10cSrcweir }
97cdf0e10cSrcweir //--------------------------------------------------------------------------
getUnoTunnelImplementationId()98cdf0e10cSrcweir Sequence< sal_Int8 > OAdabasTable::getUnoTunnelImplementationId()
99cdf0e10cSrcweir {
100cdf0e10cSrcweir 	static ::cppu::OImplementationId * pId = 0;
101cdf0e10cSrcweir 	if (! pId)
102cdf0e10cSrcweir 	{
103cdf0e10cSrcweir 		::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
104cdf0e10cSrcweir 		if (! pId)
105cdf0e10cSrcweir 		{
106cdf0e10cSrcweir 			static ::cppu::OImplementationId aId;
107cdf0e10cSrcweir 			pId = &aId;
108cdf0e10cSrcweir 		}
109cdf0e10cSrcweir 	}
110cdf0e10cSrcweir 	return pId->getImplementationId();
111cdf0e10cSrcweir }
112cdf0e10cSrcweir 
113cdf0e10cSrcweir // com::sun::star::lang::XUnoTunnel
114cdf0e10cSrcweir //------------------------------------------------------------------
getSomething(const Sequence<sal_Int8> & rId)115cdf0e10cSrcweir sal_Int64 OAdabasTable::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException)
116cdf0e10cSrcweir {
117cdf0e10cSrcweir 	return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(),  rId.getConstArray(), 16 ) )
118cdf0e10cSrcweir 				? reinterpret_cast< sal_Int64 >( this )
119cdf0e10cSrcweir 				: OTable_TYPEDEF::getSomething(rId);
120cdf0e10cSrcweir }
121cdf0e10cSrcweir // -------------------------------------------------------------------------
122cdf0e10cSrcweir // XAlterTable
alterColumnByName(const::rtl::OUString & colName,const Reference<XPropertySet> & descriptor)123cdf0e10cSrcweir void SAL_CALL OAdabasTable::alterColumnByName( const ::rtl::OUString& colName, const Reference< XPropertySet >& descriptor ) throw(SQLException, NoSuchElementException, RuntimeException)
124cdf0e10cSrcweir {
125cdf0e10cSrcweir 	::osl::MutexGuard aGuard(m_aMutex);
126cdf0e10cSrcweir 	checkDisposed(
127cdf0e10cSrcweir #ifdef GCC
128cdf0e10cSrcweir 		::connectivity::sdbcx::OTableDescriptor_BASE::rBHelper.bDisposed
129cdf0e10cSrcweir #else
130cdf0e10cSrcweir 		rBHelper.bDisposed
131cdf0e10cSrcweir #endif
132cdf0e10cSrcweir 		);
133cdf0e10cSrcweir 
134cdf0e10cSrcweir 	if(m_pColumns && !m_pColumns->hasByName(colName))
135cdf0e10cSrcweir 		throw NoSuchElementException(colName,*this);
136cdf0e10cSrcweir 
137cdf0e10cSrcweir 
138cdf0e10cSrcweir 	if(!isNew())
139cdf0e10cSrcweir 	{
140cdf0e10cSrcweir 		beginTransAction();
141cdf0e10cSrcweir 
142cdf0e10cSrcweir 		try
143cdf0e10cSrcweir 		{
144cdf0e10cSrcweir 			// first we have to check what should be altered
145cdf0e10cSrcweir 			Reference<XPropertySet> xProp;
146cdf0e10cSrcweir 			m_pColumns->getByName(colName) >>= xProp;
147cdf0e10cSrcweir 			// first check the types
148cdf0e10cSrcweir 			sal_Int32 nOldType = 0,nNewType = 0,nOldPrec = 0,nNewPrec = 0,nOldScale = 0,nNewScale = 0;
149cdf0e10cSrcweir 
150cdf0e10cSrcweir 			xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))			>>= nOldType;
151cdf0e10cSrcweir 			descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))	>>= nNewType;
152cdf0e10cSrcweir 			// and precsions and scale
153cdf0e10cSrcweir 			xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))	>>= nOldPrec;
154cdf0e10cSrcweir 			descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))>>= nNewPrec;
155cdf0e10cSrcweir 			xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))		>>= nOldScale;
156cdf0e10cSrcweir 			descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))	>>= nNewScale;
157cdf0e10cSrcweir 
158cdf0e10cSrcweir 			if(nOldType != nNewType || nOldPrec != nNewPrec || nOldScale != nNewScale)
159cdf0e10cSrcweir 				alterColumnType(colName,descriptor);
160cdf0e10cSrcweir 
161cdf0e10cSrcweir 			// second: check the "is nullable" value
162cdf0e10cSrcweir 			sal_Int32 nOldNullable = 0,nNewNullable = 0;
163cdf0e10cSrcweir 			xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))		>>= nOldNullable;
164cdf0e10cSrcweir 			descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))	>>= nNewNullable;
165cdf0e10cSrcweir 			if(nNewNullable != nOldNullable)
166cdf0e10cSrcweir 				alterNotNullValue(nNewNullable,colName);
167cdf0e10cSrcweir 
168cdf0e10cSrcweir 			// third: check the default values
169cdf0e10cSrcweir 			::rtl::OUString sNewDefault,sOldDefault;
170cdf0e10cSrcweir 			xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE))		>>= sOldDefault;
171cdf0e10cSrcweir 			descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE)) >>= sNewDefault;
172cdf0e10cSrcweir 
173cdf0e10cSrcweir 			if(sOldDefault.getLength())
174cdf0e10cSrcweir 			{
175cdf0e10cSrcweir 				if(sNewDefault.getLength() && sOldDefault != sNewDefault)
176cdf0e10cSrcweir 					alterDefaultValue(sNewDefault,colName);
177cdf0e10cSrcweir 				else if(!sNewDefault.getLength())
178cdf0e10cSrcweir 					dropDefaultValue(colName);
179cdf0e10cSrcweir 			}
180cdf0e10cSrcweir 			else if(!sOldDefault.getLength() && sNewDefault.getLength())
181cdf0e10cSrcweir 				addDefaultValue(sNewDefault,colName);
182cdf0e10cSrcweir 
183cdf0e10cSrcweir 			// now we should look if the name of the column changed
184cdf0e10cSrcweir 			::rtl::OUString sNewColumnName;
185cdf0e10cSrcweir 			descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= sNewColumnName;
186cdf0e10cSrcweir 			if(!sNewColumnName.equalsIgnoreAsciiCase(colName))
187cdf0e10cSrcweir 			{
188cdf0e10cSrcweir 				const ::rtl::OUString sQuote = m_pConnection->getMetaData()->getIdentifierQuoteString(  );
189cdf0e10cSrcweir 				const ::rtl::OUString& sDot = OAdabasCatalog::getDot();
190cdf0e10cSrcweir 
191cdf0e10cSrcweir 				::rtl::OUString sSql = ::rtl::OUString::createFromAscii("RENAME COLUMN ") ;
192cdf0e10cSrcweir 				sSql += ::dbtools::quoteName(sQuote,m_SchemaName) + sDot + ::dbtools::quoteName(sQuote,m_Name);
193cdf0e10cSrcweir 				sSql += sDot + ::dbtools::quoteName(sQuote,colName);
194cdf0e10cSrcweir 				sSql += ::rtl::OUString::createFromAscii(" TO ");
195cdf0e10cSrcweir 				sSql += ::dbtools::quoteName(sQuote,sNewColumnName);
196cdf0e10cSrcweir 
197cdf0e10cSrcweir 				Reference< XStatement > xStmt = m_pConnection->createStatement(  );
198cdf0e10cSrcweir 				if(xStmt.is())
199cdf0e10cSrcweir 				{
200cdf0e10cSrcweir 					xStmt->execute(sSql);
201cdf0e10cSrcweir 					::comphelper::disposeComponent(xStmt);
202cdf0e10cSrcweir 				}
203cdf0e10cSrcweir 			}
204cdf0e10cSrcweir 			m_pColumns->refresh();
205cdf0e10cSrcweir 		}
206cdf0e10cSrcweir 		catch(const SQLException&)
207cdf0e10cSrcweir 		{
208cdf0e10cSrcweir 			rollbackTransAction();
209cdf0e10cSrcweir 			throw;
210cdf0e10cSrcweir 		}
211cdf0e10cSrcweir 		endTransAction();
212cdf0e10cSrcweir 	}
213cdf0e10cSrcweir 	else
214cdf0e10cSrcweir 	{
215cdf0e10cSrcweir 		if(m_pColumns)
216cdf0e10cSrcweir 		{
217cdf0e10cSrcweir 			m_pColumns->dropByName(colName);
218cdf0e10cSrcweir 			m_pColumns->appendByDescriptor(descriptor);
219cdf0e10cSrcweir 		}
220cdf0e10cSrcweir 	}
221cdf0e10cSrcweir 
222cdf0e10cSrcweir }
223cdf0e10cSrcweir // -------------------------------------------------------------------------
getName()224cdf0e10cSrcweir ::rtl::OUString SAL_CALL OAdabasTable::getName() throw(::com::sun::star::uno::RuntimeException)
225cdf0e10cSrcweir {
226cdf0e10cSrcweir 	::rtl::OUString sName = m_SchemaName;
227cdf0e10cSrcweir 	if(m_SchemaName.getLength())
228cdf0e10cSrcweir 	{
229cdf0e10cSrcweir 		const ::rtl::OUString& sDot = OAdabasCatalog::getDot();
230cdf0e10cSrcweir 		sName += sDot;
231cdf0e10cSrcweir 	}
232cdf0e10cSrcweir 	sName += m_Name;
233cdf0e10cSrcweir 	return sName;
234cdf0e10cSrcweir }
235cdf0e10cSrcweir // -----------------------------------------------------------------------------
alterColumnType(const::rtl::OUString & _rColName,const Reference<XPropertySet> & _xDescriptor)236cdf0e10cSrcweir void OAdabasTable::alterColumnType(const ::rtl::OUString& _rColName, const Reference<XPropertySet>& _xDescriptor)
237cdf0e10cSrcweir {
238cdf0e10cSrcweir 	::rtl::OUString sSql = getAlterTableColumnPart(_rColName);
239cdf0e10cSrcweir 	sSql += ::rtl::OUString::createFromAscii(" ");
240cdf0e10cSrcweir 	sSql += OTables::getColumnSqlType(_xDescriptor);
241cdf0e10cSrcweir 
242cdf0e10cSrcweir 	Reference< XStatement > xStmt = m_pConnection->createStatement(  );
243cdf0e10cSrcweir 	if(xStmt.is())
244cdf0e10cSrcweir 	{
245cdf0e10cSrcweir 		xStmt->execute(sSql);
246cdf0e10cSrcweir 		::comphelper::disposeComponent(xStmt);
247cdf0e10cSrcweir 	}
248cdf0e10cSrcweir }
249cdf0e10cSrcweir // -----------------------------------------------------------------------------
alterNotNullValue(sal_Int32 _nNewNullable,const::rtl::OUString & _rColName)250cdf0e10cSrcweir void OAdabasTable::alterNotNullValue(sal_Int32 _nNewNullable,const ::rtl::OUString& _rColName)
251cdf0e10cSrcweir {
252cdf0e10cSrcweir 	::rtl::OUString sSql = getAlterTableColumnPart(_rColName);
253cdf0e10cSrcweir 
254cdf0e10cSrcweir 	if(_nNewNullable == ColumnValue::NO_NULLS)
255cdf0e10cSrcweir 	{
256cdf0e10cSrcweir 		sSql += ::rtl::OUString::createFromAscii(" NOT NULL");
257cdf0e10cSrcweir 	}
258cdf0e10cSrcweir 	else
259cdf0e10cSrcweir 	{
260cdf0e10cSrcweir 		sSql += ::rtl::OUString::createFromAscii(" DEFAULT NULL");
261cdf0e10cSrcweir 	}
262cdf0e10cSrcweir 
263cdf0e10cSrcweir 	Reference< XStatement > xStmt = m_pConnection->createStatement();
264cdf0e10cSrcweir 	if(xStmt.is())
265cdf0e10cSrcweir 	{
266cdf0e10cSrcweir 		xStmt->execute(sSql);
267cdf0e10cSrcweir 		::comphelper::disposeComponent(xStmt);
268cdf0e10cSrcweir 	}
269cdf0e10cSrcweir }
270cdf0e10cSrcweir // -----------------------------------------------------------------------------
alterDefaultValue(const::rtl::OUString & _sNewDefault,const::rtl::OUString & _rColName)271cdf0e10cSrcweir void OAdabasTable::alterDefaultValue(const ::rtl::OUString& _sNewDefault,const ::rtl::OUString& _rColName)
272cdf0e10cSrcweir {
273cdf0e10cSrcweir 	::rtl::OUString sSql = getAlterTableColumnPart(_rColName);
274cdf0e10cSrcweir 	sSql += ::rtl::OUString::createFromAscii(" ALTER ") + _sNewDefault;
275cdf0e10cSrcweir 
276cdf0e10cSrcweir 	Reference< XStatement > xStmt = m_pConnection->createStatement();
277cdf0e10cSrcweir 	if(xStmt.is())
278cdf0e10cSrcweir 	{
279cdf0e10cSrcweir 		xStmt->execute(sSql);
280cdf0e10cSrcweir 		::comphelper::disposeComponent(xStmt);
281cdf0e10cSrcweir 	}
282cdf0e10cSrcweir }
283cdf0e10cSrcweir // -----------------------------------------------------------------------------
dropDefaultValue(const::rtl::OUString & _rColName)284cdf0e10cSrcweir void OAdabasTable::dropDefaultValue(const ::rtl::OUString& _rColName)
285cdf0e10cSrcweir {
286cdf0e10cSrcweir 	::rtl::OUString sSql = getAlterTableColumnPart(_rColName);
287cdf0e10cSrcweir 	sSql += ::rtl::OUString::createFromAscii(" DROP DEFAULT");
288cdf0e10cSrcweir 
289cdf0e10cSrcweir 	Reference< XStatement > xStmt = m_pConnection->createStatement();
290cdf0e10cSrcweir 	if(xStmt.is())
291cdf0e10cSrcweir 	{
292cdf0e10cSrcweir 		xStmt->execute(sSql);
293cdf0e10cSrcweir 		::comphelper::disposeComponent(xStmt);
294cdf0e10cSrcweir 	}
295cdf0e10cSrcweir }
296cdf0e10cSrcweir // -----------------------------------------------------------------------------
addDefaultValue(const::rtl::OUString & _sNewDefault,const::rtl::OUString & _rColName)297cdf0e10cSrcweir void OAdabasTable::addDefaultValue(const ::rtl::OUString& _sNewDefault,const ::rtl::OUString& _rColName)
298cdf0e10cSrcweir {
299cdf0e10cSrcweir 	::rtl::OUString sSql = getAlterTableColumnPart(_rColName);
300cdf0e10cSrcweir 	sSql += ::rtl::OUString::createFromAscii(" ADD ") + _sNewDefault;
301cdf0e10cSrcweir 
302cdf0e10cSrcweir 	Reference< XStatement > xStmt = m_pConnection->createStatement();
303cdf0e10cSrcweir 	if(xStmt.is())
304cdf0e10cSrcweir 	{
305cdf0e10cSrcweir 		xStmt->execute(sSql);
306cdf0e10cSrcweir 		::comphelper::disposeComponent(xStmt);
307cdf0e10cSrcweir 	}
308cdf0e10cSrcweir }
309cdf0e10cSrcweir // -----------------------------------------------------------------------------
beginTransAction()310cdf0e10cSrcweir void OAdabasTable::beginTransAction()
311cdf0e10cSrcweir {
312cdf0e10cSrcweir 	try
313cdf0e10cSrcweir 	{
314cdf0e10cSrcweir 		Reference< XStatement > xStmt = m_pConnection->createStatement();
315cdf0e10cSrcweir 		if(xStmt.is())
316cdf0e10cSrcweir 		{
317cdf0e10cSrcweir 			xStmt->execute(::rtl::OUString::createFromAscii("SUBTRANS BEGIN") );
318cdf0e10cSrcweir 			::comphelper::disposeComponent(xStmt);
319cdf0e10cSrcweir 		}
320cdf0e10cSrcweir 	}
321cdf0e10cSrcweir 	catch(const Exception&)
322cdf0e10cSrcweir 	{
323cdf0e10cSrcweir 	}
324cdf0e10cSrcweir }
325cdf0e10cSrcweir // -----------------------------------------------------------------------------
endTransAction()326cdf0e10cSrcweir void OAdabasTable::endTransAction()
327cdf0e10cSrcweir {
328cdf0e10cSrcweir 	try
329cdf0e10cSrcweir 	{
330cdf0e10cSrcweir 		Reference< XStatement > xStmt = m_pConnection->createStatement();
331cdf0e10cSrcweir 		if(xStmt.is())
332cdf0e10cSrcweir 		{
333cdf0e10cSrcweir 			xStmt->execute(::rtl::OUString::createFromAscii("SUBTRANS END") );
334cdf0e10cSrcweir 			::comphelper::disposeComponent(xStmt);
335cdf0e10cSrcweir 		}
336cdf0e10cSrcweir 	}
337cdf0e10cSrcweir 	catch(const Exception&)
338cdf0e10cSrcweir 	{
339cdf0e10cSrcweir 	}
340cdf0e10cSrcweir }
341cdf0e10cSrcweir // -----------------------------------------------------------------------------
rollbackTransAction()342cdf0e10cSrcweir void OAdabasTable::rollbackTransAction()
343cdf0e10cSrcweir {
344cdf0e10cSrcweir 	try
345cdf0e10cSrcweir 	{
346cdf0e10cSrcweir 		Reference< XStatement > xStmt = m_pConnection->createStatement();
347cdf0e10cSrcweir 		if(xStmt.is())
348cdf0e10cSrcweir 		{
349cdf0e10cSrcweir 			xStmt->execute(::rtl::OUString::createFromAscii("SUBTRANS ROLLBACK") );
350cdf0e10cSrcweir 			::comphelper::disposeComponent(xStmt);
351cdf0e10cSrcweir 		}
352cdf0e10cSrcweir 	}
353cdf0e10cSrcweir 	catch(const Exception&)
354cdf0e10cSrcweir 	{
355cdf0e10cSrcweir 	}
356cdf0e10cSrcweir }
357cdf0e10cSrcweir // -----------------------------------------------------------------------------
getAlterTableColumnPart(const::rtl::OUString & _rsColumnName)358cdf0e10cSrcweir ::rtl::OUString OAdabasTable::getAlterTableColumnPart(const ::rtl::OUString& _rsColumnName )
359cdf0e10cSrcweir {
360cdf0e10cSrcweir 	::rtl::OUString sSql = ::rtl::OUString::createFromAscii("ALTER TABLE ");
361cdf0e10cSrcweir 	const ::rtl::OUString sQuote = m_pConnection->getMetaData()->getIdentifierQuoteString(  );
362cdf0e10cSrcweir 	const ::rtl::OUString& sDot = OAdabasCatalog::getDot();
363cdf0e10cSrcweir 
364cdf0e10cSrcweir 	sSql += ::dbtools::quoteName(sQuote,m_SchemaName) + sDot + ::dbtools::quoteName(sQuote,m_Name)
365cdf0e10cSrcweir 		 + ::rtl::OUString::createFromAscii(" COLUMN ")
366cdf0e10cSrcweir 		 + ::dbtools::quoteName(sQuote,_rsColumnName);
367cdf0e10cSrcweir 	return sSql;
368cdf0e10cSrcweir }
369cdf0e10cSrcweir // -----------------------------------------------------------------------------
370cdf0e10cSrcweir 
371cdf0e10cSrcweir 
372cdf0e10cSrcweir 
373