Skip to content

Commit d007716

Browse files
committed
Extend wfs_use_default_extent_for_getfeature false to msWFSRunBasicGetFeature() for mssql2008 by creating a helper function
1 parent f9ca113 commit d007716

File tree

3 files changed

+29
-18
lines changed

3 files changed

+29
-18
lines changed

mapogcfilter.c

+26-10
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,31 @@ static FilterEncodingNode* FLTGetTopBBOX(FilterEncodingNode *psNode)
729729
return psTopBBOX;
730730
}
731731

732+
/************************************************************************/
733+
/* FLTLayerSetInvalidRectIfSupported */
734+
/* */
735+
/* This function will set in *rect a very huge extent if the layer */
736+
/* wfs_use_default_extent_for_getfeature metadata item is set to false */
737+
/* and the layer supports such degenerate rectangle, as a hint that */
738+
/* they should not issue a spatial filter. */
739+
/************************************************************************/
740+
741+
int FLTLayerSetInvalidRectIfSupported(layerObj* lp,
742+
rectObj* rect)
743+
{
744+
const char* pszUseDefaultExtent = msOWSLookupMetadata(&(lp->metadata), "F",
745+
"use_default_extent_for_getfeature");
746+
if( pszUseDefaultExtent && !CSLTestBoolean(pszUseDefaultExtent) &&
747+
(lp->connectiontype == MS_OGR ||
748+
((lp->connectiontype == MS_PLUGIN) && (strstr(lp->plugin_library,"msplugin_mssql2008") != NULL))) )
749+
{
750+
const rectObj rectInvalid = MS_INIT_INVALID_RECT;
751+
*rect = rectInvalid;
752+
return MS_TRUE;
753+
}
754+
return MS_FALSE;
755+
}
756+
732757
/************************************************************************/
733758
/* FLTLayerApplyPlainFilterToLayer */
734759
/* */
@@ -743,19 +768,10 @@ int FLTLayerApplyPlainFilterToLayer(FilterEncodingNode *psNode, mapObj *map,
743768

744769
pszExpression = FLTGetCommonExpression(psNode, lp);
745770
if (pszExpression) {
746-
const char* pszUseDefaultExtent;
747771
FilterEncodingNode* psTopBBOX;
748772
rectObj rect = map->extent;
749773

750-
pszUseDefaultExtent = msOWSLookupMetadata(&(lp->metadata), "F",
751-
"use_default_extent_for_getfeature");
752-
if( pszUseDefaultExtent && !CSLTestBoolean(pszUseDefaultExtent) &&
753-
(lp->connectiontype == MS_OGR ||
754-
((lp->connectiontype == MS_PLUGIN) && (strstr(lp->plugin_library,"msplugin_mssql2008") != NULL))) )
755-
{
756-
const rectObj rectInvalid = MS_INIT_INVALID_RECT;
757-
rect = rectInvalid;
758-
}
774+
FLTLayerSetInvalidRectIfSupported(lp, &rect);
759775

760776
psTopBBOX = FLTGetTopBBOX(psNode);
761777
if( psTopBBOX )

mapogcfilter.h

+1
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ FilterEncodingNode* FLTSimplify(FilterEncodingNode *psFilterNode,
144144
int FLTApplyFilterToLayerCommonExpressionWithRect(mapObj *map, int iLayerIndex, const char *pszExpression, rectObj rect);
145145
int FLTProcessPropertyIsNull(FilterEncodingNode *psFilterNode,
146146
mapObj *map, int i);
147+
int FLTLayerSetInvalidRectIfSupported(layerObj* lp, rectObj* rect);
147148

148149
#ifdef __cplusplus
149150
}

mapwfs.c

+2-8
Original file line numberDiff line numberDiff line change
@@ -2169,21 +2169,15 @@ static int msWFSRunBasicGetFeature(mapObj* map,
21692169
{
21702170
rectObj ext;
21712171
int status;
2172-
const char* pszUseDefaultExtent;
21732172

21742173
map->query.type = MS_QUERY_BY_RECT; /* setup the query */
21752174
map->query.mode = MS_QUERY_MULTIPLE;
21762175
map->query.rect = map->extent;
21772176
map->query.layer = lp->index;
21782177

2179-
2180-
pszUseDefaultExtent = msOWSLookupMetadata(&(lp->metadata), "F",
2181-
"use_default_extent_for_getfeature");
2182-
if( pszUseDefaultExtent && !CSLTestBoolean(pszUseDefaultExtent) &&
2183-
lp->connectiontype == MS_OGR )
2178+
if( FLTLayerSetInvalidRectIfSupported(lp, &(map->query.rect)) )
21842179
{
2185-
const rectObj rectInvalid = MS_INIT_INVALID_RECT;
2186-
map->query.rect = rectInvalid;
2180+
/* do nothing */
21872181
}
21882182
else if (msOWSGetLayerExtent(map, lp, "FO", &ext) == MS_SUCCESS) {
21892183
char *pszMapSRS=NULL;

0 commit comments

Comments
 (0)