Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[oracle] Ensure that all attributes required for order by are fetched
Fixes potentially broken iterator sorting with oracle provider when
a subset of attributes is fetched

(cherry-picked from 89a84f0)
  • Loading branch information
nyalldawson committed May 24, 2018
1 parent f5a9e6b commit 15d2b36
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/providers/oracle/qgsoraclefeatureiterator.cpp
Expand Up @@ -57,6 +57,14 @@ QgsOracleFeatureIterator::QgsOracleFeatureIterator( QgsOracleFeatureSource* sour
}
}

// ensure that all attributes required for order by are fetched
const QSet< QString > orderByAttributes = mRequest.orderBy().usedAttributes();
for ( const QString &attr : orderByAttributes )
{
int attrIndex = mSource->mFields.fieldNameIndex( attr );
if ( !mAttributeList.contains( attrIndex ) )
mAttributeList << attrIndex;
}
}
else
mAttributeList = mSource->mFields.allAttributesList();
Expand Down

0 comments on commit 15d2b36

Please sign in to comment.