Kaydet (Commit) 97803ae7 authored tarafından Michael Stahl's avatar Michael Stahl Kaydeden (comit) Thorsten Behrens

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: 's avatarMichael Stahl <Michael.Stahl@cib.de>
(cherry picked from commit 577a9708)
Reviewed-on: https://gerrit.libreoffice.org/67062Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
üst da525193
...@@ -608,6 +608,7 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString ...@@ -608,6 +608,7 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString
if(aMiscOptions.IsExperimentalMode() && m_pImpl->m_sConnectURL == "sdbc:embedded:hsqldb") if(aMiscOptions.IsExperimentalMode() && m_pImpl->m_sConnectURL == "sdbc:embedded:hsqldb")
{ {
Reference<XStorage> const xRootStorage = m_pImpl->getOrCreateRootStorage();
OUString sMigrEnvVal; OUString sMigrEnvVal;
osl_getEnvironment(OUString("DBACCESS_HSQL_MIGRATION").pData, osl_getEnvironment(OUString("DBACCESS_HSQL_MIGRATION").pData,
&sMigrEnvVal.pData); &sMigrEnvVal.pData);
...@@ -615,14 +616,18 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString ...@@ -615,14 +616,18 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString
bNeedMigration = true; bNeedMigration = true;
else else
{ {
MigrationWarnDialog aWarnDlg(GetFrameWeld(m_pImpl->getModel_noCreate())); Reference<XPropertySet> const xPropSet(xRootStorage, UNO_QUERY_THROW);
bNeedMigration = aWarnDlg.run() == RET_OK; 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) if (bNeedMigration)
{ {
// back up content xml file if migration was successful // back up content xml file if migration was successful
Reference<XStorage> xRootStorage = m_pImpl->getOrCreateRootStorage();
constexpr char BACKUP_XML_NAME[] = "content_before_migration.xml"; constexpr char BACKUP_XML_NAME[] = "content_before_migration.xml";
try try
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment