mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-01 00:46:20 -05:00
Revert "Avoid type quotation errors in value exists check"
This reverts commit 6ce4b607c522d5db35227d2ae5f20259d4e384f0.
This commit is contained in:
parent
fc016ec615
commit
08443c20d8
@ -22,12 +22,12 @@ bool QgsVectorLayerUtils::valueExists( const QgsVectorLayer *layer, int fieldInd
|
||||
if ( !layer )
|
||||
return false;
|
||||
|
||||
const QgsFields fields = layer->fields();
|
||||
QgsFields fields = layer->fields();
|
||||
|
||||
if ( fieldIndex < 0 || fieldIndex >= fields.count() )
|
||||
return false;
|
||||
|
||||
const QgsField field = fields.at( fieldIndex );
|
||||
QString fieldName = fields.at( fieldIndex ).name();
|
||||
|
||||
// build up an optimised feature request
|
||||
QgsFeatureRequest request;
|
||||
@ -38,8 +38,8 @@ bool QgsVectorLayerUtils::valueExists( const QgsVectorLayer *layer, int fieldInd
|
||||
int limit = ignoreIds.size() + 1;
|
||||
request.setLimit( limit );
|
||||
|
||||
request.setFilterExpression( QStringLiteral( "%1=%2" ).arg( QgsExpression::quotedColumnRef( field.name() ),
|
||||
QgsExpression::quotedValue( value, field.type() ) ) );
|
||||
request.setFilterExpression( QStringLiteral( "%1=%2" ).arg( QgsExpression::quotedColumnRef( fieldName ),
|
||||
QgsExpression::quotedValue( value ) ) );
|
||||
|
||||
QgsFeature feat;
|
||||
QgsFeatureIterator it = layer->getFeatures( request );
|
||||
|
Loading…
x
Reference in New Issue
Block a user