Permalink
Browse files

Reorder spatial operator arguments for mssql (#5352)

  • Loading branch information...
szekerest committed Nov 27, 2016
1 parent ac253a7 commit 51415f75e5d6abbf162ace0401eaf4ed7552d8a3
Showing with 109 additions and 22 deletions.
  1. +109 −22 mapmssql2008.c
View
@@ -2381,7 +2381,10 @@ int process_node(layerObj* layer, expressionObj *filter)
break;
case ')':
filter->native_string = msStringConcatenate(filter->native_string, ")");
break;
break;
/* argument separator */
case ',':
break;
/* literal tokens */
case MS_TOKEN_LITERAL_BOOLEAN:
case MS_TOKEN_LITERAL_NUMBER:
@@ -2518,67 +2521,131 @@ int process_node(layerObj* layer, expressionObj *filter)
/* spatial comparison tokens */
case MS_TOKEN_COMPARISON_INTERSECTS:
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
if (!process_node(layer, filter))
return 0;
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
filter->native_string = msStringConcatenate(filter->native_string, ".STIntersects(");
layerinfo->current_node = layerinfo->current_node->next;
if (!process_node(layer, filter))
return 0;
filter->native_string = msStringConcatenate(filter->native_string, ")=1");
break;
case MS_TOKEN_COMPARISON_DISJOINT:
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
if (!process_node(layer, filter))
return 0;
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
filter->native_string = msStringConcatenate(filter->native_string, ".STDisjoint(");
layerinfo->current_node = layerinfo->current_node->next;
if (!process_node(layer, filter))
return 0;
filter->native_string = msStringConcatenate(filter->native_string, ")=1");
break;
case MS_TOKEN_COMPARISON_TOUCHES:
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
if (!process_node(layer, filter))
return 0;
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
filter->native_string = msStringConcatenate(filter->native_string, ".STTouches(");
layerinfo->current_node = layerinfo->current_node->next;
if (!process_node(layer, filter))
return 0;
filter->native_string = msStringConcatenate(filter->native_string, ")=1");
break;
case MS_TOKEN_COMPARISON_OVERLAPS:
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
if (!process_node(layer, filter))
return 0;
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
filter->native_string = msStringConcatenate(filter->native_string, ".STOverlaps(");
layerinfo->current_node = layerinfo->current_node->next;
if (!process_node(layer, filter))
return 0;
filter->native_string = msStringConcatenate(filter->native_string, ")=1");
break;
case MS_TOKEN_COMPARISON_CROSSES:
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
if (!process_node(layer, filter))
return 0;
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
filter->native_string = msStringConcatenate(filter->native_string, ".STCrosses(");
layerinfo->current_node = layerinfo->current_node->next;
if (!process_node(layer, filter))
return 0;
filter->native_string = msStringConcatenate(filter->native_string, ")=1");
break;
case MS_TOKEN_COMPARISON_WITHIN:
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
if (!process_node(layer, filter))
return 0;
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
filter->native_string = msStringConcatenate(filter->native_string, ".STWithin(");
layerinfo->current_node = layerinfo->current_node->next;
if (!process_node(layer, filter))
return 0;
filter->native_string = msStringConcatenate(filter->native_string, ")=1");
break;
case MS_TOKEN_COMPARISON_CONTAINS:
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
if (!process_node(layer, filter))
return 0;
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
filter->native_string = msStringConcatenate(filter->native_string, ".STContains(");
layerinfo->current_node = layerinfo->current_node->next;
if (!process_node(layer, filter))
return 0;
filter->native_string = msStringConcatenate(filter->native_string, ")=1");
break;
case MS_TOKEN_COMPARISON_EQUALS:
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
if (!process_node(layer, filter))
return 0;
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
filter->native_string = msStringConcatenate(filter->native_string, ".STEquals(");
layerinfo->current_node = layerinfo->current_node->next;
if (!process_node(layer, filter))
return 0;
filter->native_string = msStringConcatenate(filter->native_string, ")=1");
break;
case MS_TOKEN_COMPARISON_BEYOND:
@@ -2591,24 +2658,44 @@ int process_node(layerObj* layer, expressionObj *filter)
/* spatial functions */
case MS_TOKEN_FUNCTION_AREA:
filter->native_string = msStringConcatenate(filter->native_string, ".STArea(");
layerinfo->current_node = layerinfo->current_node->next;
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
if (!process_node(layer, filter))
return 0;
filter->native_string = msStringConcatenate(filter->native_string, ")");
filter->native_string = msStringConcatenate(filter->native_string, ".STArea()");
break;
case MS_TOKEN_FUNCTION_BUFFER:
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
if (!process_node(layer, filter))
return 0;
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
filter->native_string = msStringConcatenate(filter->native_string, ".STBuffer(");
layerinfo->current_node = layerinfo->current_node->next;
if (!process_node(layer, filter))
return 0;
filter->native_string = msStringConcatenate(filter->native_string, ")");
break;
case MS_TOKEN_FUNCTION_DIFFERENCE:
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
if (!process_node(layer, filter))
return 0;
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
if (layerinfo->current_node->next) layerinfo->current_node = layerinfo->current_node->next;
else return 0;
filter->native_string = msStringConcatenate(filter->native_string, ".STDifference(");
layerinfo->current_node = layerinfo->current_node->next;
if (!process_node(layer, filter))
return 0;
filter->native_string = msStringConcatenate(filter->native_string, ")");

0 comments on commit 51415f7

Please sign in to comment.