User: obo Date: 2006/07/10 07:23:57 Modified: dba/connectivity/source/drivers/ado/AKeys.cxx
Log: INTEGRATION: CWS qiq (1.15.104); FILE MERGED 2006/06/27 14:06:46 fs 1.15.104.2: RESYNC: (1.15-1.16); FILE MERGED 2006/06/16 11:32:32 fs 1.15.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]: AKeys.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/ado/AKeys.cxx?r1=1.16&r2=1.17 Delta lines: +35 -34 --------------------- --- AKeys.cxx 20 Jun 2006 01:14:30 -0000 1.16 +++ AKeys.cxx 10 Jul 2006 14:23:55 -0000 1.17 @@ -63,6 +63,9 @@ #ifndef _COMPHELPER_PROPERTY_HXX_ #include <comphelper/property.hxx> #endif +#ifndef _DBHELPER_DBEXCEPTION_HXX_ +#include <connectivity/dbexception.hxx> +#endif using namespace ::comphelper; using namespace connectivity; @@ -84,17 +87,21 @@ m_aCollection.Refresh(); } // ------------------------------------------------------------------------- -Reference< XPropertySet > OKeys::createEmptyObject() +Reference< XPropertySet > OKeys::createDescriptor() { return new OAdoKey(isCaseSensitive(),m_pConnection); } // ------------------------------------------------------------------------- // XAppend -void OKeys::appendObject( const Reference< XPropertySet >& descriptor ) +sdbcx::ObjectType OKeys::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor ) { OAdoKey* pKey = NULL; - if(getImplementation(pKey,descriptor) && pKey != NULL) - { + if ( !getImplementation( pKey, descriptor ) || pKey == NULL) + ::dbtools::throwGenericSQLException( + ::rtl::OUString::createFromAscii( "Could not create key: invalid object descriptor." ), + static_cast<XTypeProvider*>(this) + ); + // To pass as column parameter to Key's Apppend method OLEVariant vOptional; vOptional.setNoArg(); @@ -119,11 +126,13 @@ { ADOS::ThrowException(*m_pConnection->getConnection(),static_cast<XTypeProvider*>(this)); // just make sure that an SQLExceptionis thrown here - throw SQLException(::rtl::OUString::createFromAscii("Could not append key!"),static_cast<XTypeProvider*>(this),OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); + ::dbtools::throwGenericSQLException( + ::rtl::OUString::createFromAscii( "Could not append key." ), + static_cast<XTypeProvider*>(this) + ); } - } - else - throw SQLException(::rtl::OUString::createFromAscii("Could not append key!"),static_cast<XTypeProvider*>(this),OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); + + return new OAdoKey(isCaseSensitive(),m_pConnection,pKey->getImpl()); } // ------------------------------------------------------------------------- // XDrop @@ -131,14 +140,6 @@ { if(!m_aCollection.Delete(OLEVariant(_sElementName))) ADOS::ThrowException(*m_pConnection->getConnection(),static_cast<XTypeProvider*>(this)); -} -// ----------------------------------------------------------------------------- -sdbcx::ObjectType OKeys::cloneObject(const Reference< XPropertySet >& _xDescriptor) -{ - OAdoKey* pKey = NULL; - if(getImplementation(pKey,_xDescriptor) && pKey != NULL) - return new OAdoKey(isCaseSensitive(),m_pConnection,pKey->getImpl()); - return sdbcx::ObjectType(); } // ----------------------------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
