Skip to content
Permalink
Browse files
Extra fixes related to truncation of feature count
  • Loading branch information
rouault authored and nyalldawson committed Jun 15, 2021
1 parent 404b756 commit 53ca5b2a31de98fa41a6b7ba3d10b614db63fbf2
Showing with 13 additions and 9 deletions.
  1. +2 −2 python/core/auto_generated/qgsfeaturerequest.sip.in
  2. +1 −1 src/core/qgsfeatureiterator.h
  3. +1 −1 src/core/qgsfeaturerequest.cpp
  4. +7 −3 src/core/qgsfeaturerequest.h
  5. +2 −2 src/gui/qgsquerybuilder.cpp
@@ -497,7 +497,7 @@ Set a list of order by clauses.
.. versionadded:: 2.14
%End

QgsFeatureRequest &setLimit( long limit );
QgsFeatureRequest &setLimit( long long limit );
%Docstring
Set the maximum number of features to request.

@@ -508,7 +508,7 @@ Set the maximum number of features to request.
.. versionadded:: 2.14
%End

long limit() const;
long long limit() const;
%Docstring
Returns the maximum number of features to request, or -1 if no limit set.

@@ -177,7 +177,7 @@ class CORE_EXPORT QgsAbstractFeatureIterator
friend class QgsFeatureIterator;

//! Number of features already fetched by iterator
long mFetchedCount = 0;
long long mFetchedCount = 0;

//! Status of compilation of filter expression
CompileStatus mCompileStatus = NoCompilation;
@@ -170,7 +170,7 @@ QgsFeatureRequest &QgsFeatureRequest::setOrderBy( const QgsFeatureRequest::Order
return *this;
}

QgsFeatureRequest &QgsFeatureRequest::setLimit( long limit )
QgsFeatureRequest &QgsFeatureRequest::setLimit( long long limit )
{
mLimit = limit;
return *this;
@@ -492,14 +492,18 @@ class CORE_EXPORT QgsFeatureRequest
* \see limit()
* \since QGIS 2.14
*/
QgsFeatureRequest &setLimit( long limit );
QgsFeatureRequest &setLimit( long long limit );

/**
* Returns the maximum number of features to request, or -1 if no limit set.
* \see setLimit
* \since QGIS 2.14
*/
long limit() const { return mLimit; }
#ifndef SIP_RUN
long long limit() const { return mLimit; }
#else
long long limit() const;
#endif

//! Sets flags that affect how features will be fetched
QgsFeatureRequest &setFlags( QgsFeatureRequest::Flags flags );
@@ -720,7 +724,7 @@ class CORE_EXPORT QgsFeatureRequest
Flags mFlags = Flags();
QgsAttributeList mAttrs;
QgsSimplifyMethod mSimplifyMethod;
long mLimit = -1;
long long mLimit = -1;
OrderBy mOrderBy;
InvalidGeometryCheck mInvalidGeometryFilter = GeometryNoCheck;
std::function< void( const QgsFeature & ) > mInvalidGeometryCallback;
@@ -247,7 +247,7 @@ void QgsQueryBuilder::test()

if ( mLayer->setSubsetString( mTxtSql->text() ) )
{
const long featureCount { mLayer->featureCount() };
const long long featureCount { mLayer->featureCount() };
// Check for errors
if ( featureCount < 0 )
{
@@ -259,7 +259,7 @@ void QgsQueryBuilder::test()
{
QMessageBox::information( this,
tr( "Query Result" ),
tr( "The where clause returned %n row(s).", "returned test rows", featureCount ) );
tr( "The where clause returned %1 row(s).", "returned test rows" ). arg( featureCount ) );
}
}
else if ( mLayer->dataProvider()->hasErrors() )

0 comments on commit 53ca5b2

Please sign in to comment.