Tag: cws_src680_dba30 User: fs Date: 05/05/25 08:01:39 Modified: /dba/dbaccess/source/core/dataaccess/ ModelImpl.cxx
Log: RESYNC: (1.3-1.4); FILE MERGED 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.2.1&r2=1.3.2.2 Delta lines: +39 -36 --------------------- --- ModelImpl.cxx 6 Apr 2005 07:17:36 -0000 1.3.2.1 +++ ModelImpl.cxx 25 May 2005 15:01:36 -0000 1.3.2.2 @@ -327,7 +327,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) @@ -335,29 +335,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 { @@ -419,18 +410,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); @@ -483,14 +463,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(); @@ -516,8 +519,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() ) @@ -674,7 +677,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]
