summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorAndrzej J.R. Hunt <andrzej@ahunt.org>2013-09-05 17:16:02 +0100
committerCaolán McNamara <caolanm@redhat.com>2013-09-06 19:38:08 +0000
commit08ea5af067df79e7abfd87fc2a319a774aebbc80 (patch)
tree0220e867049bd186a2b09b6eae8be6dfafc7cc7a /connectivity
parent508d1bf7dfa1be99e3fc8d57eb780150af53290e (diff)
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@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/firebird/Connection.cxx16
-rw-r--r--connectivity/source/drivers/firebird/Connection.hxx4
2 files changed, 9 insertions, 11 deletions
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 <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