User: obo Date: 2006/07/10 07:24:41 Modified: dba/connectivity/source/drivers/ado/AViews.cxx
Log: INTEGRATION: CWS qiq (1.13.104); FILE MERGED 2006/06/27 14:11:29 fs 1.13.104.2: RESYNC: (1.13-1.14); FILE MERGED 2006/06/16 11:32:32 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]: AViews.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/ado/AViews.cxx?r1=1.14&r2=1.15 Delta lines: +31 -25 --------------------- --- AViews.cxx 20 Jun 2006 01:16:24 -0000 1.14 +++ AViews.cxx 10 Jul 2006 14:24:39 -0000 1.15 @@ -56,6 +56,9 @@ #ifndef _COMPHELPER_TYPES_HXX_ #include <comphelper/types.hxx> #endif +#ifndef _DBHELPER_DBEXCEPTION_HXX_ +#include <connectivity/dbexception.hxx> +#endif using namespace ::comphelper; @@ -79,24 +82,31 @@ m_aCollection.Refresh(); } // ------------------------------------------------------------------------- -Reference< XPropertySet > OViews::createEmptyObject() +Reference< XPropertySet > OViews::createDescriptor() { return new OAdoView(isCaseSensitive()); } // ------------------------------------------------------------------------- // XAppend -void OViews::appendObject( const Reference< XPropertySet >& descriptor ) +sdbcx::ObjectType OViews::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor ) { OAdoView* pView = NULL; - if(getImplementation(pView,descriptor) && pView != NULL) - { + if ( !getImplementation( pView, descriptor ) || pView == NULL ) + ::dbtools::throwGenericSQLException( + ::rtl::OUString::createFromAscii( "Could not create view: invalid object descriptor." ), + static_cast<XTypeProvider*>(this) + ); + WpADOCommand aCommand; aCommand.Create(); - if(aCommand.IsValid()) - { - ::rtl::OUString sName; - descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= sName; + if ( !aCommand.IsValid() ) + ::dbtools::throwGenericSQLException( + ::rtl::OUString::createFromAscii( "Could not create view: no command object." ), + static_cast<XTypeProvider*>(this) + ); + + ::rtl::OUString sName( _rForName ); aCommand.put_Name(sName); aCommand.put_CommandText(getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_COMMAND)))); ADOViews* pViews = (ADOViews*)m_aCollection; @@ -104,14 +114,10 @@ ADOS::ThrowException(*m_pCatalog->getConnection()->getConnection(),static_cast<XTypeProvider*>(this)); OTables* pTables = static_cast<OTables*>(static_cast<OCatalog&>(m_rParent).getPrivateTables()); - if(pTables) + if ( pTables ) pTables->appendNew(sName); - } - else - throw SQLException(::rtl::OUString::createFromAscii("Could not append view!"),static_cast<XTypeProvider*>(this),OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); - } - else - throw SQLException(::rtl::OUString::createFromAscii("Could not append view!"),static_cast<XTypeProvider*>(this),OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any()); + + return createObject( _rForName ); } // ------------------------------------------------------------------------- // XDrop --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
