Skip to content

Commit 60c591d

Browse files
committedNov 3, 2015
Merge pull request #2416 from elpaso/bugfix-13747
Fixes #13747
2 parents 37e9443 + 7a789d3 commit 60c591d

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed
 

‎src/providers/spatialite/qgsspatialitefeatureiterator.cpp

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,31 +34,46 @@ QgsSpatiaLiteFeatureIterator::QgsSpatiaLiteFeatureIterator( QgsSpatiaLiteFeature
3434
mHasPrimaryKey = !mSource->mPrimaryKey.isEmpty();
3535
mRowNumber = 0;
3636

37+
QStringList whereClauses;
3738
QString whereClause;
3839
if ( !request.filterRect().isNull() && !mSource->mGeometryColumn.isNull() )
3940
{
4041
// some kind of MBR spatial filtering is required
41-
whereClause += whereClauseRect();
42+
whereClause = whereClauseRect();
43+
if ( ! whereClause.isEmpty() )
44+
{
45+
whereClauses.append( whereClause );
46+
}
4247
}
4348

4449
if ( request.filterType() == QgsFeatureRequest::FilterFid )
4550
{
46-
whereClause += whereClauseFid();
51+
whereClause = whereClauseFid();
52+
if ( ! whereClause.isEmpty() )
53+
{
54+
whereClauses.append( whereClause );
55+
}
4756
}
4857
else if ( request.filterType() == QgsFeatureRequest::FilterFids )
4958
{
50-
whereClause += whereClauseFids();
59+
whereClause = whereClauseFids();
60+
if ( ! whereClause.isEmpty() )
61+
{
62+
whereClauses.append( whereClause );
63+
}
5164
}
5265

5366
if ( !mSource->mSubsetString.isEmpty() )
5467
{
55-
if ( !whereClause.isEmpty() )
68+
whereClause = "( " + mSource->mSubsetString + ')';
69+
if ( ! whereClause.isEmpty() )
5670
{
57-
whereClause += " AND ";
71+
whereClauses.append( whereClause );
5872
}
59-
whereClause += "( " + mSource->mSubsetString + ')';
6073
}
6174

75+
whereClause = whereClauses.join( " AND " );
76+
6277
// preparing the SQL statement
6378
if ( !prepareStatement( whereClause ) )
6479
{

0 commit comments

Comments
 (0)
Please sign in to comment.