Tag: cws_src680_dba23b User: fs Date: 2007-07-07 20:21:11+0000 Modified: dba/dbaccess/source/core/dataaccess/ModelImpl.cxx dba/dbaccess/source/core/dataaccess/ModelImpl.hxx
Log: during #i78593#: don't re-create the Settings property bag when it's not necessary File Changes: Directory: /dba/dbaccess/source/core/dataaccess/ ================================================ File [changed]: ModelImpl.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/ModelImpl.cxx?r1=1.18.60.2&r2=1.18.60.3 Delta lines: +19 -12 --------------------- --- ModelImpl.cxx 2007-07-07 19:25:04+0000 1.18.60.2 +++ ModelImpl.cxx 2007-07-07 20:21:08+0000 1.18.60.3 @@ -4,9 +4,9 @@ * * $RCSfile: ModelImpl.cxx,v $ * - * $Revision: 1.18.60.2 $ + * $Revision: 1.18.60.3 $ * - * last change: $Author: fs $ $Date: 2007/07/07 19:25:04 $ + * last change: $Author: fs $ $Date: 2007/07/07 20:21:08 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -392,6 +392,7 @@ ,m_pStorageAccess( NULL ) ,m_xMutex( new SharedMutex ) ,m_xServiceFactory(_rxFactory) + ,m_aContainer(4) ,m_nLoginTimeout(0) ,m_bReadOnly(sal_False) // we're created as service and have to allow the setting of properties ,m_bPasswordRequired(sal_False) @@ -410,7 +411,7 @@ m_sConnectURL = ::rtl::OUString::createFromAscii("jdbc:"); m_aTableFilter.realloc(1); m_aTableFilter[0] = ::rtl::OUString::createFromAscii("%"); - lateInit(); + impl_construct_nothrow(); } //-------------------------------------------------------------------------- @@ -422,9 +423,10 @@ :m_pStorageAccess( NULL ) ,m_xMutex( new SharedMutex ) ,m_xServiceFactory(_rxFactory) + ,m_aContainer(4) ,m_sName(_rRegistrationName) ,m_nLoginTimeout(0) - ,m_bReadOnly(sal_True) // assume readonly for the moment, adjusted below + ,m_bReadOnly(sal_False) ,m_bPasswordRequired(sal_False) ,m_bSuppressVersionColumns(sal_True) ,m_bModified(sal_False) @@ -439,7 +441,7 @@ DBG_CTOR(ODatabaseModelImpl,NULL); // adjust our readonly flag - lateInit(); + impl_construct_nothrow(); } //-------------------------------------------------------------------------- @@ -447,12 +449,10 @@ { DBG_DTOR(ODatabaseModelImpl,NULL); } + // ----------------------------------------------------------------------------- -void ODatabaseModelImpl::lateInit() +void ODatabaseModelImpl::impl_construct_nothrow() { - m_bReadOnly = sal_False; - m_aContainer.resize(4); - // create the property bag to hold the settings (also known as "Info" property) try { @@ -481,8 +481,7 @@ ) ); // insert the default settings - Reference< XPropertyContainer > xContainer( m_xSettings, UNO_QUERY ); - OSL_ENSURE( xContainer.is(), "ODatabaseModelImpl::lateInit: invalid property bag - this will crash, sooner or later!" ); + Reference< XPropertyContainer > xContainer( m_xSettings, UNO_QUERY_THROW ); const AsciiPropertyValue* pSettings = getDefaultDataSourceSettings(); for ( ; pSettings->AsciiName; ++pSettings ) { @@ -495,8 +494,16 @@ } catch( const Exception& ) { - OSL_ENSURE( sal_False, "ODatabaseModelImpl::lateInit: could not create the PropertyBag for the Info/Settings properties!" ); + DBG_UNHANDLED_EXCEPTION(); } +} + +// ----------------------------------------------------------------------------- +void ODatabaseModelImpl::reset() +{ + m_bReadOnly = sal_False; + ::std::vector< TContentPtr > aEmptyContainers( 4 ); + m_aContainer.swap( aEmptyContainers ); if ( m_pStorageAccess ) { File [changed]: ModelImpl.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/ModelImpl.hxx?r1=1.14.66.2&r2=1.14.66.3 Delta lines: +6 -3 ------------------- --- ModelImpl.hxx 2007-06-28 09:02:47+0000 1.14.66.2 +++ ModelImpl.hxx 2007-07-07 20:21:09+0000 1.14.66.3 @@ -4,9 +4,9 @@ * * $RCSfile: ModelImpl.hxx,v $ * - * $Revision: 1.14.66.2 $ + * $Revision: 1.14.66.3 $ * - * last change: $Author: fs $ $Date: 2007/06/28 09:02:47 $ + * last change: $Author: fs $ $Date: 2007/07/07 20:21:09 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -293,7 +293,7 @@ sal_Bool m_bOwnStorage; - void lateInit(); + void reset(); /** determines whether the database document has an embedded data storage */ @@ -419,6 +419,9 @@ /// returns a all known data source settings, including their default values static const AsciiPropertyValue* getDefaultDataSourceSettings(); + +private: + void impl_construct_nothrow(); }; /** a small base class for UNO components whose functionality depends on a ODatabaseModelImpl --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
