[mapserver-users] POSTGIS/Mapscript DB connection is not closing (FWD)

teb teb at mallit.fr.umn.edu
Mon Feb 4 15:15:45 EST 2002


------------- Begin Forwarded Message -------------

Date: Mon, 04 Feb 2002 12:19:20 -0800
From: jeff lounsbury <jeffloun at refractions.net>
X-Accept-Language: en
MIME-Version: 1.0
To: mapserver-info at lists.gis.umn.edu
Subject: POSTGIS/Mapscript DB connection is not closing
Content-Transfer-Encoding: 7bit

After I use mapscript to query my postgis layer in my map, the
postmaster that got run never dies/closes?

Anyone have any idea on why this might be happening?
Hhere is an exerpt of the offending mapscript code...

    //turn the point where the user clicked on the image into a lat/long
co-ordinate
        $pt = ms_newPointObj();
        $lat = get_lat($map->extent->minx, $map->extent->maxx, $img_x,
700);
        $long = get_long($map->extent->miny, $map->extent->maxy, $img_y,
350);
        $pt->setXY($lat, $long);
    //query the postgis layer
        $layer = $map->getLayer(5);
        $err = @$layer->queryByPoint($pt, MS_MULTIPLE, $missby);

        if($err == MS_FAILURE){
          echo "<font size=4 color=red>There were no results found, try
zooming in closer.</font>";
        }else if( $err == MS_SUCCESS){
          $layer->open($img->shapepath);
    //save the query results into an array
          $i=0;
          $result = $layer->getResult($i);
          while($result != FALSE && $i < 5){
            $shape = $layer->getShape($result->tileindex,
$result->shapeindex);
            $value = $shape->values;
            $val[$i] = $value;
            $i++;
            $result =  $layer->getResult($i);
          }
          $results_found =1;
        }
        $layer->close;



As well as the postgid layer in the mapfile:
LAYER
   CONNECTIONTYPE postgis
   NAME "mypostgis"
   DATA "point from usage_points"
   CONNECTION "host=ox user=postgres port=5555 dbname=postgis_usage"
   STATUS DEFAULT
   TYPE POINT
   CLASS
    TEMPLATE query.html
    MINSIZE 10
    SYMBOL star
    COLOR 250 0 25
   END
  END

,thanks
-Jeff


------------- End Forwarded Message -------------





More information about the mapserver-users mailing list