/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
switch (_eCursorPosition)
{ case IResultSetHelper::ABSOLUTE1: return moveAbsolute(_nOffset,_bRetrieveData); case IResultSetHelper::FIRST: // set the movement when positioning failed
eDelPosition = IResultSetHelper::NEXT;
nDelOffset = 1; break; case IResultSetHelper::LAST:
eDelPosition = IResultSetHelper::PRIOR; // last row is invalid so position before
nDelOffset = 1; break; case IResultSetHelper::RELATIVE1:
eDelPosition = (_nOffset >= 0) ? IResultSetHelper::NEXT : IResultSetHelper::PRIOR; break; default: break;
}
bool bDone = true; bool bDataFound = false;
if (_eCursorPosition == IResultSetHelper::LAST)
{
SAL_INFO( "connectivity.commontools", "OSkipDeletedSet::skipDeleted: last" );
sal_Int32 nBookmark = 0; // first position on the last known row if ( m_aBookmarksPositions.empty() )
{
bDataFound = m_pHelper->move(IResultSetHelper::FIRST, 0, _bRetrieveData); if(bDataFound && (m_bDeletedVisible || !m_pHelper->isRowDeleted())) //m_aBookmarksPositions.push_back(m_aBookmarks.emplace( m_pHelper->getDriverPos(),m_aBookmarksPositions.size()+1)).first);
m_aBookmarksPositions.push_back(m_pHelper->getDriverPos());
} else
{ // I already have a bookmark so we can positioned on that and look if it is the last one
nBookmark = (*m_aBookmarksPositions.rbegin())/*->first*/;
bDataFound = m_pHelper->move(IResultSetHelper::BOOKMARK, nBookmark, _bRetrieveData);
OSL_ENSURE((m_bDeletedVisible || !m_pHelper->isRowDeleted()),"A bookmark should not be deleted!");
}
// and then move forward until we are after the last row while(bDataFound)
{
bDataFound = m_pHelper->move(IResultSetHelper::NEXT, 1, false); // we don't need the data here if( bDataFound && ( m_bDeletedVisible || !m_pHelper->isRowDeleted()) )
{ // we weren't on the last row we remember it and move on
m_aBookmarksPositions.push_back(m_pHelper->getDriverPos()); //m_aBookmarksPositions.push_back(m_aBookmarks.emplace( m_pHelper->getDriverPos(),m_aBookmarksPositions.size()+1)).first);
} elseif(!bDataFound && !m_aBookmarksPositions.empty() )
{ // i already know the last bookmark :-) // now we only have to repositioning us to the last row
nBookmark = (*m_aBookmarksPositions.rbegin())/*->first*/;
bDataFound = m_pHelper->move(IResultSetHelper::BOOKMARK, nBookmark, _bRetrieveData); break;
}
} return bDataFound;
} elseif (_eCursorPosition != IResultSetHelper::RELATIVE1)
{
bDataFound = m_pHelper->move(_eCursorPosition, _nOffset, _bRetrieveData);
bDone = bDataFound && (m_bDeletedVisible || !m_pHelper->isRowDeleted());
} else
{
bDataFound = m_pHelper->move(eDelPosition, 1, _bRetrieveData); if (bDataFound && (m_bDeletedVisible || !m_pHelper->isRowDeleted()))
{
bDone = (--nDelOffset) == 0; if ( !bDone )
m_aBookmarksPositions.push_back(m_pHelper->getDriverPos()); //m_aBookmarksPositions.push_back(m_aBookmarks.emplace( m_pHelper->getDriverPos(),m_aBookmarksPositions.size()+1)).first);
} else
bDone = false;
}
while (bDataFound && !bDone) // Iterate until we are at the valid set
{
bDataFound = m_pHelper->move(eDelPosition, 1, _bRetrieveData); if (_eCursorPosition != IResultSetHelper::RELATIVE1)
bDone = bDataFound && (m_bDeletedVisible || !m_pHelper->isRowDeleted()); elseif (bDataFound && (m_bDeletedVisible || !m_pHelper->isRowDeleted()))
{
bDone = (--nDelOffset) == 0; if ( !bDone )
m_aBookmarksPositions.push_back(m_pHelper->getDriverPos()); //m_aBookmarksPositions.push_back(m_aBookmarks.emplace( m_pHelper->getDriverPos(),m_aBookmarksPositions.size()+1)).first);
} else
bDone = false;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.