Skip to content

Commit

Permalink
Fixes #13747
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 18, 2015
1 parent 15f59ae commit 49c243c
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions src/providers/spatialite/qgsspatialitefeatureiterator.cpp
Original file line number Diff line number Diff line change
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 49c243c

Please sign in to comment.