dbaccess/source/core/dataaccess/datasource.cxx |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

New commits:
commit 97803ae75c27368aa2880f58c0c661b9a01d4d00
Author:     Michael Stahl <michael.st...@cib.de>
AuthorDate: Mon Jan 28 17:14:03 2019 +0100
Commit:     Thorsten Behrens <thorsten.behr...@cib.de>
CommitDate: Tue Jan 29 18:00:26 2019 +0100

    dbaccess: don't try to migrate read-only file
    
    It's going to throw IOException anyway.
    
    This fixes CppunitTest_dbaccess_hsqldb_test on read-only file system.
    
    Change-Id: Ifc8a4791ab9a1a8d3e0f1e67d65e10dac458147c
    Reviewed-on: https://gerrit.libreoffice.org/67028
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@cib.de>
    (cherry picked from commit 577a9708ea9594d60b66c1c71d24175c66d24096)
    Reviewed-on: https://gerrit.libreoffice.org/67062
    Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de>

diff --git a/dbaccess/source/core/dataaccess/datasource.cxx 
b/dbaccess/source/core/dataaccess/datasource.cxx
index c6c851313707..ec9082bb34b1 100644
--- a/dbaccess/source/core/dataaccess/datasource.cxx
+++ b/dbaccess/source/core/dataaccess/datasource.cxx
@@ -608,6 +608,7 @@ Reference< XConnection > 
ODatabaseSource::buildLowLevelConnection(const OUString
 
     if(aMiscOptions.IsExperimentalMode() && m_pImpl->m_sConnectURL == 
"sdbc:embedded:hsqldb")
     {
+        Reference<XStorage> const xRootStorage = 
m_pImpl->getOrCreateRootStorage();
         OUString sMigrEnvVal;
         osl_getEnvironment(OUString("DBACCESS_HSQL_MIGRATION").pData,
             &sMigrEnvVal.pData);
@@ -615,14 +616,18 @@ Reference< XConnection > 
ODatabaseSource::buildLowLevelConnection(const OUString
             bNeedMigration = true;
         else
         {
-            MigrationWarnDialog 
aWarnDlg(GetFrameWeld(m_pImpl->getModel_noCreate()));
-            bNeedMigration = aWarnDlg.run() == RET_OK;
+            Reference<XPropertySet> const xPropSet(xRootStorage, 
UNO_QUERY_THROW);
+            sal_Int32 nOpenMode(0);
+            if ((xPropSet->getPropertyValue("OpenMode") >>= nOpenMode)
+                && (nOpenMode & css::embed::ElementModes::WRITE))
+            {
+                MigrationWarnDialog 
aWarnDlg(GetFrameWeld(m_pImpl->getModel_noCreate()));
+                bNeedMigration = aWarnDlg.run() == RET_OK;
+            }
         }
         if (bNeedMigration)
         {
             // back up content xml file if migration was successful
-            Reference<XStorage> xRootStorage = 
m_pImpl->getOrCreateRootStorage();
-
             constexpr char BACKUP_XML_NAME[] = "content_before_migration.xml";
             try
             {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to