[mapserver-commits] r9312 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Tue Sep 15 18:34:47 EDT 2009


Author: pramsey
Date: 2009-09-15 18:34:46 -0400 (Tue, 15 Sep 2009)
New Revision: 9312

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mappostgis.c
Log:
Fix problem with overflowing shape->index for (most) query modes (#2850)



Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2009-09-15 22:12:28 UTC (rev 9311)
+++ trunk/mapserver/HISTORY.TXT	2009-09-15 22:34:46 UTC (rev 9312)
@@ -14,6 +14,8 @@
 Current Version (SVN trunk):
 ----------------------------
 
+- Fix problem with overflowing shape->index for (most) query modes (#2850)
+
 - Useful error message when PK is missing and data is subselect (#3124)
 
 - Add WMS root Layer metadata support (#3121)

Modified: trunk/mapserver/mappostgis.c
===================================================================
--- trunk/mapserver/mappostgis.c	2009-09-15 22:12:28 UTC (rev 9311)
+++ trunk/mapserver/mappostgis.c	2009-09-15 22:34:46 UTC (rev 9312)
@@ -1402,9 +1402,14 @@
             else {
                 uid = 0;
             }
-
+            if( layer->debug > 4 ) {
+                msDebug("msPostGISReadShape: Setting shape->index = %d\n", uid);
+            }
             shape->index = uid;
         } else {
+            if( layer->debug > 4 ) {
+                msDebug("msPostGISReadShape: Setting shape->index = %d\n", layerinfo->rownum);
+            }
             shape->index = layerinfo->rownum;
         }
 
@@ -1771,8 +1776,8 @@
     while (shape->type == MS_SHAPE_NULL) {
         if (layerinfo->rownum < PQntuples(layerinfo->pgresult)) {
             int rv;
-            /* Retrieve this shape, random access mode. */
-            rv = msPostGISReadShape(layer, shape, 1);
+            /* Retrieve this shape, cursor access mode. */
+            rv = msPostGISReadShape(layer, shape, 0);
             if( shape->type != MS_SHAPE_NULL ) {
                 (layerinfo->rownum)++; /* move to next shape */
                 return MS_SUCCESS;
@@ -1840,7 +1845,7 @@
 
     /* Check the validity of the requested record number. */
     if( record >= PQntuples(pgresult) ) {
-        msDebug("msPostGISLayerResultsGetShape got record request (%d) but only has %d tuples", record, PQntuples(pgresult));
+        msDebug("msPostGISLayerResultsGetShape got record request (%d) but only has %d tuples.\n", record, PQntuples(pgresult));
         msSetError( MS_MISCERR,
                     "Got request larger than result set.",
                     "msPostGISLayerResultsGetShape()");
@@ -1852,7 +1857,7 @@
     /* We don't know the shape type until we read the geometry. */
     shape->type = MS_SHAPE_NULL;
 
-	/* Return the shape, result set mode. */
+	/* Return the shape, cursor access mode. */
     result = msPostGISReadShape(layer, shape, 0);
 
     return (shape->type == MS_SHAPE_NULL) ? MS_FAILURE : MS_SUCCESS;



More information about the mapserver-commits mailing list