Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #33266 from signedav/cachedshared
Browse files Browse the repository at this point in the history
Being solid against field names variation in expressions on WFS
  • Loading branch information
m-kuhn committed Dec 11, 2019
2 parents e61ca04 + ea91966 commit f597f72
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/providers/wfs/qgsbackgroundcachedfeatureiterator.cpp
Expand Up @@ -353,7 +353,7 @@ QgsFeatureRequest QgsBackgroundCachedFeatureIterator::buildRequestCache( int gen
// are stored as milliseconds since UTC epoch in the Spatialite DB.
bool hasDateTimeFieldInExpr = false;
const auto setColumns = mRequest.filterExpression()->referencedColumns();
for ( const auto columnName : setColumns )
for ( const auto &columnName : setColumns )
{
int idx = fields.indexOf( columnName );
if ( idx >= 0 && fields[idx].type() == QVariant::DateTime )
Expand Down Expand Up @@ -410,12 +410,16 @@ QgsFeatureRequest QgsBackgroundCachedFeatureIterator::buildRequestCache( int gen
const auto referencedColumns = mRequest.filterExpression()->referencedColumns();
for ( const QString &field : referencedColumns )
{
int idx = dataProviderFields.indexFromName( mShared->getSpatialiteFieldNameFromUserVisibleName( field ) );
if ( idx >= 0 && !cacheSubSet.contains( idx ) )
cacheSubSet.append( idx );
idx = fields.indexFromName( field );
if ( idx >= 0 && !mSubSetAttributes.contains( idx ) )
mSubSetAttributes.append( idx );
int wfsFieldIdx = fields.lookupField( field );
if ( wfsFieldIdx != -1 )
{
int cacheFieldIdx = dataProviderFields.indexFromName( mShared->getSpatialiteFieldNameFromUserVisibleName( fields.at( wfsFieldIdx ).name() ) );
if ( cacheFieldIdx >= 0 && !cacheSubSet.contains( cacheFieldIdx ) )
cacheSubSet.append( cacheFieldIdx );

if ( wfsFieldIdx >= 0 && !mSubSetAttributes.contains( wfsFieldIdx ) )
mSubSetAttributes.append( wfsFieldIdx );
}
}
}

Expand Down

0 comments on commit f597f72

Please sign in to comment.