diff options
author | Oliver Bolte <obo@openoffice.org> | 2006-07-10 13:24:39 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2006-07-10 13:24:39 +0000 |
commit | bddf89c7e887bb57936215ad9923b131c58a3cd1 (patch) | |
tree | 01c109364cd94e5470af3549c9cbe78efa7617ae /connectivity | |
parent | 557046d52278c2f351c346c3a1e17a5b052ebc3c (diff) |
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)
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/drivers/ado/AViews.cxx | 58 |
1 files changed, 32 insertions, 26 deletions
diff --git a/connectivity/source/drivers/ado/AViews.cxx b/connectivity/source/drivers/ado/AViews.cxx index 2ea63c0ee207..4c2647e6ed6e 100644 --- a/connectivity/source/drivers/ado/AViews.cxx +++ b/connectivity/source/drivers/ado/AViews.cxx @@ -4,9 +4,9 @@ * * $RCSfile: AViews.cxx,v $ * - * $Revision: 1.14 $ + * $Revision: 1.15 $ * - * last change: $Author: hr $ $Date: 2006-06-20 01:16:24 $ + * last change: $Author: obo $ $Date: 2006-07-10 14:24:39 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -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,39 +82,42 @@ void OViews::impl_refresh( ) throw(RuntimeException) 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) - { - WpADOCommand aCommand; - aCommand.Create(); - if(aCommand.IsValid()) - { - ::rtl::OUString sName; - descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= sName; - aCommand.put_Name(sName); - aCommand.put_CommandText(getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_COMMAND)))); - ADOViews* pViews = (ADOViews*)m_aCollection; - if(FAILED(pViews->Append(OLEString(sName),aCommand))) - ADOS::ThrowException(*m_pCatalog->getConnection()->getConnection(),static_cast<XTypeProvider*>(this)); + 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() ) + ::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; + if(FAILED(pViews->Append(OLEString(sName),aCommand))) + ADOS::ThrowException(*m_pCatalog->getConnection()->getConnection(),static_cast<XTypeProvider*>(this)); + + OTables* pTables = static_cast<OTables*>(static_cast<OCatalog&>(m_rParent).getPrivateTables()); + if ( pTables ) + pTables->appendNew(sName); - OTables* pTables = static_cast<OTables*>(static_cast<OCatalog&>(m_rParent).getPrivateTables()); - 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 |