summaryrefslogtreecommitdiff
path: root/dbaccess/source
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source')
-rw-r--r--dbaccess/source/core/dataaccess/datasource.cxx14
-rw-r--r--dbaccess/source/core/dataaccess/datasource.hxx4
-rw-r--r--dbaccess/source/core/inc/warndlg.hxx29
-rw-r--r--dbaccess/source/core/misc/warndlg.cxx22
-rw-r--r--dbaccess/source/ui/dlg/migrwarndlg.cxx22
-rw-r--r--dbaccess/source/ui/inc/migrwarndlg.hxx29
-rw-r--r--dbaccess/source/ui/misc/datasourceconnector.cxx7
7 files changed, 121 insertions, 6 deletions
diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx
index 9093cd622925..d06413fc59dd 100644
--- a/dbaccess/source/core/dataaccess/datasource.cxx
+++ b/dbaccess/source/core/dataaccess/datasource.cxx
@@ -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 );
diff --git a/dbaccess/source/core/dataaccess/datasource.hxx b/dbaccess/source/core/dataaccess/datasource.hxx
index 14328e19c34f..a330cccd9625 100644
--- a/dbaccess/source/core/dataaccess/datasource.hxx
+++ b/dbaccess/source/core/dataaccess/datasource.hxx
@@ -84,6 +84,7 @@ private:
using ODatabaseSource_Base::rBHelper;
// note: this thing uses the ref-count of "this", see OBookmarkContainer::acquire!
OBookmarkContainer m_Bookmarks;
+ bool m_bMigationNeeded = false;
::comphelper::OInterfaceContainerHelper2 m_aFlushListeners;
private:
@@ -162,6 +163,9 @@ public:
virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection( const OUString& user, const OUString& password ) override;
virtual void SAL_CALL setLoginTimeout( sal_Int32 seconds ) override;
virtual sal_Int32 SAL_CALL getLoginTimeout( ) override;
+ virtual void SAL_CALL setMigrationNeeded( sal_Bool bNeeded ) override { m_bMigationNeeded = bNeeded; }
+ virtual sal_Bool SAL_CALL getMigrationNeeded() override { return m_bMigationNeeded; }
+ virtual OUString SAL_CALL getConnectionUrl() override;
//::css::sdb::XBookmarksSupplier
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getBookmarks( ) override;
diff --git a/dbaccess/source/core/inc/warndlg.hxx b/dbaccess/source/core/inc/warndlg.hxx
new file mode 100644
index 000000000000..54cfe88cb6a4
--- /dev/null
+++ b/dbaccess/source/core/inc/warndlg.hxx
@@ -0,0 +1,29 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_WARNDLG_HXX
+#define INCLUDED_DBACCESS_SOURCE_CORE_INC_WARNDLG_HXX
+
+#include <vcl/weld.hxx>
+
+namespace dbaccess
+{
+class MigrationWarnDialog : public weld::MessageDialogController
+{
+private:
+ std::unique_ptr<weld::Button> m_xOkBtn;
+ std::unique_ptr<weld::Button> m_xLaterBtn;
+
+public:
+ MigrationWarnDialog(weld::Window* pParent);
+};
+}
+
+#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_WARNDLG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/misc/warndlg.cxx b/dbaccess/source/core/misc/warndlg.cxx
new file mode 100644
index 000000000000..e8446b6e7539
--- /dev/null
+++ b/dbaccess/source/core/misc/warndlg.cxx
@@ -0,0 +1,22 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <warndlg.hxx>
+
+namespace dbaccess
+{
+MigrationWarnDialog::MigrationWarnDialog(weld::Window* pParent)
+ : MessageDialogController(pParent, "TODOUIfile", "MigrationWarnDialog", "ask")
+ , m_xOkBtn(m_xBuilder->weld_button("yes"))
+ , m_xLaterBtn(m_xBuilder->weld_button("later"))
+{
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/dlg/migrwarndlg.cxx b/dbaccess/source/ui/dlg/migrwarndlg.cxx
new file mode 100644
index 000000000000..9281dc11a941
--- /dev/null
+++ b/dbaccess/source/ui/dlg/migrwarndlg.cxx
@@ -0,0 +1,22 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <migrwarndlg.hxx>
+
+namespace dbaui
+{
+MigrationWarnDialog::MigrationWarnDialog(weld::Window* pParent)
+ : MessageDialogController(pParent, "dbaccess/ui/migrwarndlg.ui", "MigrationWarnDialog")
+ , m_xOkBtn(m_xBuilder->weld_button("yes"))
+ , m_xLaterBtn(m_xBuilder->weld_button("later"))
+{
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/migrwarndlg.hxx b/dbaccess/source/ui/inc/migrwarndlg.hxx
new file mode 100644
index 000000000000..7f18ad02f446
--- /dev/null
+++ b/dbaccess/source/ui/inc/migrwarndlg.hxx
@@ -0,0 +1,29 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_WARNDLG_HXX
+#define INCLUDED_DBACCESS_SOURCE_CORE_INC_WARNDLG_HXX
+
+#include <vcl/weld.hxx>
+
+namespace dbaui
+{
+class MigrationWarnDialog : public weld::MessageDialogController
+{
+private:
+ std::unique_ptr<weld::Button> m_xOkBtn;
+ std::unique_ptr<weld::Button> m_xLaterBtn;
+
+public:
+ MigrationWarnDialog(weld::Window* pParent);
+};
+}
+
+#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_WARNDLG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/misc/datasourceconnector.cxx b/dbaccess/source/ui/misc/datasourceconnector.cxx
index 0496a4edded4..434f000d907f 100644
--- a/dbaccess/source/ui/misc/datasourceconnector.cxx
+++ b/dbaccess/source/ui/misc/datasourceconnector.cxx
@@ -41,6 +41,7 @@
#include <cppuhelper/exc_hlp.hxx>
#include <strings.hrc>
#include <strings.hxx>
+#include <migrwarndlg.hxx>
namespace dbaui
{
@@ -114,6 +115,12 @@ namespace dbaui
DBG_UNHANDLED_EXCEPTION("dbaccess");
}
+ if(_xDataSource->getConnectionUrl().startsWithIgnoreAsciiCase("sdbc:embedded:hsqldb"))
+ {
+ MigrationWarnDialog aWarnDlg{m_pErrorMessageParent->GetFrameWeld()};
+ _xDataSource->setMigrationNeeded(aWarnDlg.run() == RET_OK);
+ }
+
// try to connect
SQLExceptionInfo aInfo;
try