summaryrefslogtreecommitdiff
path: root/connectivity/source/drivers/file/FDriver.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'connectivity/source/drivers/file/FDriver.cxx')
-rw-r--r--connectivity/source/drivers/file/FDriver.cxx78
1 files changed, 34 insertions, 44 deletions
diff --git a/connectivity/source/drivers/file/FDriver.cxx b/connectivity/source/drivers/file/FDriver.cxx
index 16cf60e02cb4..b24c4e67a532 100644
--- a/connectivity/source/drivers/file/FDriver.cxx
+++ b/connectivity/source/drivers/file/FDriver.cxx
@@ -20,11 +20,13 @@
#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>
#include <strings.hrc>
#include <resource/sharedresources.hxx>
+#include <utility>
using namespace connectivity::file;
@@ -35,9 +37,9 @@ using namespace com::sun::star::sdbc;
using namespace com::sun::star::sdbcx;
using namespace com::sun::star::container;
-OFileDriver::OFileDriver(const css::uno::Reference< css::uno::XComponentContext >& _rxContext)
+OFileDriver::OFileDriver(css::uno::Reference< css::uno::XComponentContext > _xContext)
: ODriver_BASE(m_aMutex)
- ,m_xContext(_rxContext)
+ ,m_xContext(std::move(_xContext))
{
}
@@ -81,12 +83,11 @@ Reference< XConnection > SAL_CALL OFileDriver::connect( const OUString& url, con
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(ODriver_BASE::rBHelper.bDisposed);
- OConnection* pCon = new OConnection(this);
- Reference< XConnection > xCon = pCon;
+ rtl::Reference<OConnection> pCon = new OConnection(this);
pCon->construct(url,info);
m_xConnections.push_back(WeakReferenceHelper(*pCon));
- return xCon;
+ return pCon;
}
sal_Bool SAL_CALL OFileDriver::acceptsURL( const OUString& url )
@@ -98,55 +99,54 @@ Sequence< DriverPropertyInfo > SAL_CALL OFileDriver::getPropertyInfo( const OUSt
{
if ( acceptsURL(url) )
{
- std::vector< DriverPropertyInfo > aDriverInfo;
- Sequence< OUString > aBoolean(2);
- aBoolean[0] = "0";
- aBoolean[1] = "1";
+ Sequence< OUString > aBoolean { "0", "1" };
- aDriverInfo.push_back(DriverPropertyInfo(
+ return
+ {
+ {
"CharSet"
,"CharSet of the database."
,false
- ,OUString()
- ,Sequence< OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
+ ,{}
+ ,{}
+ },
+ {
"Extension"
,"Extension of the file format."
,false
,".*"
- ,Sequence< OUString >())
- );
- aDriverInfo.push_back(DriverPropertyInfo(
+ ,{}
+ },
+ {
"ShowDeleted"
,"Display inactive records."
,false
,"0"
- ,aBoolean)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
+ ,aBoolean
+ },
+ {
"EnableSQL92Check"
,"Use SQL92 naming constraints."
,false
,"0"
- ,aBoolean)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
+ ,aBoolean
+ },
+ {
"UseRelativePath"
,"Handle the connection url as relative path."
,false
,"0"
- ,aBoolean)
- );
- aDriverInfo.push_back(DriverPropertyInfo(
+ ,aBoolean
+ },
+ {
"URL"
,"The URL of the database document which is used to create an absolute path."
,false
- ,OUString()
- ,Sequence< OUString >())
- );
- return Sequence< DriverPropertyInfo >(aDriverInfo.data(),aDriverInfo.size());
+ ,{}
+ ,{}
+ }
+ };
} // if ( acceptsURL(url) )
{
::connectivity::SharedResources aResources;
@@ -173,25 +173,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::getFromUnoTunnel<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()).get() ) == pSearchConnection)
- {
- pConnection = pSearchConnection;
- break;
- }
+ if (static_cast<OConnection*>( Reference< XConnection >::query(elem.get()).get() ) == pSearchConnection)
+ return pSearchConnection->createCatalog();
}
-
- if(pConnection)
- xTab = pConnection->createCatalog();
}
- return xTab;
+ return {};
}