connectivity/source/drivers/firebird/Catalog.hxx | 1 + connectivity/source/drivers/firebird/Tables.cxx | 8 ++++++++ 2 files changed, 9 insertions(+)
New commits: commit eff9dc65b88ca48171e9e6ab51f1e2ec8d0f436d Author: Julien Nabet <[email protected]> AuthorDate: Sat Mar 12 13:59:48 2022 +0100 Commit: Julien Nabet <[email protected]> CommitDate: Sat Mar 12 17:52:27 2022 +0100 tdf#147309: Recreating a view with same name and in the same session fails (FB) Since HSQLDB already worked, just do the same. Change-Id: I44929cf36179cc3cdff6e61f05899c9a913c78b3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131442 Tested-by: Jenkins Reviewed-by: Julien Nabet <[email protected]> diff --git a/connectivity/source/drivers/firebird/Catalog.hxx b/connectivity/source/drivers/firebird/Catalog.hxx index b6bf02f6b69d..3ffb9238eda7 100644 --- a/connectivity/source/drivers/firebird/Catalog.hxx +++ b/connectivity/source/drivers/firebird/Catalog.hxx @@ -32,6 +32,7 @@ namespace connectivity::firebird virtual void refreshUsers() override; sdbcx::OCollection* getPrivateTables() const { return m_pTables.get(); } + sdbcx::OCollection* getPrivateViews() const { return m_pViews.get(); } }; } // namespace connectivity::firebird diff --git a/connectivity/source/drivers/firebird/Tables.cxx b/connectivity/source/drivers/firebird/Tables.cxx index 9c59f65f436c..6914a2faf847 100644 --- a/connectivity/source/drivers/firebird/Tables.cxx +++ b/connectivity/source/drivers/firebird/Tables.cxx @@ -9,6 +9,7 @@ #include "Table.hxx" #include "Tables.hxx" +#include "Views.hxx" #include "Catalog.hxx" #include <TConnection.hxx> @@ -202,6 +203,13 @@ void Tables::dropObject(sal_Int32 nPosition, const OUString& sName) m_xMetaData->getConnection()->createStatement()->execute( "DROP " + sType + " " + ::dbtools::quoteName(sQuoteString,sName)); + + if (sType == "VIEW") + { + Views* pViews = static_cast<Views*>(static_cast<Catalog&>(m_rParent).getPrivateViews()); + if ( pViews && pViews->hasByName(sName) ) + pViews->dropByNameImpl(sName); + } } void connectivity::firebird::Tables::appendNew(const OUString& _rsNewTable)
