From 08ea5af067df79e7abfd87fc2a319a774aebbc80 Mon Sep 17 00:00:00 2001 From: "Andrzej J.R. Hunt" Date: Thu, 5 Sep 2013 17:16:02 +0100 Subject: Keep a TempFile instead of using TempFile::CreateTempName. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Caolán McNamara --- connectivity/source/drivers/firebird/Connection.cxx | 16 +++++----------- connectivity/source/drivers/firebird/Connection.hxx | 4 ++++ 2 files changed, 9 insertions(+), 11 deletions(-) (limited to 'connectivity') diff --git a/connectivity/source/drivers/firebird/Connection.cxx b/connectivity/source/drivers/firebird/Connection.cxx index d719b853cab9..9f5b00373734 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 7a21acad0110..21da127a01da 100644 --- a/connectivity/source/drivers/firebird/Connection.hxx +++ b/connectivity/source/drivers/firebird/Connection.hxx @@ -25,12 +25,14 @@ #include +#include #include #include #include #include #include #include +#include #include #include @@ -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 -- cgit