Skip to content

Commit 9d6fe10

Browse files
author
jef
committedMar 15, 2010

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed
 

‎src/providers/postgres/qgspostgresprovider.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,7 @@ void QgsPostgresProvider::select( QgsAttributeList fetchAttributes, QgsRectangle
690690
return;
691691

692692
mFetching = true;
693+
mFetched = 0;
693694
}
694695

695696
bool QgsPostgresProvider::nextFeature( QgsFeature& feature )
@@ -731,6 +732,11 @@ bool QgsPostgresProvider::nextFeature( QgsFeature& feature )
731732
QgsDebugMsg( "End of features" );
732733
connectionRO->closeCursor( cursorName );
733734
mFetching = false;
735+
if ( featuresCounted != mFetched )
736+
{
737+
QgsDebugMsg( QString( "feature count adjusted from %1 to %2" ).arg( featuresCounted ).arg( mFetched ) );
738+
featuresCounted = mFetched;
739+
}
734740
return false;
735741
}
736742

@@ -748,6 +754,7 @@ bool QgsPostgresProvider::nextFeature( QgsFeature& feature )
748754
feature.setAttributeMap( mFeatureQueue.front().attributeMap() );
749755

750756
mFeatureQueue.pop();
757+
mFetched++;
751758

752759
feature.setValid( true );
753760
return true;

‎src/providers/postgres/qgspostgresprovider.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,8 @@ class QgsPostgresProvider : public QgsVectorDataProvider
364364
*/
365365
bool parseDomainCheckConstraint( QStringList& enumValues, const QString& attributeName ) const;
366366

367-
bool mFetching; // true if a cursor was declared
367+
bool mFetching; // true if a cursor was declared
368+
int mFetched; // number of retrieved features
368369
std::vector < QgsFeature > features;
369370
QgsFieldMap attributeFields;
370371
QString mDataComment;

0 commit comments

Comments
 (0)
Please sign in to comment.