Permalink
Browse files

Oraclespatial: Fix IEQ expression translation (#5124)

Make sure IEQ comparison wraps the comparison string with start (^) and
end ($) to ensure exact match.
  • Loading branch information...
msmitherdc authored and tbonfort committed Jul 22, 2015
1 parent 1a8a718 commit f67fbaf6a02706ce278f1d24273d819049b89dbb
Showing with 9 additions and 1 deletion.
  1. +9 −1 maporaclespatial.c
View
@@ -3486,7 +3486,7 @@ int msOracleSpatialLayerTranslateFilter(layerObj *layer, expressionObj *filter,
int nodeCount = 0;
- int function = 0, version = 0, dwithin = 0, regexp_like = 0, case_ins = 0;
+ int function = 0, version = 0, dwithin = 0, regexp_like = 0, case_ins = 0, ieq = 0;
char *table_name;
char *geom_column_name = NULL, *unique = NULL, *srid = NULL, *indexfield=NULL;
char *snippet = NULL;
@@ -3615,7 +3615,14 @@ int msOracleSpatialLayerTranslateFilter(layerObj *layer, expressionObj *filter,
sprintf(snippet, strtmpl, node->tokenval.strval); // TODO: escape strval
snippet = msReplaceSubstring(snippet,"'","''");
native_string = msStringConcatenate(native_string, "'");
+ if (ieq == MS_TRUE) {
+ native_string = msStringConcatenate(native_string, "^");
+ }
native_string = msStringConcatenate(native_string, snippet);
+ if (ieq == MS_TRUE) {
+ native_string = msStringConcatenate(native_string, "$");
+ ieq = MS_FALSE;
+ }
native_string = msStringConcatenate(native_string, "'");
msFree(snippet);
break;
@@ -3732,6 +3739,7 @@ int msOracleSpatialLayerTranslateFilter(layerObj *layer, expressionObj *filter,
msDebug("got a IEQ comparison\n");
regexp_like = MS_TRUE;
case_ins = MS_TRUE;
+ ieq = MS_TRUE;
native_string = msStringConcatenate(native_string, ", ");
break;
case MS_TOKEN_COMPARISON_RE:

0 comments on commit f67fbaf

Please sign in to comment.