@@ -507,16 +507,16 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format
507507 QgsFeature feature;
508508
509509 mWithGeom = true ;
510- // QgsAttributeList attrIndexes = provider->attributeIndexes();
510+
511+ // Using pending attributes and pending fields
511512 QgsAttributeList attrIndexes = layer->pendingAllAttributesList ();
512513
513514 QDomNodeList queryChildNodes = queryElem.childNodes ();
514515 if ( queryChildNodes.size () )
515516 {
516517 QStringList::const_iterator alstIt;
517518 QList<int > idxList;
518- QMap<QString, int > fieldMap = provider->fieldNameMap ();
519- QMap<QString, int >::const_iterator fieldIt;
519+ QgsFields fields = layer->pendingFields ();
520520 QString fieldName;
521521 QDomElement propertyElem;
522522 for ( int q = 0 ; q < queryChildNodes.size (); q++ )
@@ -529,10 +529,10 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format
529529 {
530530 fieldName = fieldName.section ( " :" , 1 , 1 );
531531 }
532- fieldIt = fieldMap. find ( fieldName );
533- if ( fieldIt != fieldMap. end () )
532+ int fieldNameIdx = fields. fieldNameIndex ( fieldName );
533+ if ( fieldNameIdx > - 1 )
534534 {
535- idxList.append ( fieldIt. value () );
535+ idxList.append ( fieldNameIdx );
536536 }
537537 }
538538 }
@@ -896,7 +896,7 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format
896896 // map extent
897897 searchRect = layer->extent ();
898898
899- // QgsAttributeList attrIndexes = provider->attributeIndexes();
899+ // Using pending attributes and pending fields
900900 QgsAttributeList attrIndexes = layer->pendingAllAttributesList ();
901901 if ( mPropertyName != " *" )
902902 {
@@ -905,16 +905,15 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format
905905 {
906906 QStringList::const_iterator alstIt;
907907 QList<int > idxList;
908- QMap<QString, int > fieldMap = provider->fieldNameMap ();
909- QMap<QString, int >::const_iterator fieldIt;
908+ QgsFields fields = layer->pendingFields ();
910909 QString fieldName;
911910 for ( alstIt = attrList.begin (); alstIt != attrList.end (); ++alstIt )
912911 {
913912 fieldName = *alstIt;
914- fieldIt = fieldMap. find ( fieldName );
915- if ( fieldIt != fieldMap. end () )
913+ int fieldNameIdx = fields. fieldNameIndex ( fieldName );
914+ if ( fieldNameIdx > - 1 )
916915 {
917- idxList.append ( fieldIt. value () );
916+ idxList.append ( fieldNameIdx );
918917 }
919918 }
920919 if ( !idxList.isEmpty () )
0 commit comments