QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
Public Member Functions | List of all members
QgsFeatureRequest::OrderByClause Class Reference

The OrderByClause class represents an order by clause for a QgsFeatureRequest. More...

#include <qgsfeaturerequest.h>

Public Member Functions

 OrderByClause (const QgsExpression &expression, bool ascending, bool nullsfirst)
 Creates a new OrderByClause for a QgsFeatureRequest.
 
 OrderByClause (const QgsExpression &expression, bool ascending=true)
 Creates a new OrderByClause for a QgsFeatureRequest.
 
 OrderByClause (const QString &expression, bool ascending, bool nullsfirst)
 Creates a new OrderByClause for a QgsFeatureRequest.
 
 OrderByClause (const QString &expression, bool ascending=true)
 Creates a new OrderByClause for a QgsFeatureRequest.
 
bool ascending () const
 Order ascending.
 
QString dump () const
 Dumps the content to an SQL equivalent.
 
QgsExpression expression () const
 The expression.
 
bool nullsFirst () const
 Set if NULLS should be returned first.
 
bool operator!= (const OrderByClause &v) const
 
bool operator== (const OrderByClause &v) const
 
bool prepare (QgsExpressionContext *context)
 Prepare the expression with the given context.
 
void setAscending (bool ascending)
 Set if ascending order is requested.
 
void setNullsFirst (bool nullsFirst)
 Set if NULLS should be returned first.
 

Detailed Description

The OrderByClause class represents an order by clause for a QgsFeatureRequest.

It can be a simple field or an expression. Multiple order by clauses can be added to a QgsFeatureRequest to fine tune the behavior if a single field or expression is not enough to completely specify the required behavior.

If expression compilation is activated in the settings and the expression can be translated for the provider in question, it will be evaluated on provider side. If one of these two premises does not apply, the ordering will take place locally which results in increased memory and CPU usage.

If the ordering is done on strings, the order depends on the system's locale if the local fallback implementation is used. The order depends on the server system's locale and implementation if ordering is done on the server.

In case the fallback code needs to be used, a limit set on the request will be respected for the features returned by the iterator but internally all features will be requested from the provider.

Definition at line 109 of file qgsfeaturerequest.h.

Constructor & Destructor Documentation

◆ OrderByClause() [1/4]

QgsFeatureRequest::OrderByClause::OrderByClause ( const QString &  expression,
bool  ascending = true 
)

Creates a new OrderByClause for a QgsFeatureRequest.

Parameters
expressionThe expression to use for ordering
ascendingIf the order should be ascending (1,2,3) or descending (3,2,1) If the order is ascending, by default nulls are last If the order is descending, by default nulls are first

Definition at line 490 of file qgsfeaturerequest.cpp.

◆ OrderByClause() [2/4]

QgsFeatureRequest::OrderByClause::OrderByClause ( const QString &  expression,
bool  ascending,
bool  nullsfirst 
)

Creates a new OrderByClause for a QgsFeatureRequest.

Parameters
expressionThe expression to use for ordering
ascendingIf the order should be ascending (1,2,3) or descending (3,2,1)
nullsfirstIf true, NULLS are at the beginning, if false, NULLS are at the end

Definition at line 498 of file qgsfeaturerequest.cpp.

◆ OrderByClause() [3/4]

QgsFeatureRequest::OrderByClause::OrderByClause ( const QgsExpression expression,
bool  ascending = true 
)

Creates a new OrderByClause for a QgsFeatureRequest.

Parameters
expressionThe expression to use for ordering
ascendingIf the order should be ascending (1,2,3) or descending (3,2,1) If the order is ascending, by default nulls are last If the order is descending, by default nulls are first

Definition at line 505 of file qgsfeaturerequest.cpp.

◆ OrderByClause() [4/4]

QgsFeatureRequest::OrderByClause::OrderByClause ( const QgsExpression expression,
bool  ascending,
bool  nullsfirst 
)

Creates a new OrderByClause for a QgsFeatureRequest.

Parameters
expressionThe expression to use for ordering
ascendingIf the order should be ascending (1,2,3) or descending (3,2,1)
nullsfirstIf true, NULLS are at the beginning, if false, NULLS are at the end

Definition at line 513 of file qgsfeaturerequest.cpp.

Member Function Documentation

◆ ascending()

bool QgsFeatureRequest::OrderByClause::ascending ( ) const

Order ascending.

Returns
If ascending order is requested

Definition at line 521 of file qgsfeaturerequest.cpp.

◆ dump()

QString QgsFeatureRequest::OrderByClause::dump ( ) const

Dumps the content to an SQL equivalent.

Definition at line 541 of file qgsfeaturerequest.cpp.

◆ expression()

QgsExpression QgsFeatureRequest::OrderByClause::expression ( ) const

The expression.

Returns
the expression

Definition at line 549 of file qgsfeaturerequest.cpp.

◆ nullsFirst()

bool QgsFeatureRequest::OrderByClause::nullsFirst ( ) const

Set if NULLS should be returned first.

Returns
if NULLS should be returned first

Definition at line 531 of file qgsfeaturerequest.cpp.

◆ operator!=()

bool QgsFeatureRequest::OrderByClause::operator!= ( const OrderByClause v) const
inline

Definition at line 201 of file qgsfeaturerequest.h.

◆ operator==()

bool QgsFeatureRequest::OrderByClause::operator== ( const OrderByClause v) const
inline

Definition at line 194 of file qgsfeaturerequest.h.

◆ prepare()

bool QgsFeatureRequest::OrderByClause::prepare ( QgsExpressionContext context)

Prepare the expression with the given context.

See also
QgsExpression::prepare

Definition at line 554 of file qgsfeaturerequest.cpp.

◆ setAscending()

void QgsFeatureRequest::OrderByClause::setAscending ( bool  ascending)

Set if ascending order is requested.

Definition at line 526 of file qgsfeaturerequest.cpp.

◆ setNullsFirst()

void QgsFeatureRequest::OrderByClause::setNullsFirst ( bool  nullsFirst)

Set if NULLS should be returned first.

Definition at line 536 of file qgsfeaturerequest.cpp.


The documentation for this class was generated from the following files: