Skip to content
Permalink
Browse files

[OGR provider] Faster update of feature count in addFeatures() and de…

…leteFeatures()

Based on suggestion by @nyalldawson
  • Loading branch information
rouault authored and nyalldawson committed Oct 17, 2020
1 parent d8c6a25 commit 04dbfeb392fe07e12553d7fbcc2910952f658a68
Showing with 16 additions and 2 deletions.
  1. +16 −2 src/core/providers/ogr/qgsogrprovider.cpp
@@ -1874,7 +1874,14 @@ bool QgsOgrProvider::addFeatures( QgsFeatureList &flist, Flags flags )
returnvalue = false;
}

recalculateFeatureCount();
if ( mFeaturesCounted != QgsVectorDataProvider::Uncounted &&
mFeaturesCounted != QgsVectorDataProvider::UnknownCount )
{
if ( returnvalue )
mFeaturesCounted += flist.size();
else
recalculateFeatureCount();
}

if ( returnvalue )
clearMinMaxCache();
@@ -2702,7 +2709,14 @@ bool QgsOgrProvider::deleteFeatures( const QgsFeatureIds &id )
returnvalue = false;
}

recalculateFeatureCount();
if ( mFeaturesCounted != QgsVectorDataProvider::Uncounted &&
mFeaturesCounted != QgsVectorDataProvider::UnknownCount )
{
if ( returnvalue )
mFeaturesCounted -= id.size();
else
recalculateFeatureCount();
}

clearMinMaxCache();

0 comments on commit 04dbfeb

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