[mapserver-commits] r9593 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Mon Dec 7 14:26:09 EST 2009


Author: assefa
Date: 2009-12-07 14:26:09 -0500 (Mon, 07 Dec 2009)
New Revision: 9593

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/maporaclespatial.c
Log:
Mapserver WFS should send maxfeatures to the spatial database (#2605)

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2009-12-07 18:55:50 UTC (rev 9592)
+++ trunk/mapserver/HISTORY.TXT	2009-12-07 19:26:09 UTC (rev 9593)
@@ -14,6 +14,8 @@
 Current Version (SVN trunk):
 ----------------------------
 
+- Mapserver WFS should send maxfeatures to the spatial database (#2605)
+
 - WFS paging support (#2799)
 
 - Fixed joins do not accept crypted passwords (#2912)

Modified: trunk/mapserver/maporaclespatial.c
===================================================================
--- trunk/mapserver/maporaclespatial.c	2009-12-07 18:55:50 UTC (rev 9592)
+++ trunk/mapserver/maporaclespatial.c	2009-12-07 19:26:09 UTC (rev 9593)
@@ -1021,7 +1021,20 @@
 
     osFilteritem(layer, FUNCTION_NONE, query_str2, 1);
 
+    if (layer->maxfeatures > 0)
+    {
+        if(layer->filter.string != NULL)
+           sprintf (query_str2 + strlen(query_str2), " AND ");
+        else
+           sprintf (query_str2 + strlen(query_str2), " WHERE ");
+
+        sprintf( query_str2 + strlen(query_str2), " ROWNUM <= %d ", layer->maxfeatures);
+    }
+
     sprintf( query_str, "SELECT SDO_AGGR_MBR(%s) AS GEOM from %s)", geom_column_name, query_str2);
+
+     if (layer->debug)
+       msDebug("osAggrGetExtent was called: %s.\n", query_str);
 }
 
 static void osConvexHullGetExtent(layerObj *layer, char *query_str, char *geom_column_name, char *table_name)
@@ -1036,7 +1049,17 @@
     sprintf( query_str2 + strlen(query_str2), " %s FROM %s", geom_column_name, table_name);
 
     osFilteritem(layer, FUNCTION_NONE, query_str2, 1);
+    if (layer->maxfeatures > 0)
+    {
+        if(layer->filter.string != NULL)
+           sprintf (query_str2 + strlen(query_str2), " AND ");
+        else
+          sprintf (query_str2 + strlen(query_str2), " WHERE ");
 
+        sprintf( query_str2 + strlen(query_str2), " ROWNUM <= %d ", layer->maxfeatures);
+            
+    }
+    
     sprintf( query_str, "SELECT SDO_GEOM.SDO_CONVEXHULL(%s, %f) AS GEOM from %s)", geom_column_name, TOLERANCE, query_str2);
 }
 
@@ -1984,6 +2007,14 @@
 
     osFilteritem(layer, function, query_str, 1);
 
+    if (layer->maxfeatures > 0)
+    {
+        sprintf( query_str + strlen(query_str), " ROWNUM<=%d ", layer->maxfeatures);
+        if (function != FUNCTION_NONE)
+          sprintf (query_str + strlen(query_str), " AND ");
+      
+    }
+
     if ((((atol(srid) >= 8192) && (atol(srid) <= 8330)) || (atol(srid) == 2) || (atol(srid) == 5242888) || (atol(srid) == 2000001)) && (version == VERSION_9i))
         osGeodeticData(function, version, query_str, geom_column_name, srid, rect);
     else
@@ -2635,6 +2666,15 @@
         sprintf( query_str + strlen(query_str), " AND %s", (layer->filter.string));*/
     osFilteritem(layer, FUNCTION_NONE, query_str, 2);
 
+    if (layer->maxfeatures > 0)
+    {
+        if(layer->filter.string != NULL)
+           sprintf (query_str + strlen(query_str), " AND ");
+        else
+           sprintf (query_str + strlen(query_str), " WHERE ");
+
+        sprintf( query_str + strlen(query_str), " ROWNUM<=%d ", layer->maxfeatures);
+    }
     if (layer->debug)
       msDebug("msOracleSpatialLayerGetShape. Sql: %s\n", query_str);
 



More information about the mapserver-commits mailing list