Skip to content
Permalink
Browse files

[postgres] do not update feature count if it was not set before

  • Loading branch information
3nids authored and m-kuhn committed Sep 3, 2013
1 parent 510f5cb commit 70841a84f3eade9363277692f2117fef42e27d40
@@ -132,7 +132,11 @@ bool QgsPostgresFeatureIterator::nextFeature( QgsFeature& feature )
QgsDebugMsg( QString( "Finished after %1 features" ).arg( mFetched ) );
close();

if ( P->mFeaturesCounted < mFetched )
/* only updates the feature count if it was already once.
* Otherwise, this would lead to false feature count if
* an existing project is open at a restrictive extent.
*/
if ( P->mFeaturesCounted > 0 && P->mFeaturesCounted < mFetched )
{
QgsDebugMsg( QString( "feature count adjusted from %1 to %2" ).arg( P->mFeaturesCounted ).arg( mFetched ) );
P->mFeaturesCounted = mFetched;
@@ -1779,7 +1779,8 @@ bool QgsPostgresProvider::addFeatures( QgsFeatureList &flist )
mConnectionRW->PQexecNR( "DEALLOCATE addfeatures" );
mConnectionRW->PQexecNR( "COMMIT" );

mFeaturesCounted += flist.size();
if ( mFeaturesCounted >= 0 )
mFeaturesCounted += flist.size();
}
catch ( PGException &e )
{
@@ -1835,8 +1836,8 @@ bool QgsPostgresProvider::deleteFeatures( const QgsFeatureIds & id )
dropOrphanedTopoGeoms();
}


mFeaturesCounted -= id.size();
if ( mFeaturesCounted >= 0 )
mFeaturesCounted -= id.size();
}
catch ( PGException &e )
{

0 comments on commit 70841a8

Please sign in to comment.
You can’t perform that action at this time.