diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2013-10-02 19:00:17 +0200 |
---|---|---|
committer | Lionel Elie Mamane <lionel@mamane.lu> | 2013-10-02 19:02:33 +0200 |
commit | a102d822c9b81cf8d3b29da40c749dbf464768bc (patch) | |
tree | 6107065a2ccc76b81f82a83a6ff4eea131d8bd11 /dbaccess | |
parent | 2b06c5b34be5d3199f48bd149ad542b6bc53473c (diff) |
janitorial: more const, comments
Change-Id: I5366840ab67fdf89575e890a0d97602b8e78f71a
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/core/api/KeySet.cxx | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx index 7583f7941cb9..8571e0493a75 100644 --- a/dbaccess/source/core/api/KeySet.cxx +++ b/dbaccess/source/core/api/KeySet.cxx @@ -487,8 +487,7 @@ Sequence< sal_Int32 > SAL_CALL OKeySet::deleteRows( const Sequence< Any >& rows static OUString aOr(" OR "); static OUString aEqual(" = ?"); - // use keys and indexes for exact postioning - // first the keys + // use keys for exact positioning Reference<XNameAccess> xKeyColumns = getKeyColumns(); OUStringBuffer aCondition("( "); @@ -500,11 +499,14 @@ Sequence< sal_Int32 > SAL_CALL OKeySet::deleteRows( const Sequence< Any >& rows aCondition.append(::dbtools::quoteName( aQuote,aIter->second.sRealName) + aEqual + aAnd); } aCondition.setLength(aCondition.getLength() - aAnd.getLength()); + // sCon is (parenthesised) the condition to locate ONE row + // e.g. ( colName1 = ? AND colName2 = ? AND colName3 = ? ) const OUString sCon( aCondition.makeStringAndClear() ); - const Any* pBegin = rows.getConstArray(); - const Any* pEnd = pBegin + rows.getLength(); - + // since we need to delete all rows in "rows", + // we need to OR as many row locators. + const Any* pBegin = rows.getConstArray(); + const Any* const pEnd = pBegin + rows.getLength(); for(;pBegin != pEnd;++pBegin) { aSql.append(sCon + aOr); @@ -516,11 +518,17 @@ Sequence< sal_Int32 > SAL_CALL OKeySet::deleteRows( const Sequence< Any >& rows Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql.makeStringAndClear())); Reference< XParameters > xParameter(xPrep,UNO_QUERY); + // now, fill in the parameters in the row locators pBegin = rows.getConstArray(); sal_Int32 i=1; for(;pBegin != pEnd;++pBegin) { m_aKeyIter = m_aKeyMap.find(::comphelper::getINT32(*pBegin)); + // LEM FIXME: what happens if m_aKeyIter == m_aKeyMap.end() ? + // the whole operation fails because there are unfilled parameters + // the remaining rows *are* deleted? + // check what happens vs what is supposed to happen + // (cf documentation of ::com::sun::star::sdbcx::XDeleteRows) if(m_aKeyIter != m_aKeyMap.end()) { connectivity::ORowVector< ORowSetValue >::Vector::iterator aKeyIter = m_aKeyIter->second.first->get().begin(); @@ -539,7 +547,6 @@ Sequence< sal_Int32 > SAL_CALL OKeySet::deleteRows( const Sequence< Any >& rows if(bOk) { pBegin = rows.getConstArray(); - pEnd = pBegin + rows.getLength(); for(;pBegin != pEnd;++pBegin) { |