Skip to content

Commit

Permalink
feature iterator: include attributes required by virtual fields first…
Browse files Browse the repository at this point in the history
… so that

they trigger joins if necessary (fixes #11545)
  • Loading branch information
jef-n committed Jun 29, 2015
1 parent 77b405f commit cafbef1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/core/qgsvectorlayerfeatureiterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,12 @@ QgsVectorLayerFeatureIterator::QgsVectorLayerFeatureIterator( QgsVectorLayerFeat
, mFetchedFid( false )
, mEditGeometrySimplifier( 0 )
{
prepareExpressions();

// prepare joins: may add more attributes to fetch (in order to allow join)
if ( mSource->mJoinBuffer->containsJoins() )
prepareJoins();

prepareExpressions();

mHasVirtualAttributes = !mFetchJoinInfo.isEmpty() || !mExpressionFieldInfo.isEmpty();

// by default provider's request is the same
Expand Down Expand Up @@ -507,7 +506,7 @@ void QgsVectorLayerFeatureIterator::prepareExpressions()
if ( mRequest.flags() & QgsFeatureRequest::SubsetOfAttributes )
{
QgsAttributeList attrs;
Q_FOREACH ( const QString& col, exp->referencedColumns() )
Q_FOREACH( const QString& col, exp->referencedColumns() )
{
attrs.append( mSource->mFields.fieldNameIndex( col ) );
}
Expand Down

0 comments on commit cafbef1

Please sign in to comment.