another fix for #1203: need to reset _rowMap as well. Also, don't hide reset() from base class

This commit is contained in:
Guenter Obiltschnig
2016-03-17 10:07:40 +01:00
parent 65a92d4c5c
commit 6f44a02a65
2 changed files with 50 additions and 42 deletions

View File

@@ -315,6 +315,9 @@ public:
/// Returns true if there is at least one row in the RecordSet, /// Returns true if there is at least one row in the RecordSet,
/// false otherwise. /// false otherwise.
using Statement::reset;
/// Don't hide base class method.
void reset(const Statement& stmt); void reset(const Statement& stmt);
/// Resets the RecordSet and assigns a new statement. /// Resets the RecordSet and assigns a new statement.
/// Should be called after the given statement has been reset, /// Should be called after the given statement has been reset,
@@ -471,7 +474,6 @@ private:
void filter(RowFilter* pFilter); void filter(RowFilter* pFilter);
/// Sets the filter for the RecordSet. /// Sets the filter for the RecordSet.
const RowFilter* getFilter() const; const RowFilter* getFilter() const;
/// Returns the filter associated with the RecordSet. /// Returns the filter associated with the RecordSet.
@@ -491,6 +493,7 @@ private:
/// inlines /// inlines
/// ///
inline Data_API std::ostream& operator << (std::ostream &os, const RecordSet& rs) inline Data_API std::ostream& operator << (std::ostream &os, const RecordSet& rs)
{ {
return rs.copy(os); return rs.copy(os);

View File

@@ -70,7 +70,7 @@ RecordSet::RecordSet(const RecordSet& other):
_pFilter(other._pFilter), _pFilter(other._pFilter),
_totalRowCount(other._totalRowCount) _totalRowCount(other._totalRowCount)
{ {
if(_pFilter) _pFilter->duplicate(); if (_pFilter) _pFilter->duplicate();
} }
@@ -102,6 +102,11 @@ void RecordSet::reset(const Statement& stmt)
_currentRow = 0; _currentRow = 0;
_totalRowCount = UNKNOWN_TOTAL_ROW_COUNT; _totalRowCount = UNKNOWN_TOTAL_ROW_COUNT;
RowMap::iterator it = _rowMap.begin();
RowMap::iterator end = _rowMap.end();
for (; it != end; ++it) delete it->second;
_rowMap.clear();
Statement::operator = (stmt); Statement::operator = (stmt);
_pBegin = new RowIterator(this, 0 == rowsExtracted()); _pBegin = new RowIterator(this, 0 == rowsExtracted());
@@ -378,7 +383,7 @@ void RecordSet::filter(RowFilter* pFilter)
{ {
if (_pFilter) _pFilter->release(); if (_pFilter) _pFilter->release();
_pFilter = pFilter; _pFilter = pFilter;
if(_pFilter) _pFilter->duplicate(); if (_pFilter) _pFilter->duplicate();
} }