mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-24 17:30:44 +02:00
RowIterator positioning
This commit is contained in:
@@ -424,7 +424,7 @@ private:
|
|||||||
/// Sets the filter for the RecordSet.
|
/// Sets the filter for the RecordSet.
|
||||||
|
|
||||||
|
|
||||||
RowFilter* getFilter();
|
const RowFilter* getFilter() const;
|
||||||
/// Returns the filter associated with the RecordSet.
|
/// Returns the filter associated with the RecordSet.
|
||||||
|
|
||||||
std::size_t _currentRow;
|
std::size_t _currentRow;
|
||||||
@@ -571,11 +571,12 @@ inline std::ostream& RecordSet::copyNames(std::ostream& os) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline RowFilter* RecordSet::getFilter()
|
inline const RowFilter* RecordSet::getFilter() const
|
||||||
{
|
{
|
||||||
return _pFilter;
|
return _pFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* TODO
|
/* TODO
|
||||||
namespace Keywords {
|
namespace Keywords {
|
||||||
|
|
||||||
|
|||||||
@@ -66,8 +66,10 @@ public:
|
|||||||
static const int POSITION_END;
|
static const int POSITION_END;
|
||||||
/// End position indicator.
|
/// End position indicator.
|
||||||
|
|
||||||
RowIterator(RecordSet* pRecordSet, bool positionEnd = false);
|
RowIterator(RecordSet* pRecordSet, bool positionEnd);
|
||||||
/// Creates the RowIterator and positions it at the beginning.
|
/// Creates the RowIterator and positions it at the end of
|
||||||
|
/// the recordset if positionEnd is true. Otherwise, it is
|
||||||
|
/// positioned at the beginning.
|
||||||
|
|
||||||
RowIterator(const RowIterator& other);
|
RowIterator(const RowIterator& other);
|
||||||
/// Creates a copy of other RowIterator.
|
/// Creates a copy of other RowIterator.
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ namespace Data {
|
|||||||
RecordSet::RecordSet(const Statement& rStatement):
|
RecordSet::RecordSet(const Statement& rStatement):
|
||||||
Statement(rStatement),
|
Statement(rStatement),
|
||||||
_currentRow(0),
|
_currentRow(0),
|
||||||
_pBegin(new RowIterator(this)),
|
_pBegin(new RowIterator(this, 0 == extractionCount())),
|
||||||
_pEnd(new RowIterator(this, true)),
|
_pEnd(new RowIterator(this, true)),
|
||||||
_pFilter(0)
|
_pFilter(0)
|
||||||
{
|
{
|
||||||
@@ -66,7 +66,7 @@ RecordSet::RecordSet(Session& rSession,
|
|||||||
RowFormatter* pRowFormatter):
|
RowFormatter* pRowFormatter):
|
||||||
Statement((rSession << query, now)),
|
Statement((rSession << query, now)),
|
||||||
_currentRow(0),
|
_currentRow(0),
|
||||||
_pBegin(new RowIterator(this)),
|
_pBegin(new RowIterator(this, 0 == extractionCount())),
|
||||||
_pEnd(new RowIterator(this, true)),
|
_pEnd(new RowIterator(this, true)),
|
||||||
_pFilter(0)
|
_pFilter(0)
|
||||||
{
|
{
|
||||||
@@ -77,7 +77,7 @@ RecordSet::RecordSet(Session& rSession,
|
|||||||
RecordSet::RecordSet(const RecordSet& other):
|
RecordSet::RecordSet(const RecordSet& other):
|
||||||
Statement(other.impl().duplicate()),
|
Statement(other.impl().duplicate()),
|
||||||
_currentRow(other._currentRow),
|
_currentRow(other._currentRow),
|
||||||
_pBegin(new RowIterator(this)),
|
_pBegin(new RowIterator(this, 0 == extractionCount())),
|
||||||
_pEnd(new RowIterator(this, true)),
|
_pEnd(new RowIterator(this, true)),
|
||||||
_pFilter(other._pFilter)
|
_pFilter(other._pFilter)
|
||||||
{
|
{
|
||||||
@@ -163,7 +163,7 @@ Row& RecordSet::row(std::size_t pos)
|
|||||||
if (pos > rowCount() - 1)
|
if (pos > rowCount() - 1)
|
||||||
throw RangeException("Invalid recordset row requested.");
|
throw RangeException("Invalid recordset row requested.");
|
||||||
|
|
||||||
RowMap::iterator it = _rowMap.find(pos);
|
RowMap::const_iterator it = _rowMap.find(pos);
|
||||||
Row* pRow = 0;
|
Row* pRow = 0;
|
||||||
std::size_t columns = columnCount();
|
std::size_t columns = columnCount();
|
||||||
if (it == _rowMap.end())
|
if (it == _rowMap.end())
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ const int RowIterator::POSITION_END = std::numeric_limits<std::size_t>::max();
|
|||||||
|
|
||||||
RowIterator::RowIterator(RecordSet* pRecordSet, bool positionEnd):
|
RowIterator::RowIterator(RecordSet* pRecordSet, bool positionEnd):
|
||||||
_pRecordSet(pRecordSet),
|
_pRecordSet(pRecordSet),
|
||||||
_position((0 == pRecordSet->totalRowCount()) || positionEnd ? POSITION_END : 0)
|
_position(positionEnd ? POSITION_END : 0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user