Skip to content

Commit f67fbaf

Browse files
msmitherdctbonfort
authored andcommitted
Oraclespatial: Fix IEQ expression translation (#5124)
Make sure IEQ comparison wraps the comparison string with start (^) and end ($) to ensure exact match.
1 parent 1a8a718 commit f67fbaf

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

maporaclespatial.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -3486,7 +3486,7 @@ int msOracleSpatialLayerTranslateFilter(layerObj *layer, expressionObj *filter,
34863486

34873487
int nodeCount = 0;
34883488

3489-
int function = 0, version = 0, dwithin = 0, regexp_like = 0, case_ins = 0;
3489+
int function = 0, version = 0, dwithin = 0, regexp_like = 0, case_ins = 0, ieq = 0;
34903490
char *table_name;
34913491
char *geom_column_name = NULL, *unique = NULL, *srid = NULL, *indexfield=NULL;
34923492
char *snippet = NULL;
@@ -3615,7 +3615,14 @@ int msOracleSpatialLayerTranslateFilter(layerObj *layer, expressionObj *filter,
36153615
sprintf(snippet, strtmpl, node->tokenval.strval); // TODO: escape strval
36163616
snippet = msReplaceSubstring(snippet,"'","''");
36173617
native_string = msStringConcatenate(native_string, "'");
3618+
if (ieq == MS_TRUE) {
3619+
native_string = msStringConcatenate(native_string, "^");
3620+
}
36183621
native_string = msStringConcatenate(native_string, snippet);
3622+
if (ieq == MS_TRUE) {
3623+
native_string = msStringConcatenate(native_string, "$");
3624+
ieq = MS_FALSE;
3625+
}
36193626
native_string = msStringConcatenate(native_string, "'");
36203627
msFree(snippet);
36213628
break;
@@ -3732,6 +3739,7 @@ int msOracleSpatialLayerTranslateFilter(layerObj *layer, expressionObj *filter,
37323739
msDebug("got a IEQ comparison\n");
37333740
regexp_like = MS_TRUE;
37343741
case_ins = MS_TRUE;
3742+
ieq = MS_TRUE;
37353743
native_string = msStringConcatenate(native_string, ", ");
37363744
break;
37373745
case MS_TOKEN_COMPARISON_RE:

0 commit comments

Comments
 (0)