[mapserver-users] Fwd: POSTGIS/Mapscript DB connection is not closing
Steve Lime
steve.lime@dnr.state.mn.us
Mon, 04 Feb 2002 14:17:09 -0600
This is a MIME message. If you are reading this text, you may want to
consider changing to a mail reader or gateway that understands how to
properly handle MIME multipart messages.
--=_A6FBC940.8CED80AA
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Stephen Lime
Data & Applications Manager
Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155
651-297-2937
--=_A6FBC940.8CED80AA
Content-Type: message/rfc822
Received: from mail.state.mn.us
(state.mn.us [156.99.125.109])
by co5.dnr.state.mn.us; Mon, 04 Feb 2002 14:16:16 -0600
Return-Path: <jeffloun@refractions.net>
Received: from lists.gis.umn.edu by mail.state.mn.us with ESMTP for steve.lime@dnr.state.mn.us; Mon, 4 Feb 2002 14:15:53 -0600
Received: from lion.animals ([24.65.184.181])
by lists.gis.umn.edu (8.9.3+Sun/8.9.1) with ESMTP id OAA04424
for <mapserver-info@lists.gis.umn.edu>; Mon, 4 Feb 2002 14:17:00 -0600 (CST)
Received: from refractions.net (pigeon [192.168.50.11])
by lion.animals (Postfix) with ESMTP id 36D7F10286A
for <mapserver-info@lists.gis.umn.edu>; Mon, 4 Feb 2002 12:15:06 -0800 (PST)
Message-Id: <3C5EECC8.D38EB134@refractions.net>
Date: Mon, 04 Feb 2002 12:19:20 -0800
From: jeff lounsbury <jeffloun@refractions.net>
X-Mailer: Mozilla 4.76 [en] (WinNT; U)
X-Accept-Language: en
To: mapserver-info@lists.gis.umn.edu
Subject: POSTGIS/Mapscript DB connection is not closing
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
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
--=_A6FBC940.8CED80AA--