Skip to content
Permalink
Browse files

add null and is null macros for QgsFeatureId (#8085)

* 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 d2fdfe8f6fb5f2caf18a21c0764d8a9c3462184c
Showing with 7 additions and 5 deletions.
  1. +6 −4 src/core/qgsfeatureid.h
  2. +1 −1 src/providers/postgres/qgspostgresprovider.cpp
@@ -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;
@@ -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 += ')';

0 comments on commit d2fdfe8

Please sign in to comment.
You can’t perform that action at this time.