Kaydet (Commit) 5b0ceb86 authored tarafından Tamas Bunth's avatar Tamas Bunth Kaydeden (comit) Tamás Bunth

tdf#116944 Warn user before database migration

Warn user with a pop-up dialog before migration.

To do that we have to know the database URL at UI level. In order to get
that I updated XDataSource interface with getConnectionURL().

The dialog offers two options: proceed with or without migration. If the
user choose "yes", we store that information in XDataSource. The
migration itself will be made in buildLowConnection().

Change-Id: I1f0d03da6352f7a0a8d989da79c4b2fe60a03ca1
Reviewed-on: https://gerrit.libreoffice.org/52876Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarTamás Bunth <btomi96@gmail.com>
üst f7d155e7
......@@ -152,6 +152,7 @@ $(eval $(call gb_Library_add_exception_objects,dbu,\
dbaccess/source/ui/dlg/textconnectionsettings \
dbaccess/source/ui/dlg/UserAdmin \
dbaccess/source/ui/dlg/UserAdminDlg \
dbaccess/source/ui/dlg/migrwarndlg \
dbaccess/source/ui/misc/asyncmodaldialog \
dbaccess/source/ui/misc/charsets \
dbaccess/source/ui/misc/controllerframe \
......
......@@ -80,6 +80,7 @@ $(eval $(call gb_UIConfig_add_uifiles,dbaccess, \
dbaccess/uiconfig/ui/useradmindialog \
dbaccess/uiconfig/ui/useradminpage \
dbaccess/uiconfig/ui/userdetailspage \
dbaccess/uiconfig/ui/migrwarndlg \
))
# vim: set noet sw=4 ts=4:
......@@ -575,22 +575,24 @@ void ODatabaseSource::disposing()
m_pImpl.clear();
}
OUString SAL_CALL ODatabaseSource::getConnectionUrl()
{
return m_pImpl->m_sConnectURL;
}
Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString& _rUid, const OUString& _rPwd)
{
Reference< XConnection > xReturn;
Reference< XDriverManager > xManager;
bool bNeedMigration = false;
OUString sMigrEnvVal;
osl_getEnvironment(OUString("DBACCESS_HSQL_MIGRATION").pData,
&sMigrEnvVal.pData);
if( m_pImpl->m_sConnectURL == "sdbc:embedded:hsqldb" &&
!sMigrEnvVal.isEmpty())
{
bool bNeedMigration = m_pImpl->m_sConnectURL == "sdbc:embedded:hsqldb" &&
(m_bMigationNeeded || !sMigrEnvVal.isEmpty());
if(bNeedMigration)
m_pImpl->m_sConnectURL = "sdbc:embedded:firebird";
bNeedMigration = true;
}
try {
xManager.set( ConnectionPool::create( m_pImpl->m_aContext ), UNO_QUERY_THROW );
......
......@@ -84,6 +84,7 @@ private:
using ODatabaseSource_Base::rBHelper;
// note: this thing uses the ref-count of "this", see OBookmarkContainer::acquire!
OBookmarkContainer m_Bookmarks;