diff options
Diffstat (limited to 'connectivity/source/drivers/ado')
-rw-r--r-- | connectivity/source/drivers/ado/AConnection.cxx | 5 | ||||
-rw-r--r-- | connectivity/source/drivers/ado/ADriver.cxx | 18 | ||||
-rw-r--r-- | connectivity/source/drivers/ado/AStatement.cxx | 8 |
3 files changed, 13 insertions, 18 deletions
diff --git a/connectivity/source/drivers/ado/AConnection.cxx b/connectivity/source/drivers/ado/AConnection.cxx index 049989f44786..32e0bcd4d2b6 100644 --- a/connectivity/source/drivers/ado/AConnection.cxx +++ b/connectivity/source/drivers/ado/AConnection.cxx @@ -476,9 +476,8 @@ void OConnection::disposing() m_pAdoConnection->Close(); - OTypeInfoMap::iterator aIter = m_aTypeInfo.begin(); - for (; aIter != m_aTypeInfo.end(); ++aIter) - delete aIter->second; + for (auto& rEntry : m_aTypeInfo) + delete rEntry.second; m_aTypeInfo.clear(); diff --git a/connectivity/source/drivers/ado/ADriver.cxx b/connectivity/source/drivers/ado/ADriver.cxx index 934c3a2a47ea..69381285eb7d 100644 --- a/connectivity/source/drivers/ado/ADriver.cxx +++ b/connectivity/source/drivers/ado/ADriver.cxx @@ -66,9 +66,9 @@ void ODriver::disposing() ::osl::MutexGuard aGuard(m_aMutex); - for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i) + for (auto& rxConnection : m_xConnections) { - Reference< XComponent > xComp(i->get(), UNO_QUERY); + Reference< XComponent > xComp(rxConnection.get(), UNO_QUERY); if (xComp.is()) xComp->dispose(); } @@ -204,15 +204,11 @@ Reference< XTablesSupplier > SAL_CALL ODriver::getDataDefinitionByConnection( co { OConnection* pSearchConnection = reinterpret_cast< OConnection* >( xTunnel->getSomething(OConnection::getUnoTunnelImplementationId()) ); - for (OWeakRefArray::const_iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i) - { - if (static_cast<OConnection*>(Reference< XConnection >::query(i->get().get()).get()) == pSearchConnection) - { - pConnection = pSearchConnection; - break; - } - } - + auto foundConnection = std::any_of(m_xConnections.begin(), m_xConnections.end(), + [&pSearchConnection](const css::uno::WeakReferenceHelper& rxConnection) { + return static_cast<OConnection*>(Reference< XConnection >::query(rxConnection.get().get()).get()) == pSearchConnection; }); + if (foundConnection) + pConnection = pSearchConnection; } Reference< XTablesSupplier > xTab; diff --git a/connectivity/source/drivers/ado/AStatement.cxx b/connectivity/source/drivers/ado/AStatement.cxx index f2ed68a78070..01fea934cd19 100644 --- a/connectivity/source/drivers/ado/AStatement.cxx +++ b/connectivity/source/drivers/ado/AStatement.cxx @@ -34,6 +34,7 @@ #undef max #include <algorithm> +#include <numeric> using namespace ::comphelper; @@ -348,10 +349,9 @@ Sequence< sal_Int32 > SAL_CALL OStatement::executeBatch( ) reset(); - OUString aBatchSql; - sal_Int32 nLen = 0; - for(std::vector< OUString>::const_iterator i=m_aBatchVector.begin();i != m_aBatchVector.end();++i,++nLen) - aBatchSql = aBatchSql + *i + ";"; + OUString aBatchSql = std::accumulate(m_aBatchVector.begin(), m_aBatchVector.end(), OUString(), + [](const OUString& rRes, const OUString& rStr) { return rRes + rStr + ";"; }); + sal_Int32 nLen = m_aBatchVector.size(); if ( m_RecordSet.IsValid() ) |