User: obo Date: 2006/07/10 07:23:36 Modified: dba/connectivity/source/drivers/ado/AIndexes.cxx
Log: INTEGRATION: CWS qiq (1.13.104); FILE MERGED 2006/06/27 14:09:15 fs 1.13.104.2: RESYNC: (1.13-1.14); FILE MERGED 2006/06/16 11:32:31 fs 1.13.104.1: during #i51143#: refactored VCollection: - createEmptyObject now named createDescriptor - cloneObject removed - appendObject now returns the newly created object (previously done via a subsequent call to cloneObject) File Changes: Directory: /dba/connectivity/source/drivers/ado/ ================================================ File [changed]: AIndexes.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/ado/AIndexes.cxx?r1=1.14&r2=1.15 Delta lines: +26 -20 --------------------- --- AIndexes.cxx 20 Jun 2006 01:14:07 -0000 1.14 +++ AIndexes.cxx 10 Jul 2006 14:23:34 -0000 1.15 @@ -38,6 +38,9 @@ #ifndef _CONNECTIVITY_ADO_INDEX_HXX_ #include "ado/AIndex.hxx" #endif +#ifndef _CONNECTIVITY_ADO_ACONNECTION_HXX_ +#include "ado/AConnection.hxx" +#endif #ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ #include <com/sun/star/sdbc/XRow.hpp> #endif @@ -53,6 +56,9 @@ #ifndef _COMPHELPER_TYPES_HXX_ #include <comphelper/types.hxx> #endif +#ifndef _DBHELPER_DBEXCEPTION_HXX_ +#include <connectivity/dbexception.hxx> +#endif using namespace ::comphelper; @@ -75,38 +81,38 @@ m_aCollection.Refresh(); } // ------------------------------------------------------------------------- -Reference< XPropertySet > OIndexes::createEmptyObject() +Reference< XPropertySet > OIndexes::createDescriptor() { return new OAdoIndex(isCaseSensitive(),m_pConnection); } // ------------------------------------------------------------------------- // XAppend -void OIndexes::appendObject( const Reference< XPropertySet >& descriptor ) +sdbcx::ObjectType OIndexes::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor ) { OAdoIndex* pIndex = NULL; - sal_Bool bError = sal_True; - if(getImplementation(pIndex,descriptor) && pIndex != NULL) - { + if ( !getImplementation(pIndex,descriptor) || pIndex == NULL ) + ::dbtools::throwGenericSQLException( + ::rtl::OUString::createFromAscii( "Could not create index: invalid object descriptor." ), + static_cast<XTypeProvider*>(this) + ); + ADOIndexes* pIndexes = m_aCollection; - bError = FAILED(pIndexes->Append(OLEVariant(getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)))), - OLEVariant(pIndex->getImpl()))); + if ( FAILED( pIndexes->Append( OLEVariant( _rForName ), OLEVariant( pIndex->getImpl() ) ) ) ) + { + ADOS::ThrowException(*m_pConnection->getConnection(),static_cast<XTypeProvider*>(this)); + ::dbtools::throwGenericSQLException( + ::rtl::OUString::createFromAscii( "Could not append index." ), + static_cast<XTypeProvider*>(this) + ); } - if(bError) - throw SQLException(::rtl::OUString::createFromAscii("Could not append index!"),static_cast<XTypeProvider*>(this),OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); + + return new OAdoIndex(isCaseSensitive(),m_pConnection,pIndex->getImpl()); } // ------------------------------------------------------------------------- // XDrop void OIndexes::dropObject(sal_Int32 /*_nPos*/,const ::rtl::OUString _sElementName) { m_aCollection.Delete(_sElementName); -} -// ------------------------------------------------------------------------- -sdbcx::ObjectType OIndexes::cloneObject(const Reference< XPropertySet >& _xDescriptor) -{ - OAdoIndex* pIndex = NULL; - if(getImplementation(pIndex,_xDescriptor) && pIndex != NULL) - return new OAdoIndex(isCaseSensitive(),m_pConnection,pIndex->getImpl()); - return sdbcx::ObjectType(); } // ----------------------------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
