[mapserver-commits] r7509 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Wed Apr 9 18:28:10 EDT 2008


Author: Assefa
Date: 2008-04-09 18:28:10 -0400 (Wed, 09 Apr 2008)
New Revision: 7509

Modified:
   trunk/mapserver/mapogcfilter.c
Log:
Correct PropertyIsLike failing in msautotest #2574

Modified: trunk/mapserver/mapogcfilter.c
===================================================================
--- trunk/mapserver/mapogcfilter.c	2008-04-09 18:57:12 UTC (rev 7508)
+++ trunk/mapserver/mapogcfilter.c	2008-04-09 22:28:10 UTC (rev 7509)
@@ -855,11 +855,10 @@
     char **tokens = NULL;
     int nTokens = 0, nEpsgTmp = 0;
     projectionObj sProjTmp;
-    int msErr;
-
     char *pszBuffer = NULL;
     int bConcatWhere = 0;
     int bHasAWhere =0;
+    char *pszFilterItem=NULL;
 
     lp = (GET_LAYER(map, iLayerIndex));
 
@@ -956,7 +955,19 @@
 	}
     }
     else
-      szExpression = FLTGetNodeExpression(psNode);
+    {
+        szExpression = FLTGetNodeExpression(psNode);
+        /*if there is a filter item set it (this is only for propertislike with 
+          non db layers*/
+        pszFilterItem = FLTGetMapserverExpressionClassItem(psNode);
+        if (pszFilterItem)
+        {
+            if (lp->filteritem)
+              free (lp->filteritem);
+            lp->filteritem = strdup(pszFilterItem);
+        }
+    }
+   
 
     if (szExpression)
     {
@@ -983,21 +994,22 @@
 	if(lp->filter.string && lp->filter.type == MS_EXPRESSION)
 	  pszBuffer = msStringConcatenate(pszBuffer, ")");
         
+        
         msLoadExpressionString(&lp->filter, pszBuffer);
         free(szExpression);
     }
 
-    msErr = msQueryByRect(map, lp->index, sQueryRect);
+    msQueryByRect(map, lp->index, sQueryRect);
 
     if (pszBuffer)
       free(pszBuffer);
 
-    return msErr;
+    return MS_SUCCESS;
 }
 
 int FLTIsSimpleFilter(FilterEncodingNode *psNode)
 {
-    if (FLTValidForBBoxFilter(psNode))
+  if (FLTValidForBBoxFilter(psNode) && FLTValidForPropertyIsLikeFilter(psNode))
     {
         if (FLTNumberOfFilterType(psNode, "DWithin") == 0 &&
             FLTNumberOfFilterType(psNode, "Intersect") == 0 &&
@@ -2209,9 +2221,9 @@
     
 
 /************************************************************************/
-/*                      FLTValidForPropertyIsLikeFilter                 */
+/*                     FLTValidForPropertyIsLikeFilter                  */
 /*                                                                      */
-/*      Valdate if there is only one ProperyIsLike Filter.              */
+/*      Check if there is only none or one PropertyIsLikeFilter.        */
 /************************************************************************/
 int FLTValidForPropertyIsLikeFilter(FilterEncodingNode *psFilterNode)
 {
@@ -2222,23 +2234,17 @@
 
     nCount = FLTNumberOfFilterType(psFilterNode, "PropertyIsLike");
 
+    if (nCount == 0)
+       return 1;
+
     if (nCount > 1)
       return 0;
-    else if (nCount == 0)
+
+    /*make sure that if there is properyisequal, it is the only one*/
+    if (psFilterNode->psLeftNode == NULL && psFilterNode->psRightNode == NULL)
       return 1;
-    
-    /* nCount ==1  */
-    if (strcasecmp(psFilterNode->pszValue, "PropertyIsLike") == 0)
-      return 1;
 
-    /*    if (strcasecmp(psFilterNode->pszValue, "OR") == 0)
-    {
-        if (strcasecmp(psFilterNode->psLeftNode->pszValue, "PropertyIsLike") ==0 ||
-            strcasecmp(psFilterNode->psRightNode->pszValue, "PropertyIsLike") ==0)
-          return 1;
-    }
-    */
-    return 1;
+    return 0;
 }
 
 int FLTIsPropertyIsLikeFilter(FilterEncodingNode *psFilterNode)



More information about the mapserver-commits mailing list