Skip to content
Permalink
Browse files

Use QgsFields::fieldNameIndex when preparing column refs in expressions

  • Loading branch information
nyalldawson committed Dec 10, 2015
1 parent 28cabbe commit 0a84fbd6b5bf2a67c5e8407bf86a14ec40a526bf
Showing with 9 additions and 9 deletions.
  1. +9 −9 src/core/qgsexpression.cpp
@@ -3626,17 +3626,17 @@ bool QgsExpression::NodeColumnRef::prepare( QgsExpression *parent, const QgsExpr

QgsFields fields = qvariant_cast<QgsFields>( context->variable( QgsExpressionContext::EXPR_FIELDS ) );

for ( int i = 0; i < fields.count(); ++i )
mIndex = fields.fieldNameIndex( mName );
if ( mIndex >= 0 )
{
if ( QString::compare( fields.at( i ).name(), mName, Qt::CaseInsensitive ) == 0 )
{
mIndex = i;
return true;
}
return true;
}
else
{
parent->mEvalErrorString = tr( "Column '%1' not found" ).arg( mName );
mIndex = -1;
return false;
}
parent->mEvalErrorString = tr( "Column '%1' not found" ).arg( mName );
mIndex = -1;
return false;
}

QString QgsExpression::NodeColumnRef::dump() const

0 comments on commit 0a84fbd

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