Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #2416 from elpaso/bugfix-13747
Fixes #13747
  • Loading branch information
elpaso committed Nov 3, 2015
2 parents 37e9443 + 7a789d3 commit 60c591d
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions src/providers/spatialite/qgsspatialitefeatureiterator.cpp
Expand Up @@ -34,31 +34,46 @@ QgsSpatiaLiteFeatureIterator::QgsSpatiaLiteFeatureIterator( QgsSpatiaLiteFeature
mHasPrimaryKey = !mSource->mPrimaryKey.isEmpty();
mRowNumber = 0;

QStringList whereClauses;
QString whereClause;
if ( !request.filterRect().isNull() && !mSource->mGeometryColumn.isNull() )
{
// some kind of MBR spatial filtering is required
whereClause += whereClauseRect();
whereClause = whereClauseRect();
if ( ! whereClause.isEmpty() )
{
whereClauses.append( whereClause );
}
}

if ( request.filterType() == QgsFeatureRequest::FilterFid )
{
whereClause += whereClauseFid();
whereClause = whereClauseFid();
if ( ! whereClause.isEmpty() )
{
whereClauses.append( whereClause );
}
}
else if ( request.filterType() == QgsFeatureRequest::FilterFids )
{
whereClause += whereClauseFids();
whereClause = whereClauseFids();
if ( ! whereClause.isEmpty() )
{
whereClauses.append( whereClause );
}
}

if ( !mSource->mSubsetString.isEmpty() )
{
if ( !whereClause.isEmpty() )
whereClause = "( " + mSource->mSubsetString + ')';
if ( ! whereClause.isEmpty() )
{
whereClause += " AND ";
whereClauses.append( whereClause );
}
whereClause += "( " + mSource->mSubsetString + ')';
}

whereClause = whereClauses.join( " AND " );

// preparing the SQL statement
if ( !prepareStatement( whereClause ) )
{
Expand Down

0 comments on commit 60c591d

Please sign in to comment.