[mapserver-commits] r8758 - sandbox/single-pass/mapserver

svn at osgeo.org svn at osgeo.org
Tue Mar 10 09:39:35 EDT 2009


Author: sdlime
Date: 2009-03-10 09:39:35 -0400 (Tue, 10 Mar 2009)
New Revision: 8758

Modified:
   sandbox/single-pass/mapserver/mapgml.c
   sandbox/single-pass/mapserver/mapquery.c
Log:
Applied RFC 52 changes to all query types and the WFS GML driver.

Modified: sandbox/single-pass/mapserver/mapgml.c
===================================================================
--- sandbox/single-pass/mapserver/mapgml.c	2009-03-10 13:38:43 UTC (rev 8757)
+++ sandbox/single-pass/mapserver/mapgml.c	2009-03-10 13:39:35 UTC (rev 8758)
@@ -1262,12 +1262,12 @@
       msFree(value);
 
       /* actually open the layer */
-      status = msLayerOpen(lp);
-      if(status != MS_SUCCESS) return(status);
+      // status = msLayerOpen(lp);
+      // if(status != MS_SUCCESS) return(status);
 
       /* retrieve all the item names */
-      status = msLayerGetItems(lp);
-      if(status != MS_SUCCESS) return(status);
+      // status = msLayerGetItems(lp);
+      // if(status != MS_SUCCESS) return(status);
 
       /* populate item and group metadata structures (TODO: test for NULLs here, shouldn't happen) */
       itemList = msGMLGetItems(lp, "G");
@@ -1275,6 +1275,7 @@
       groupList = msGMLGetGroups(lp, "G");      
       geometryList = msGMLGetGeometries(lp, "G");
 
+      msLayerRewind(lp);
       for(j=0; j<lp->resultcache->numresults; j++) {
         status = msLayerGetShape(lp, &shape, lp->resultcache->results[j].tileindex, lp->resultcache->results[j].shapeindex);
         if(status != MS_SUCCESS) return(status);

Modified: sandbox/single-pass/mapserver/mapquery.c
===================================================================
--- sandbox/single-pass/mapserver/mapquery.c	2009-03-10 13:38:43 UTC (rev 8757)
+++ sandbox/single-pass/mapserver/mapquery.c	2009-03-10 13:39:35 UTC (rev 8758)
@@ -219,8 +219,8 @@
   status = msLayerOpen(lp);
   if(status != MS_SUCCESS) return(MS_FAILURE);
 
-  /* build item list (no annotation) since we do have to classify the shape */
-  status = msLayerWhichItems(lp, MS_TRUE, MS_FALSE, NULL);
+  /* need all the items */
+  status = msLayerWhichItemsNew(lp, MS_TRUE, MS_TRUE, MS_TRUE, NULL);
   if(status != MS_SUCCESS) return(MS_FAILURE);
 
   if(!addtoquery || lp->resultcache == NULL) {
@@ -253,7 +253,7 @@
     msMergeRect(&(lp->resultcache->bounds), &shape.bounds);
 
   msFreeShape(&shape);
-  msLayerClose(lp);
+  // msLayerClose(lp);
 
   return(MS_SUCCESS);
 }
@@ -337,8 +337,8 @@
   status = msLayerOpen(lp);
   if(status != MS_SUCCESS) return(MS_FAILURE);
   
-  /* build item list (no annotation) */
-  status = msLayerWhichItems(lp, MS_TRUE, MS_FALSE, NULL);
+  /* need all the items */
+  status = msLayerWhichItemsNew(lp, MS_TRUE, MS_TRUE, MS_TRUE, NULL);
   if(status != MS_SUCCESS) return(MS_FAILURE);
 
   /* identify target shapes */
@@ -420,12 +420,12 @@
     }
   }
 
+  /* Was anything found? If so, don't close the layer. */
+  if(lp->resultcache && lp->resultcache->numresults > 0)
+    return(MS_SUCCESS);
+
   msLayerClose(lp);
 
-  /* was anything found?  */
-  if(lp->resultcache && lp->resultcache->numresults > 0)
-    return(MS_SUCCESS);
- 
   msSetError(MS_NOTFOUND, "No matching record(s) found.", "msQueryByAttributes()"); 
   return(MS_FAILURE);
 }
@@ -489,7 +489,7 @@
     if(status != MS_SUCCESS) return(MS_FAILURE);
 
     /* build item list, we need all items */
-    status = msLayerWhichItemsNew(lp, MS_TRUE, MS_FALSE, MS_TRUE, NULL);
+    status = msLayerWhichItemsNew(lp, MS_TRUE, MS_TRUE, MS_TRUE, NULL);
     if(status != MS_SUCCESS) return(MS_FAILURE);
 
     /* identify target shapes */
