From b5d02c55f141e5617c57164589a9e79b675b980a Mon Sep 17 00:00:00 2001 From: Seth G Date: Thu, 15 Apr 2021 14:52:11 +0200 Subject: [PATCH] Only select requested fields for all WFS query types (#6288) --- maplayer.c | 9 +++++++++ mapquery.c | 13 ++----------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/maplayer.c b/maplayer.c index 3fc404aa6f..33fb05eadb 100644 --- a/maplayer.c +++ b/maplayer.c @@ -990,6 +990,15 @@ int msLayerWhichItems(layerObj *layer, int get_all, const char *metadata) get_all = MS_FALSE; } + if(metadata == NULL){ + // check item set by mapwfs.cpp to restrict the number of columns selected + metadata = msOWSLookupMetadata(&(layer->metadata), "G", "select_items"); + if (metadata) { + /* get only selected items */ + get_all = MS_FALSE; + } + } + /* always retrieve all items in some cases */ if(layer->connectiontype == MS_INLINE || (layer->map->outputformat && layer->map->outputformat->renderer == MS_RENDER_WITH_KML)) { diff --git a/mapquery.c b/mapquery.c index f362af0d3c..5110240220 100644 --- a/mapquery.c +++ b/mapquery.c @@ -1115,17 +1115,8 @@ int msQueryByRect(mapObj *map) } msLayerEnablePaging(lp, paging); - // Item set by mapwfs.cpp to restrict the number of columns selected - const char *value = msOWSLookupMetadata(&(lp->metadata), "G", "select_items"); - if(value){ - /* get only selected items */ - status = msLayerWhichItems(lp, MS_FALSE, value); - } - else { - /* build item list, we want *all* items */ - status = msLayerWhichItems(lp, MS_TRUE, NULL); - } - + /* build item list, we want *all* items */ + status = msLayerWhichItems(lp, MS_TRUE, NULL); if(status != MS_SUCCESS) { msFreeShape(&searchshape);