Skip to content

Commit

Permalink
Add support for RFC91 processing option NATIVE_FILTER to oracle driver (
Browse files Browse the repository at this point in the history
  • Loading branch information
msmitherdc authored and tbonfort committed Feb 12, 2015
1 parent 29db335 commit 1842327
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions maporaclespatial.c
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,7 @@ static int msOCIConvertCircle( pointObj *pt )
/*function that creates the correct sql for filter and filteritem*/
static void osFilteritem(layerObj *layer, int function, char *query_str, size_t size, int mode)
{
char *native_filter;
if (layer->filter.native_string != NULL) {
if (mode == 1)
strlcat( query_str, " WHERE ", size);
Expand All @@ -1032,6 +1033,24 @@ static void osFilteritem(layerObj *layer, int function, char *query_str, size_t
if (function != FUNCTION_NONE)
strlcat( query_str, " WHERE ", size);
}

/* Handle a native filter set as a PROCESSING option (#5001). */
if ( msLayerGetProcessingKey(layer, "NATIVE_FILTER") != NULL ) {
if ((function == FUNCTION_NONE)&&(layer->filter.native_string == NULL)) {
strlcat( query_str, " WHERE ", size);
}
if ((function == FUNCTION_NONE)&&(layer->filter.native_string != NULL)) {
strlcat( query_str, " AND ", size);
}
native_filter = msLayerGetProcessingKey(layer, "NATIVE_FILTER");
snprintf(query_str + strlen(query_str) , size-strlen(query_str), " %s ", native_filter);
if (function != FUNCTION_NONE) {
strlcat( query_str, " AND ", size);
}

}


}

static void osAggrGetExtent(layerObj *layer, char *query_str, size_t size, char *geom_column_name, char *table_name)
Expand Down Expand Up @@ -3501,13 +3520,7 @@ int msOracleSpatialLayerTranslateFilter(layerObj *layer, expressionObj *filter,

/* for backwards compatibility we continue to allow SQL snippets as a string */

if(filter->type == MS_STRING && filter->string && !filteritem) {
filter->native_string = msStrdup(filter->string);

if (layer->debug>=2)
msDebug("msOracleSpatialLayerTranslateFilter. Found native sql, setting native_string \n");

} else if(filter->type == MS_STRING && filter->string && filteritem) { /* item/value pair */
if(filter->type == MS_STRING && filter->string && filteritem) { /* item/value pair */
if(filter->flags & MS_EXP_INSENSITIVE) {
native_string = msStringConcatenate(native_string, "upper(");
native_string = msStringConcatenate(native_string, filteritem);
Expand Down

0 comments on commit 1842327

Please sign in to comment.