Permalink
Browse files

Add support for RFC91 processing option NATIVE_FILTER to oracle driver (

  • Loading branch information...
msmitherdc authored and tbonfort committed Feb 10, 2015
1 parent 29db335 commit 184232738a1ca868ec811a2ec16ce4b9d449ae8d
Showing with 20 additions and 7 deletions.
  1. +20 −7 maporaclespatial.c
View
@@ -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);
@@ -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)
@@ -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);

0 comments on commit 1842327

Please sign in to comment.