diff options
Diffstat (limited to 'connectivity/source/drivers/dbase/DTables.cxx')
-rw-r--r-- | connectivity/source/drivers/dbase/DTables.cxx | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/connectivity/source/drivers/dbase/DTables.cxx b/connectivity/source/drivers/dbase/DTables.cxx index d72061b4538f..0054f3fcecc1 100644 --- a/connectivity/source/drivers/dbase/DTables.cxx +++ b/connectivity/source/drivers/dbase/DTables.cxx @@ -31,6 +31,7 @@ #include <file/FConnection.hxx> #include <com/sun/star/lang/XUnoTunnel.hpp> #include <dbase/DCatalog.hxx> +#include <comphelper/servicehelper.hxx> #include <cppuhelper/exc_hlp.hxx> #include <strings.hrc> #include <connectivity/dbexception.hxx> @@ -69,27 +70,23 @@ Reference< XPropertySet > ODbaseTables::createDescriptor() // XAppend sdbcx::ObjectType ODbaseTables::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor ) { - Reference<XUnoTunnel> xTunnel(descriptor,UNO_QUERY); - if(xTunnel.is()) + auto pTable = comphelper::getUnoTunnelImplementation<ODbaseTable>(descriptor); + if(pTable) { - ODbaseTable* pTable = reinterpret_cast< ODbaseTable* >( xTunnel->getSomething(ODbaseTable::getUnoTunnelId()) ); - if(pTable) + pTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(_rForName)); + try + { + if(!pTable->CreateImpl()) + throw SQLException(); + } + catch(SQLException&) + { + throw; + } + catch(Exception& ex) { - pTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(_rForName)); - try - { - if(!pTable->CreateImpl()) - throw SQLException(); - } - catch(SQLException&) - { - throw; - } - catch(Exception& ex) - { - css::uno::Any anyEx = cppu::getCaughtException(); - throw SQLException( ex.Message, nullptr, "", 0, anyEx ); - } + css::uno::Any anyEx = cppu::getCaughtException(); + throw SQLException( ex.Message, nullptr, "", 0, anyEx ); } } return createObject( _rForName ); |