@@ -502,7 +502,7 @@
 #endif
     status = msLayerWhichShapes(lp, searchrect);
     if(status == MS_DONE) { /* no overlap */
-      msLayerClose(lp);
+      msLayerClose(lp); /* Ok to close here, no results... */
       continue;
     } else if(status != MS_SUCCESS) {
       msLayerClose(lp);
@@ -677,8 +677,8 @@
     status = msLayerOpen(lp);
     if(status != MS_SUCCESS) return(MS_FAILURE);
     
-    /* build item list (no annotation) */
-    status = msLayerWhichItems(lp, MS_TRUE, MS_FALSE, NULL);
+    /* we need all items */
+    status = msLayerWhichItemsNew(lp, MS_TRUE, MS_TRUE, MS_TRUE, NULL);
     if(status != MS_SUCCESS) return(MS_FAILURE);
     
     /* for each selection shape (TODO: use cached features if they exist) */
@@ -845,12 +845,11 @@
       msFreeShape(&selectshape);
     } /* next selection shape */
 
-    msLayerClose(lp);
+    // TODO: check to see if any results were found, if not then close...
+    // msLayerClose(lp);
   } /* next layer */
 
-  msLayerClose(slp);
-
-  /* was anything found? */
+  /* Was anything found? If so then don't close the layer. */
   for(l=start; l>=stop; l--) {  
     if(l == slayer) continue; /* skip the selection layer */
 
@@ -858,6 +857,8 @@
       return(MS_SUCCESS);
   }
 
+  msLayerClose(slp);
+
   msSetError(MS_NOTFOUND, "No matching record(s) found.", "msQueryByFeatures()"); 
   return(MS_FAILURE);
 }
@@ -956,8 +957,8 @@
     status = msLayerOpen(lp);
     if(status != MS_SUCCESS) return(MS_FAILURE);
 
-    /* build item list (no annotation) */
-    status = msLayerWhichItems(lp, MS_TRUE, MS_FALSE, NULL);
+    /* build item list, need all of them */
+    status = msLayerWhichItemsNew(lp, MS_TRUE, MS_TRUE, MS_TRUE, NULL);
     if(status != MS_SUCCESS) return(MS_FAILURE);
 
     /* identify target shapes */
@@ -1032,7 +1033,7 @@
 
     if(status != MS_DONE) return(MS_FAILURE);
 
-    msLayerClose(lp);
+    // msLayerClose(lp);
 
     if((lp->resultcache->numresults > 0) && (mode == MS_SINGLE) && (maxresults == 0)) 
       break;   /* no need to search any further */
@@ -1131,8 +1132,8 @@
     status = msLayerOpen(lp);
     if(status != MS_SUCCESS) return(MS_FAILURE);
 
-    /* build item list (no annotation) */
-    status = msLayerWhichItems(lp, MS_TRUE, MS_FALSE, NULL);
+    /* build item list, need all of them */
+    status = msLayerWhichItemsNew(lp, MS_TRUE, MS_TRUE, MS_TRUE, NULL);
     if(status != MS_SUCCESS) return(MS_FAILURE);
 
     /* identify target shapes */
@@ -1225,7 +1226,8 @@
 
     if(status != MS_DONE) return(MS_FAILURE);
 
-    msLayerClose(lp);
+    if(GET_LAYER(map, l)->resultcache->numresults == 0) 
+      msLayerClose(lp); /* no need to hold anything open */
   } /* next layer */
 
   /* was anything found? */
@@ -1321,8 +1323,8 @@
       status = msLayerOpen(lp);
       if(status != MS_SUCCESS) return(MS_FAILURE);
 
-      /* build item list (no annotation) */
-      status = msLayerWhichItems(lp, MS_TRUE, MS_FALSE, NULL);
+      /* build item list, need all of them */
+      status = msLayerWhichItemsNew(lp, MS_TRUE, MS_TRUE, MS_TRUE, NULL);
       if(status != MS_SUCCESS) return(MS_FAILURE);
 
 /* identify target shapes */
@@ -1456,7 +1458,8 @@
 
       if(status != MS_DONE) return(MS_FAILURE);
 
-      msLayerClose(lp);
+      if(GET_LAYER(map, l)->resultcache->numresults == 0)
+        msLayerClose(lp); /* no need to hold anything open */
     } /* next layer */
 
     /*todo call should be moved somewhere else*/
@@ -1468,7 +1471,6 @@
         return(MS_SUCCESS);
     }
 
- 
     msSetError(MS_NOTFOUND, "No matching record(s) found.", "msQueryByOperator()"); 
     return(MS_FAILURE);
 #else



More information about the mapserver-commits mailing list