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

Andrzej J.R. Hunt andrzej at ahunt.org
Fri Aug 30 01:34:32 PDT 2013


 connectivity/source/drivers/firebird/Driver.cxx |   17 +++++++++++++++++
 connectivity/source/drivers/firebird/Driver.hxx |    4 ++++
 2 files changed, 21 insertions(+)

New commits:
commit 295759c05395099e564e263b98e5e4a38a9a9bc4
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date:   Thu Aug 29 12:59:50 2013 +0100

    Set FIREBIRD_TMP and FIREBIRD_LOCK with sane values. (firebird-sdbc)
    
    Currently firebird uses /tmp and C://temp/ as default temporary directories,
    both of which can be incorrect. Instead we now pass the correct temp
    directories to firebird.
    
    Change-Id: I807a47475e76600365e7a2ccfa78d755621dedb7
    Reviewed-on: https://gerrit.libreoffice.org/5678
    Reviewed-by: Tor Lillqvist <tml at iki.fi>
    Tested-by: Tor Lillqvist <tml at iki.fi>

diff --git a/connectivity/source/drivers/firebird/Driver.cxx b/connectivity/source/drivers/firebird/Driver.cxx
index 2b9e656..89c9cfd 100644
--- a/connectivity/source/drivers/firebird/Driver.cxx
+++ b/connectivity/source/drivers/firebird/Driver.cxx
@@ -26,6 +26,8 @@
 #include "resource/sharedresources.hxx"
 
 #include <comphelper/processfactory.hxx>
+#include <osl/process.h>
+#include <osl/file.hxx>
 
 using namespace com::sun::star;
 using namespace com::sun::star::uno;
@@ -52,9 +54,21 @@ namespace connectivity
     }
 }
 
+// Static const member variables
+const OUString FirebirdDriver::our_sFirebirdTmpVar("FIREBIRD_TMP");
+const OUString FirebirdDriver::our_sFirebirdLockVar("FIREBIRD_LOCK");
+
 FirebirdDriver::FirebirdDriver()
     : ODriver_BASE(m_aMutex)
 {
+    OUString sTmpDir;
+    ::osl::FileBase::getTempDirURL(sTmpDir);
+
+    // Overrides firebird's default of /tmp or c:\temp
+    osl_setEnvironment(our_sFirebirdTmpVar.pData, sTmpDir.pData);
+    // Overrides firebird's default of /tmp/firebird or c:\temp\firebird
+    sTmpDir += "/firebird";
+    osl_setEnvironment(our_sFirebirdLockVar.pData, sTmpDir.pData);
 }
 
 void FirebirdDriver::disposing()
@@ -70,6 +84,9 @@ void FirebirdDriver::disposing()
     }
     m_xConnections.clear();
 
+    osl_clearEnvironment(our_sFirebirdTmpVar.pData);
+    osl_clearEnvironment(our_sFirebirdLockVar.pData);
+
     ODriver_BASE::disposing();
 }
 
diff --git a/connectivity/source/drivers/firebird/Driver.hxx b/connectivity/source/drivers/firebird/Driver.hxx
index 545d98a..0963468 100644
--- a/connectivity/source/drivers/firebird/Driver.hxx
+++ b/connectivity/source/drivers/firebird/Driver.hxx
@@ -44,6 +44,10 @@ namespace connectivity
 
         class FirebirdDriver : public ODriver_BASE
         {
+        private:
+            static const ::rtl::OUString our_sFirebirdTmpVar;
+            static const ::rtl::OUString our_sFirebirdLockVar;
+
         protected:
             ::osl::Mutex                m_aMutex;       // mutex is need to control member access
             OWeakRefArray               m_xConnections; //  vector containing a list


More information about the Libreoffice-commits mailing list