summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2019-01-28 17:14:03 +0100
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2019-01-29 18:02:11 +0100
commitab223e94dea0876ccbb2cf4c897804466e638625 (patch)
tree06e2d0ed097af59fa29fb20c57cd6ee1b613f58d /dbaccess
parent8bc2018c83aeef691313502a83e42e8a0cc8adf4 (diff)
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.Stahl@cib.de> (cherry picked from commit 577a9708ea9594d60b66c1c71d24175c66d24096) Reviewed-on: https://gerrit.libreoffice.org/67065 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/core/dataaccess/datasource.cxx11
1 files changed, 9 insertions, 2 deletions
diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx
index 7943104ff0a5..0c89cfb04324 100644
--- a/dbaccess/source/core/dataaccess/datasource.cxx
+++ b/dbaccess/source/core/dataaccess/datasource.cxx
@@ -607,6 +607,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);
@@ -614,8 +615,14 @@ 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)
m_pImpl->m_sConnectURL = "sdbc:embedded:firebird";