User: rt Date: 05/03/30 03:55:00 Modified: /dba/dbaccess/source/core/dataaccess/ ModelImpl.cxx
Log: INTEGRATION: CWS dba28 (1.2.8); FILE MERGED 2005/03/24 15:50:58 fs 1.2.8.3: #i45314# commitStorage -> commitRootStorage for less confusion 2005/03/23 14:46:17 fs 1.2.8.2: #i45314# +m_sRealFileURL, to be used when the document was recovered from a temporary location 2005/03/21 14:35:25 fs 1.2.8.1: copying the changes from CWS dba26 herein, since they're needed to fix i45314 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.3&r2=1.4 Delta lines: +47 -44 --------------------- --- ModelImpl.cxx 23 Mar 2005 09:45:22 -0000 1.3 +++ ModelImpl.cxx 30 Mar 2005 11:54:58 -0000 1.4 @@ -282,7 +282,7 @@ // ----------------------------------------------------------------------------- ::rtl::OUString ODatabaseModelImpl::getURL( ) { - return m_sFileURL; + return m_sRealFileURL; } // ----------------------------------------------------------------------------- void SAL_CALL ODatabaseModelImpl::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(RuntimeException) @@ -290,29 +290,20 @@ Reference<XConnection> xCon(Source.Source,UNO_QUERY); if ( xCon.is() ) { - sal_Bool bStore = sal_False; + bool bStore = false; OWeakConnectionArray::iterator aEnd = m_aConnections.end(); for (OWeakConnectionArray::iterator i = m_aConnections.begin(); aEnd != i; ++i) { if ( xCon == i->get() ) { *i = OWeakConnection(); + bStore = true; + break; } } if ( bStore ) - { - try - { - Reference<XTransactedObject> xTransact(getStorage(),UNO_QUERY); - if ( xTransact.is() ) - xTransact->commit(); - } - catch(Exception) - { - OSL_ENSURE(0,"Exception Caught: Could not store embedded database!"); - } - } + commitRootStorage(); } else // storage { @@ -374,18 +365,7 @@ sal_Bool bStore = commitEmbeddedStorage(); disposeStorages(); if ( bStore ) - { - try - { - Reference<XTransactedObject> xTransact(getStorage(),UNO_QUERY); - if ( xTransact.is() ) - xTransact->commit(); - } - catch(Exception) - { - OSL_ENSURE(0,"Exception Caught: Could not store embedded database!"); - } - } + commitRootStorage(); if ( m_bOwnStorage ) ::comphelper::disposeComponent(m_xStorage); @@ -438,14 +418,37 @@ m_bDisposingSubStorages = sal_False; } // ----------------------------------------------------------------------------- +Reference< XSingleServiceFactory > ODatabaseModelImpl::createStorageFactory() const +{ + return Reference< XSingleServiceFactory >( + m_xServiceFactory->createInstance( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.StorageFactory" ) ) + ), + UNO_QUERY + ); +} +// ----------------------------------------------------------------------------- +void ODatabaseModelImpl::commitRootStorage() +{ + try + { + Reference< XTransactedObject > xTransact( getStorage(), UNO_QUERY ); + OSL_ENSURE( xTransact.is() || !getStorage().is(), "ODatabaseModelImpl::commitRootStorage: cannot commit the storage (missing interface)!" ); + if ( xTransact.is() ) + xTransact->commit(); + } + catch(Exception) + { + OSL_ENSURE( false, "ODatabaseModelImpl::commitRootStorage: caught an exception!" ); + } +} +// ----------------------------------------------------------------------------- Reference<XStorage> ODatabaseModelImpl::getStorage() { if ( !m_xStorage.is() ) { - Reference< XSingleServiceFactory> xStorageFactory; - xStorageFactory.set(m_xServiceFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.StorageFactory"))),UNO_QUERY); - - if ( xStorageFactory.is() && m_sFileURL.getLength() ) + Reference< XSingleServiceFactory> xStorageFactory = createStorageFactory(); + if ( xStorageFactory.is() && m_sRealFileURL.getLength() ) { Sequence<Any> aArgs(2); const PropertyValue* pEnd = m_aArgs.getConstArray() + m_aArgs.getLength(); @@ -471,8 +474,8 @@ if ( pValue && pValue != pEnd ) aArgs[0] = pValue->Value; - else if ( m_sFileURL.getLength() ) - aArgs[0] <<= m_sFileURL; + else if ( m_sRealFileURL.getLength() ) + aArgs[0] <<= m_sRealFileURL; } if ( aArgs[0].hasValue() ) @@ -629,7 +632,7 @@ { clear(); dispose(); - m_pDBContext->deregisterPrivate(m_sFileURL); + m_pDBContext->deregisterPrivate(m_sRealFileURL); delete this; return 0; } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
