2010-10-27 13:11:31 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2001-10-26 06:45:13 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 09:40:13 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2001-10-26 06:45:13 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2001-10-26 06:45:13 +00:00
|
|
|
*
|
2008-04-10 09:40:13 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2001-10-26 06:45:13 +00:00
|
|
|
*
|
2008-04-10 09:40:13 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2001-10-26 06:45:13 +00:00
|
|
|
*
|
2008-04-10 09:40:13 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2001-10-26 06:45:13 +00:00
|
|
|
*
|
2008-04-10 09:40:13 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2001-10-26 06:45:13 +00:00
|
|
|
*
|
2008-04-10 09:40:13 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2001-10-26 06:45:13 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
#ifndef CONNECTIVITY_SKIPDELETEDSSET_HXX
|
|
|
|
#define CONNECTIVITY_SKIPDELETEDSSET_HXX
|
|
|
|
|
|
|
|
#include "TResultSetHelper.hxx"
|
2002-07-05 06:03:03 +00:00
|
|
|
#include <rtl/alloc.h>
|
2011-02-05 13:18:52 +01:00
|
|
|
#include <boost/unordered_map.hpp>
|
2001-10-26 06:45:13 +00:00
|
|
|
#include <vector>
|
2008-12-30 13:32:01 +00:00
|
|
|
#include "connectivity/dbtoolsdllapi.hxx"
|
2001-10-26 06:45:13 +00:00
|
|
|
|
|
|
|
namespace connectivity
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
the class OSkipDeletedSet supports a general method to skip deleted rows
|
|
|
|
*/
|
2008-12-30 13:32:01 +00:00
|
|
|
class OOO_DLLPUBLIC_DBTOOLS OSkipDeletedSet
|
2001-10-26 06:45:13 +00:00
|
|
|
{
|
2008-12-09 07:25:38 +00:00
|
|
|
::std::vector<sal_Int32> m_aBookmarksPositions;// vector of iterators to position map, the order is the logical position
|
2001-10-26 06:45:13 +00:00
|
|
|
IResultSetHelper* m_pHelper; // used for moving in the resultset
|
2008-12-09 07:25:38 +00:00
|
|
|
bool m_bDeletedVisible;
|
2001-10-26 06:45:13 +00:00
|
|
|
|
|
|
|
sal_Bool moveAbsolute(sal_Int32 _nOffset,sal_Bool _bRetrieveData);
|
|
|
|
public:
|
|
|
|
OSkipDeletedSet(IResultSetHelper* _pHelper);
|
2004-03-02 11:35:45 +00:00
|
|
|
~OSkipDeletedSet();
|
2001-10-26 06:45:13 +00:00
|
|
|
|
2002-07-05 06:03:03 +00:00
|
|
|
inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW( () )
|
|
|
|
{ return ::rtl_allocateMemory( nSize ); }
|
2006-06-20 00:58:03 +00:00
|
|
|
inline static void * SAL_CALL operator new( size_t,void* _pHint ) SAL_THROW( () )
|
2002-07-05 06:03:03 +00:00
|
|
|
{ return _pHint; }
|
|
|
|
inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW( () )
|
|
|
|
{ ::rtl_freeMemory( pMem ); }
|
2006-06-20 00:58:03 +00:00
|
|
|
inline static void SAL_CALL operator delete( void *,void* ) SAL_THROW( () )
|
2002-07-05 06:03:03 +00:00
|
|
|
{ }
|
|
|
|
|
2001-10-26 06:45:13 +00:00
|
|
|
/**
|
|
|
|
skipDeleted moves the resultset to the position defined by the parameters
|
|
|
|
it garantees that the row isn't deleted
|
|
|
|
@param
|
|
|
|
IResultSetHelper::Movement _eCursorPosition in which direction the resultset should be moved
|
|
|
|
sal_Int32 _nOffset the position relativ to the movement
|
|
|
|
sal_Bool _bRetrieveData is true when the current row should be filled which data
|
|
|
|
@return
|
|
|
|
true when the movement was successful otherwise false
|
|
|
|
*/
|
|
|
|
sal_Bool skipDeleted(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nOffset, sal_Bool _bRetrieveData);
|
|
|
|
/**
|
|
|
|
clear the map and the vector used in this class
|
|
|
|
*/
|
|
|
|
void clear();
|
|
|
|
/**
|
|
|
|
getMappedPosition returns the mapped position of a logical position
|
|
|
|
@param
|
2009-02-17 15:39:54 +00:00
|
|
|
sal_Int32 _nBookmark the logical position
|
2001-10-26 06:45:13 +00:00
|
|
|
|
|
|
|
@return the mapped position
|
|
|
|
*/
|
2009-02-17 15:39:54 +00:00
|
|
|
sal_Int32 getMappedPosition(sal_Int32 _nBookmark) const;
|
2001-10-26 06:45:13 +00:00
|
|
|
/**
|
|
|
|
insertNewPosition adds a new position to the map
|
|
|
|
@param
|
|
|
|
sal_Int32 _nPos the logical position
|
|
|
|
*/
|
|
|
|
void insertNewPosition(sal_Int32 _nPos);
|
|
|
|
/**
|
|
|
|
deletePosition deletes this position from the map and decrement all following positions
|
|
|
|
@param
|
|
|
|
sal_Int32 _nPos the logical position
|
|
|
|
*/
|
|
|
|
void deletePosition(sal_Int32 _nPos);
|
2001-11-29 15:35:26 +00:00
|
|
|
/**
|
|
|
|
getLastPosition returns the last position
|
|
|
|
@return the last position
|
|
|
|
*/
|
2008-12-09 07:25:38 +00:00
|
|
|
inline sal_Int32 getLastPosition() const { return m_aBookmarksPositions.size(); }
|
2010-11-25 08:51:07 +01:00
|
|
|
inline void SetDeletedVisible(bool _bDeletedVisible) { m_bDeletedVisible = _bDeletedVisible; }
|
2001-10-26 06:45:13 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif // CONNECTIVITY_SKIPDELETEDSSET_HXX
|
|
|
|
|
2010-10-27 13:11:31 +01:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|