Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge pull request #42412 from elpaso/optimization-ogr-avoid-double-l…
…oad-fields-call
Prevent double expensive calls to loadFields in OGR
- Loading branch information
Showing
with
7 additions
and
5 deletions.
-
+7
−5
src/core/providers/ogr/qgsogrprovider.cpp
|
@@ -2306,6 +2306,8 @@ bool QgsOgrProvider::_setSubsetString( const QString &theSQL, bool updateFeature |
|
|
if ( theSQL == mSubsetString && mFeaturesCounted != QgsVectorDataProvider::Uncounted ) |
|
|
return true; |
|
|
|
|
|
const bool subsetStringHasChanged { theSQL != mSubsetString }; |
|
|
|
|
|
if ( !theSQL.isEmpty() ) |
|
|
{ |
|
|
QMutex *mutex = nullptr; |
|
@@ -2387,10 +2389,11 @@ bool QgsOgrProvider::_setSubsetString( const QString &theSQL, bool updateFeature |
|
|
|
|
|
mRefreshFeatureCount = updateFeatureCount; |
|
|
|
|
|
// check the validity of the layer |
|
|
QgsDebugMsgLevel( QStringLiteral( "checking validity" ), 4 ); |
|
|
loadFields(); |
|
|
QgsDebugMsgLevel( QStringLiteral( "Done checking validity" ), 4 ); |
|
|
// check the validity of the layer if subset string has changed |
|
|
if ( subsetStringHasChanged ) |
|
|
{ |
|
|
loadFields(); |
|
|
} |
|
|
|
|
|
invalidateCachedExtent( false ); |
|
|
|
|
@@ -7340,4 +7343,3 @@ QgsProviderMetadata::ProviderCapabilities QgsOgrProviderMetadata::providerCapabi |
|
|
return FileBasedUris; |
|
|
} |
|
|
///@endcond |
|
|
|