Skip to content
Permalink
Browse files
When an OGR uri has a specific layer id or name included, don't waste
time querying sublayers for sublayers we aren't interested in
  • Loading branch information
nyalldawson committed Aug 18, 2021
1 parent 3b0cb95 commit e88dfd028f31066ad202f8eee5f9f726d94e40b2
Showing with 12 additions and 1 deletion.
  1. +12 −1 src/core/providers/ogr/qgsogrprovidermetadata.cpp
@@ -1210,6 +1210,9 @@ QList<QgsProviderSublayerDetails> QgsOgrProviderMetadata::querySublayers( const
if ( feedback && feedback->isCanceled() )
break;

if ( originalUriLayerIdWasSpecified && i != uriLayerId )
continue;

QString errCause;
QgsOgrLayerUniquePtr layer;

@@ -1227,7 +1230,15 @@ QList<QgsProviderSublayerDetails> QgsOgrProviderMetadata::querySublayers( const
continue;
}

res << QgsOgrProviderUtils::querySubLayerList( i, i == 0 ? firstLayer.get() : layer.get(), driverName, flags, false, uri, false, feedback );
QgsOgrLayer *sublayer = i == 0 ? firstLayer.get() : layer.get();
if ( !sublayer )
continue;

const QString layerName = QString::fromUtf8( sublayer->name() );
if ( !originalUriLayerName.isEmpty() && layerName != originalUriLayerName )
continue;

res << QgsOgrProviderUtils::querySubLayerList( i, sublayer, driverName, flags, false, uri, false, feedback );
}
}

0 comments on commit e88dfd0

Please sign in to comment.