[Libreoffice-commits] core.git: connectivity/source

Andrzej J.R. Hunt andrzej at ahunt.org
Fri Sep 6 12:38:27 PDT 2013


 connectivity/source/drivers/firebird/Connection.cxx |   16 +++++-----------
 connectivity/source/drivers/firebird/Connection.hxx |    4 ++++
 2 files changed, 9 insertions(+), 11 deletions(-)

New commits:
commit 08ea5af067df79e7abfd87fc2a319a774aebbc80
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date:   Thu Sep 5 17:16:02 2013 +0100

    Keep a TempFile instead of using TempFile::CreateTempName.
    
    This ensures that the enclosing directory is kept while we work with
    it.
    
    Conflicts:
    	connectivity/source/drivers/firebird/Connection.cxx
    
    Change-Id: I5c095d481414e345cf05efc3d40d314f8f40ed12
    Reviewed-on: https://gerrit.libreoffice.org/5814
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/connectivity/source/drivers/firebird/Connection.cxx b/connectivity/source/drivers/firebird/Connection.cxx
index d719b85..9f5b003 100644
--- a/connectivity/source/drivers/firebird/Connection.cxx
+++ b/connectivity/source/drivers/firebird/Connection.cxx
@@ -149,10 +149,12 @@ void OConnection::construct(const ::rtl::OUString& url, const Sequence< Property
 
         bIsNewDatabase = !m_xEmbeddedStorage->hasElements();
 
-        m_sURL = utl::TempFile::CreateTempName();
+        m_pExtractedFDBFile.reset(new ::utl::TempFile(NULL, true));
+        m_pExtractedFDBFile->EnableKillingFile();
+        m_sURL = m_pExtractedFDBFile->GetFileName() + "/firebird.fdb";
+
+        SAL_INFO("connectivity.firebird", "Temporary .fdb location:  " << m_sURL);
 
-        SAL_INFO("connectivity.firebird", "Temporary .fdb location:  "
-                    << OUStringToOString(m_sURL,RTL_TEXTENCODING_UTF8 ).getStr());
         if (!bIsNewDatabase)
         {
             SAL_INFO("connectivity.firebird", "Extracting .fdb from .odb" );
@@ -746,14 +748,6 @@ void OConnection::disposing()
         evaluateStatusVector(status, "isc_detach_database", *this);
     }
     // TODO: write to storage again?
-    if (m_bIsEmbedded)
-    {
-        uno::Reference< ucb::XSimpleFileAccess > xFileAccess(
-            ucb::SimpleFileAccess::create( comphelper::getProcessComponentContext()),
-            uno::UNO_QUERY);
-        if (xFileAccess->exists(m_sURL))
-            xFileAccess->kill(m_sURL);
-    }
 
     dispose_ChildImpl();
     cppu::WeakComponentImplHelperBase::disposing();
diff --git a/connectivity/source/drivers/firebird/Connection.hxx b/connectivity/source/drivers/firebird/Connection.hxx
index 7a21aca..21da127 100644
--- a/connectivity/source/drivers/firebird/Connection.hxx
+++ b/connectivity/source/drivers/firebird/Connection.hxx
@@ -25,12 +25,14 @@
 
 #include <ibase.h>
 
+#include <boost/scoped_ptr.hpp>
 #include <connectivity/CommonTools.hxx>
 #include <connectivity/OSubComponent.hxx>
 #include <cppuhelper/compbase4.hxx>
 #include <cppuhelper/weakref.hxx>
 #include <map>
 #include <OTypeInfo.hxx>
+#include <unotools/tempfile.hxx>
 
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/document/DocumentEvent.hpp>
@@ -74,6 +76,8 @@ namespace connectivity
             ::osl::Mutex&                   getMutex()
                                             { return m_aMutex; }
         protected:
+            ::boost::scoped_ptr< ::utl::TempFile > m_pExtractedFDBFile;
+
             static const OUString sDBLocation; // Location within .odb container
             //====================================================================
             // Data attributes


More information about the Libreoffice-commits mailing list