summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-09-11 20:52:59 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2021-09-12 08:53:00 +0200
commit4a7984960bf7d0af8342b360510c7e4e3d7399cf (patch)
treeba4629236700253a0a58001f0f2e7dfa7ed2f983
parentef030cd1b1eb6dd41ade808f360305cb53d48106 (diff)
Simplify OFileDriver::getDataDefinitionByConnection
Change-Id: Ia808f5e7867d474e36e60d163d1a556a59e2f89d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121974 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r--connectivity/source/drivers/file/FDriver.cxx17
1 files changed, 4 insertions, 13 deletions
diff --git a/connectivity/source/drivers/file/FDriver.cxx b/connectivity/source/drivers/file/FDriver.cxx
index c5afbd75f7e3..9bd0692bac26 100644
--- a/connectivity/source/drivers/file/FDriver.cxx
+++ b/connectivity/source/drivers/file/FDriver.cxx
@@ -20,6 +20,7 @@
#include <file/FDriver.hxx>
#include <file/FConnection.hxx>
#include <file/fcode.hxx>
+#include <comphelper/servicehelper.hxx>
#include <comphelper/types.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <connectivity/dbexception.hxx>
@@ -171,25 +172,15 @@ Reference< XTablesSupplier > SAL_CALL OFileDriver::getDataDefinitionByConnection
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(ODriver_BASE::rBHelper.bDisposed);
- Reference< XTablesSupplier > xTab;
- Reference< css::lang::XUnoTunnel> xTunnel(connection,UNO_QUERY);
- if(xTunnel.is())
+ if (OConnection* pSearchConnection = comphelper::getUnoTunnelImplementation<OConnection>(connection))
{
- OConnection* pSearchConnection = reinterpret_cast< OConnection* >( xTunnel->getSomething(OConnection::getUnoTunnelId()) );
- OConnection* pConnection = nullptr;
for (auto const& elem : m_xConnections)
{
if (static_cast<OConnection*>( Reference< XConnection >::query(elem.get()).get() ) == pSearchConnection)
- {
- pConnection = pSearchConnection;
- break;
- }
+ return pSearchConnection->createCatalog();
}
-
- if(pConnection)
- xTab = pConnection->createCatalog();
}
- return xTab;
+ return {};
}