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