Add compiler setting check to order by compilation

This commit is contained in:
Matthias Kuhn 2015-12-17 10:31:47 +01:00
parent a17714247e
commit e555323f34
2 changed files with 59 additions and 41 deletions

View File

@ -116,6 +116,8 @@ QgsPostgresFeatureIterator::QgsPostgresFeatureIterator( QgsPostgresFeatureSource
mOrderByCompiled = true;
if ( QSettings().value( "/qgis/compileExpressions", true ).toBool() )
{
Q_FOREACH ( const QgsFeatureRequest::OrderByClause& clause, request.orderBys() )
{
QgsPostgresExpressionCompiler compiler = QgsPostgresExpressionCompiler( source );
@ -135,10 +137,17 @@ QgsPostgresFeatureIterator::QgsPostgresFeatureIterator( QgsPostgresFeatureSource
// will still be sent and used to pre-sort so the local
// CPU can use its cycles for fine-tuning.
mOrderByCompiled = false;
limitAtProvider = false;
break;
}
}
}
else
{
mOrderByCompiled = false;
}
if ( !mOrderByCompiled )
limitAtProvider = false;
bool success = declareCursor( whereClause, limitAtProvider ? mRequest.limit() : -1, false, orderByParts.join( "," ) );
if ( !success && useFallbackWhereClause )

View File

@ -121,6 +121,8 @@ QgsSpatiaLiteFeatureIterator::QgsSpatiaLiteFeatureIterator( QgsSpatiaLiteFeature
mOrderByCompiled = true;
if ( QSettings().value( "/qgis/compileExpressions", true ).toBool() )
{
Q_FOREACH ( const QgsFeatureRequest::OrderByClause& clause, request.orderBys() )
{
QgsSpatiaLiteExpressionCompiler compiler = QgsSpatiaLiteExpressionCompiler( source );
@ -145,10 +147,17 @@ QgsSpatiaLiteFeatureIterator::QgsSpatiaLiteFeatureIterator( QgsSpatiaLiteFeature
// will still be sent and used to pre-sort so the local
// CPU can use its cycles for fine-tuning.
mOrderByCompiled = false;
limitAtProvider = false;
break;
}
}
}
else
{
mOrderByCompiled = false;
}
if ( !mOrderByCompiled )
limitAtProvider = false;
// preparing the SQL statement
bool success = prepareStatement( whereClause, limitAtProvider ? mRequest.limit() : -1, orderByParts.join( "," ) );