connectivity/source/drivers/firebird/Catalog.hxx |    1 +
 connectivity/source/drivers/firebird/Tables.cxx  |   10 +++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 7dade11c99b412081eff0d5db49ede619e866737
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Sat Mar 12 13:59:48 2022 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Mar 14 13:57:06 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 <serval2...@yahoo.fr>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131447
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

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 06e6806d0a4f..29662ef12643 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 "Util.hxx"
 
@@ -202,7 +203,14 @@ void Tables::dropObject(sal_Int32 nPosition, const 
OUString& sName)
     const OUString sQuoteString = m_xMetaData->getIdentifierQuoteString();
 
     m_xMetaData->getConnection()->createStatement()->execute(
-        "DROP " + sType + ::dbtools::quoteName(sQuoteString,sName));
+        "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)

Reply via email to