Skip to content

Commit

Permalink
add null and is null macros for QgsFeatureId (#8085)
Browse files Browse the repository at this point in the history
* add null and is null macros for QgsFeatureId
* Finalize FID_NULL
* No string to fid null conversion for now
* add parenthesis to fix macro call
  • Loading branch information
3nids committed Oct 2, 2018
1 parent b3f36dc commit d2fdfe8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/core/qgsfeatureid.h
Expand Up @@ -23,10 +23,12 @@ email : matthias@opengis.ch

// 64 bit feature ids
typedef qint64 QgsFeatureId SIP_SKIP;
#define FID_IS_NEW(fid) (fid<0)
#define FID_TO_NUMBER(fid) static_cast<qint64>(fid)
#define FID_TO_STRING(fid) QString::number( fid )
#define STRING_TO_FID(str) (str).toLongLong()
#define FID_NULL std::numeric_limits<QgsFeatureId>::min()
#define FID_IS_NULL(fid) ( fid == std::numeric_limits<QgsFeatureId>::min() )
#define FID_IS_NEW(fid) ( fid < 0 && fid != std::numeric_limits<QgsFeatureId>::min() )
#define FID_TO_NUMBER(fid) static_cast<qint64>( fid )
#define FID_TO_STRING(fid) ( fid != std::numeric_limits<QgsFeatureId>::min() ? QString::number( fid ) : QStringLiteral( "NULL" ) )
#define STRING_TO_FID(str) ( (str).toLongLong() )

#ifndef SIP_RUN
typedef QSet<QgsFeatureId> QgsFeatureIds;
Expand Down
2 changes: 1 addition & 1 deletion src/providers/postgres/qgspostgresprovider.cpp
Expand Up @@ -590,7 +590,7 @@ QString QgsPostgresUtils::whereClause( const QgsFeatureIds &featureIds, const Qg

Q_FOREACH ( const QgsFeatureId featureId, featureIds )
{
expr += delim + FID_TO_STRING( pkType == PktOid ? featureId : pkType == PktUint64 ? featureId : FID2PKINT( featureId ) );
expr += delim + FID_TO_STRING( ( pkType == PktOid ? featureId : pkType == PktUint64 ? featureId : FID2PKINT( featureId ) ) );
delim = ',';
}
expr += ')';
Expand Down

0 comments on commit d2fdfe8

Please sign in to comment.