Tag: cws_src680_dba24
User: oj      
Date: 05/02/21 22:34:42

Modified:
 /dba/dbaccess/source/core/dataaccess/
  databasedocument.cxx

Log:
 RESYNC: (1.8-1.11); FILE MERGED

File Changes:

Directory: /dba/dbaccess/source/core/dataaccess/
================================================

File [changed]: databasedocument.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/databasedocument.cxx?r1=1.8.2.4&r2=1.8.2.5
Delta lines:  +65 -23
---------------------
--- databasedocument.cxx        21 Feb 2005 11:03:50 -0000      1.8.2.4
+++ databasedocument.cxx        22 Feb 2005 06:34:40 -0000      1.8.2.5
@@ -289,6 +289,11 @@
        if ( !m_pImpl->m_sName.getLength() )
                m_pImpl->m_sName = m_pImpl->m_sFileURL;
        
+    if ( m_pImpl->m_pDBContext )
+    {
+               m_pImpl->m_pDBContext->registerPrivate(_sURL,m_pImpl);
+        m_pImpl->setModified(sal_False);
+    }
        m_pImpl->getStorage();
 
        Reference<XDataSource> xDs = m_pImpl->getDataSource();
@@ -340,12 +345,6 @@
        {
                return sal_False;
        }
-
-    if ( m_pImpl->m_pDBContext )
-    {
-               m_pImpl->m_pDBContext->registerPrivate(_sURL,m_pImpl);
-        m_pImpl->setModified(sal_False);
-    }
        return sal_True;
 }
 // 
-----------------------------------------------------------------------------
@@ -465,21 +464,7 @@
        if ( m_pImpl->m_bDocumentReadOnly )
                throw IOException();
 
-       try
-       {
-               TStorages::iterator aIter = m_pImpl->m_aStorages.begin();
-               TStorages::iterator aEnd = m_pImpl->m_aStorages.end();
-               for (; aIter != aEnd ; ++aIter)
-               {
-                       Reference<XTransactedObject> 
xTrans(aIter->second,UNO_QUERY);
-                       if ( xTrans.is() )
-                               xTrans->commit();
-               }
-       }
-       catch(WrappedTargetException)
-       {
-               throw IOException();
-       }
+    m_pImpl->commitStorages();
 
        writeStorage(sURL,lArguments);
 
@@ -503,7 +488,8 @@
        Reference<XSingleServiceFactory> 
xStorageFactory(m_pImpl->m_xServiceFactory->createInstance( 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.StorageFactory"))
 ),UNO_QUERY);
        if ( xStorageFactory.is() )
        {
-               if ( sURL != m_pImpl->m_sFileURL )
+        sal_Bool bClearConnections;
+               if ( bClearConnections = (sURL != m_pImpl->m_sFileURL) )
                {
                        Sequence<Any> aParam(2);
                        aParam[0] <<= sURL;
@@ -518,9 +504,14 @@
                        if ( !xStorage.is() )
                                throw IOException();
 
+            if ( m_sConnectURL.compareToAscii("sdbc:embedded:",14) == 0 )
+                clearConnections();
+            commitEmbeddedStorage();
+
                        Reference<XStorage> xMyStorage = m_pImpl->getStorage();
                        if ( xMyStorage.is() )
                        {
+                commitStorages();
                                xMyStorage->copyToStorage( xStorage );
                        }
 
@@ -548,7 +539,6 @@
                                        m_pImpl->m_sName = sURL;
                        }
                        m_pImpl->m_sFileURL = sURL;
-                       
                }
                lcl_convertArguments(lArguments,m_pImpl->m_aArgs);
                store(m_pImpl->m_sFileURL,lArguments);
@@ -1212,6 +1202,58 @@
        if ( m_pImpl.is() )
                m_pImpl->disposing(Source);
 }
+//------------------------------------------------------------------
+void SAL_CALL ODatabaseSource::preCommit( const 
::com::sun::star::lang::EventObject& aEvent ) throw 
(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+}
+//------------------------------------------------------------------
+void SAL_CALL ODatabaseSource::commited( const 
::com::sun::star::lang::EventObject& aEvent ) throw 
(::com::sun::star::uno::RuntimeException)
+{
+    ::osl::MutexGuard aGuard(m_aMutex);
+    TStorages::iterator aFind = 
m_aStorages.find(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("database")));
+    Reference<XStorage> xStorage(aEvent.Source,UNO_QUERY);
+       if ( aFind != m_aStorages.end() && aFind->second == xStorage )
+       {
+        try
+           {
+                   Reference<XTransactedObject> 
xTransact(getStorage(),UNO_QUERY);
+                   if ( xTransact.is() )
+                           xTransact->commit();
+           }
+           catch(Exception)
+           {
+                   OSL_ENSURE(0,"Exception Caught: Could not store embedded 
database!");
+           }
+    }
+}
+//------------------------------------------------------------------
+void SAL_CALL ODatabaseSource::preRevert( const 
::com::sun::star::lang::EventObject& aEvent ) throw 
(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+}
+//------------------------------------------------------------------
+void SAL_CALL ODatabaseSource::reverted( const 
::com::sun::star::lang::EventObject& aEvent ) throw 
(::com::sun::star::uno::RuntimeException)
+{
+}
+//------------------------------------------------------------------
+void ODatabaseSource::commitStorages()
+{
+    try
+       {
+               TStorages::iterator aIter = m_aStorages.begin();
+               TStorages::iterator aEnd = m_aStorages.end();
+               for (; aIter != aEnd ; ++aIter)
+               {
+                       Reference<XTransactedObject> 
xTrans(aIter->second,UNO_QUERY);
+                       if ( xTrans.is() )
+                               xTrans->commit();
+               }
+       }
+       catch(WrappedTargetException)
+       {
+               throw IOException();
+       }
+}
 //........................................................................
 }      // namespace dbaccess
 //........................................................................
+




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to