summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}