summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco FaulĂ­ <xiscofauli@libreoffice.org>2018-07-16 18:18:12 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-07-18 09:13:42 +0200
commit0b3ee8ffbb6b33827c17af56c62dc5285f3ba258 (patch)
tree7fe43885ef2f54b34882a6ba6fcb268dda7a35b7
parent91eec155eb9433343c7e549907960855b6e91e7b (diff)
tdf#118752: Enable firebird migration in experimental mode
Only in 6.1 Revert "Disable migration in this release" This reverts commit 443da1959d02569c59d064748a06d39c6dbb2f64. Change-Id: Ib3286b01205ac5360aa299346ee524825e739167 Reviewed-on: https://gerrit.libreoffice.org/57508 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--dbaccess/source/core/dataaccess/datasource.cxx33
1 files changed, 33 insertions, 0 deletions
diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx
index 4689d2594773..22c7f6685d1a 100644
--- a/dbaccess/source/core/dataaccess/datasource.cxx
+++ b/dbaccess/source/core/dataaccess/datasource.cxx
@@ -27,6 +27,7 @@
#include "SharedConnection.hxx"
#include "databasedocument.hxx"
#include <OAuthenticationContinuation.hxx>
+#include <svtools/miscopt.hxx>
#include <hsqlimport.hxx>
#include <migrwarndlg.hxx>
@@ -583,6 +584,27 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString
Reference< XDriverManager > xManager;
+#if ENABLE_FIREBIRD_SDBC
+ bool bNeedMigration = false;
+ SvtMiscOptions aMiscOptions;
+
+ if( aMiscOptions.IsExperimentalMode() && m_pImpl->m_sConnectURL == "sdbc:embedded:hsqldb" )
+ {
+ OUString sMigrEnvVal;
+ osl_getEnvironment(OUString("DBACCESS_HSQL_MIGRATION").pData,
+ &sMigrEnvVal.pData);
+ if(!sMigrEnvVal.isEmpty())
+ bNeedMigration = true;
+ else
+ {
+ MigrationWarnDialog aWarnDlg{nullptr};
+ bNeedMigration = aWarnDlg.run() == RET_OK;
+ }
+ if (bNeedMigration)
+ m_pImpl->m_sConnectURL = "sdbc:embedded:firebird";
+ }
+#endif
+
try {
xManager.set( ConnectionPool::create( m_pImpl->m_aContext ), UNO_QUERY_THROW );
} catch( const Exception& ) { }
@@ -694,6 +716,17 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString
throwGenericSQLException( sMessage, static_cast< XDataSource* >( this ), makeAny( aContext ) );
}
+#if ENABLE_FIREBIRD_SDBC
+ if( bNeedMigration )
+ {
+ Reference< css::document::XDocumentSubStorageSupplier> xDocSup(
+ m_pImpl->getDocumentSubStorageSupplier() );
+ dbahsql::HsqlImporter importer(xReturn,
+ xDocSup->getDocumentSubStorage("database",ElementModes::READWRITE) );
+ importer.importHsqlDatabase();
+ }
+#endif
+
return xReturn;
}