[mapserver-commits] r10479 - sandbox/sdlime/common-expressions/mapserver

svn at osgeo.org svn at osgeo.org
Thu Aug 26 23:32:49 EDT 2010


Author: sdlime
Date: 2010-08-27 03:32:49 +0000 (Fri, 27 Aug 2010)
New Revision: 10479

Modified:
   sandbox/sdlime/common-expressions/mapserver/mapquery.c
   sandbox/sdlime/common-expressions/mapserver/mapserver.h
Log:
Added a bit of clean-up code to msQueryByFilter() and enabled filter application for drivers that don't support the common syntax.

Modified: sandbox/sdlime/common-expressions/mapserver/mapquery.c
===================================================================
--- sandbox/sdlime/common-expressions/mapserver/mapquery.c	2010-08-26 20:52:26 UTC (rev 10478)
+++ sandbox/sdlime/common-expressions/mapserver/mapquery.c	2010-08-27 03:32:49 UTC (rev 10479)
@@ -784,7 +784,10 @@
     while((status = msLayerNextShape(lp, &shape)) == MS_SUCCESS) { /* step through the shapes */
 
       if(!msLayerSupportsCommonFilters(lp)) { /* we have to apply the filter here instead of within the driver */
-        // TODO!
+	if(msEvalExpression(lp, &shape, map->query.filter, -1) != MS_TRUE) { /* next shape */
+          msFreeShape(&shape);
+	  continue;
+        }
       }
 
       shape.classindex = msShapeGetClass(lp, &shape, map->scaledenom, classgroup, nclasses);
@@ -811,7 +814,8 @@
 
     if(classgroup) msFree(classgroup);
 
-    // restore filter...
+    msCopyExpression(&lp->filter, &old_filter); /* restore old filter */
+    freeExpression(&old_filter);
 
     if(status != MS_DONE) goto query_error;
     if(lp->resultcache->numresults == 0) msLayerClose(lp); /* no need to keep the layer open */
@@ -828,7 +832,8 @@
   return MS_FAILURE;
 
   query_error:
-    // restore filter...
+    msCopyExpression(&lp->filter, &old_filter); /* restore old filter */
+    freeExpression(&old_filter);
     msLayerClose(lp);
     return MS_FAILURE;
 }

Modified: sandbox/sdlime/common-expressions/mapserver/mapserver.h
===================================================================
--- sandbox/sdlime/common-expressions/mapserver/mapserver.h	2010-08-26 20:52:26 UTC (rev 10478)
+++ sandbox/sdlime/common-expressions/mapserver/mapserver.h	2010-08-27 03:32:49 UTC (rev 10479)
@@ -1657,6 +1657,7 @@
 /* Use this next, thread safe wrapper, function everywhere else */
 MS_DLL_EXPORT int msLoadExpressionString(expressionObj *exp, char *value);
 MS_DLL_EXPORT char *msGetExpressionString(expressionObj *exp);
+MS_DLL_EXPORT void initExpression(expressionObj *exp);
 MS_DLL_EXPORT void freeExpression(expressionObj *exp);
 MS_DLL_EXPORT char *msGetExpressionString(expressionObj *exp);
 



More information about the mapserver-commits mailing list