Skip to content
Permalink
Browse files

[Backport branch-7-4] Allow sorting in MSSQL with WFS (#5835)

  • Loading branch information...
backporting authored and geographika committed Jul 3, 2019
1 parent 2df2935 commit 42027835d8fb1244ac6f8f332c2e28d75999bbac
Showing with 15 additions and 2 deletions.
  1. +1 −1 maplayer.c
  2. +14 −1 mapmssql2008.c
@@ -1680,7 +1680,7 @@ int msLayerApplyPlainFilterToLayer(FilterEncodingNode *psNode, mapObj *map, int
int msLayerSupportsSorting(layerObj *layer)
{
if (layer && (
(layer->connectiontype == MS_OGR) || (layer->connectiontype == MS_POSTGIS) || (layer->connectiontype == MS_ORACLESPATIAL) || ((layer->connectiontype == MS_PLUGIN) && (strstr(layer->plugin_library,"msplugin_oracle") != NULL))
(layer->connectiontype == MS_OGR) || (layer->connectiontype == MS_POSTGIS) || (layer->connectiontype == MS_ORACLESPATIAL) || ((layer->connectiontype == MS_PLUGIN) && (strstr(layer->plugin_library,"msplugin_oracle") != NULL)) || ((layer->connectiontype == MS_PLUGIN) && (strstr(layer->plugin_library,"msplugin_mssql2008") != NULL))
)
)
return MS_TRUE;
@@ -1506,8 +1506,21 @@ static int prepare_database(layerObj *layer, rectObj rect, char **query_string)
query = msStringConcatenate(query, box3d);
query = msStringConcatenate(query, ") = 1 ");

if (layerinfo->sort_spec)
if (layerinfo->sort_spec) {
query = msStringConcatenate(query, layerinfo->sort_spec);
}

/* Add extra sort by */
if( layer->sortBy.nProperties > 0 ) {
char* pszTmp = msLayerBuildSQLOrderBy(layer);
if (layerinfo->sort_spec)
query = msStringConcatenate(query, ", ");
else
query = msStringConcatenate(query, " ORDER BY ");
query = msStringConcatenate(query, pszTmp);
msFree(pszTmp);
}


if (layer->debug) {
msDebug("query:%s\n", query);

0 comments on commit 4202783

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