[mapserver-commits] r8767 - sandbox/single-pass/mapserver
svn at osgeo.org
svn at osgeo.org
Tue Mar 10 11:31:51 EDT 2009
Author: pramsey
Date: 2009-03-10 11:31:51 -0400 (Tue, 10 Mar 2009)
New Revision: 8767
Modified:
sandbox/single-pass/mapserver/mappostgis.c
Log:
PostGIS driver now supports new query workload.
Modified: sandbox/single-pass/mapserver/mappostgis.c
===================================================================
--- sandbox/single-pass/mapserver/mappostgis.c 2009-03-10 14:16:49 UTC (rev 8766)
+++ sandbox/single-pass/mapserver/mappostgis.c 2009-03-10 15:31:51 UTC (rev 8767)
@@ -1394,8 +1394,11 @@
uid = 0;
}
- shape->index = uid;
+ shape->index = layerinfo->rownum;
+/* Non one-pass version */
+/* shape->index = uid; */
+
if( layer->debug > 2 ) {
msDebug("msPostGISReadShape: [index] %d\n", shape->index);
}
@@ -1781,8 +1784,10 @@
#ifdef USE_POSTGIS
PGresult *pgresult;
msPostGISLayerInfo *layerinfo;
- int result, num_tuples;
- char *strSQL = 0;
+ int result;
+
+ /*, num_tuples;
+ char *strSQL = 0;*/
assert(layer != NULL);
assert(layer->layerinfo != NULL);
@@ -1791,17 +1796,23 @@
msDebug("msPostGISLayerGetShape called for record = %i\n", record);
}
- /* Fill out layerinfo with our current DATA state. */
- if ( msPostGISParseData(layer) != MS_SUCCESS) {
- return MS_FAILURE;
- }
-
- /*
- ** This comes *after* parsedata, because parsedata fills in
- ** layer->layerinfo.
- */
layerinfo = (msPostGISLayerInfo*) layer->layerinfo;
+ /* TODO test here for valid pgresult */
+ pgresult = layerinfo->pgresult;
+
+ layerinfo->rownum = record; /* Only return one result. */
+
+ /* We don't know the shape type until we read the geometry. */
+ shape->type = MS_SHAPE_NULL;
+
+ /* TODO: trap bad reads (record number doesn't match result set */
+ result = msPostGISReadShape(layer, shape);
+
+ return (shape->type == MS_SHAPE_NULL) ? MS_FAILURE : MS_SUCCESS;
+
+/* This is the old version of the function */
+#if 0
/* Build a SQL query based on our current state. */
strSQL = msPostGISBuildSQL(layer, 0, &record);
if ( ! strSQL ) {
@@ -1850,6 +1861,9 @@
}
return (shape->type == MS_SHAPE_NULL) ? MS_FAILURE : ( (num_tuples > 0) ? MS_SUCCESS : MS_DONE );
+
+#endif
+
#else
msSetError( MS_MISCERR,
"PostGIS support is not available.",
More information about the mapserver-commits
mailing list