<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<TITLE>Message</TITLE>

<META content="MSHTML 6.00.2737.800" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2>
<P class=MsoNormal 
style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><FONT 
face="Times New Roman" size=3>I’m executing the following Postgis <SPAN 
class=905040716-30072004>DISTANCE function </SPAN>and if I select the spatial 
object within the distance<SPAN class=905040716-30072004> 
boundary</SPAN> the command works fine, but I get the following error 
message in the Postgresql log:</FONT></P>
<P class=MsoNormal 
style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN 
style="mso-tab-count: 1"><FONT face="Times New Roman" 
size=3>            
</FONT></SPAN><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">ERROR:<SPAN 
style="mso-spacerun: yes">  </SPAN>cursor "mycursor" does not 
exist<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" 
/><o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> <o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" 
size=3>When I select the spatial object out side the command fails and I get the 
following in the Postgresql log file.</FONT></P>
<P class=MsoNormal 
style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; mso-layout-grid-align: none"><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">ERROR:<SPAN 
style="mso-spacerun: yes">  </SPAN>syntax error at or near ")" at character 
144<o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; mso-layout-grid-align: none"><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">LOG:<SPAN 
style="mso-spacerun: yes">  </SPAN>could not send data to client: 
Connection reset by peer<o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; mso-layout-grid-align: none"><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">LOG:<SPAN 
style="mso-spacerun: yes">  </SPAN>could not send data to client: Broken 
pipe<o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; mso-layout-grid-align: none"><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">LOG: <SPAN 
style="mso-spacerun: yes"> </SPAN>unexpected EOF on client 
connection<o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">The Apache log gives 
me:<o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN 
style="mso-tab-count: 1">      </SPAN>Premature end of 
script headers:<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT size=3><FONT 
face="Times New Roman"> <o:p></o:p></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT size=3><FONT 
face="Times New Roman">If <SPAN style="mso-spacerun: yes"> </SPAN>I copy 
either SQLcommand<SPAN style="mso-spacerun: yes">  </SPAN>and execute it in 
psql it runs fine. With no error messages in the postgresql log file. <SPAN 
style="mso-spacerun: yes"> </SPAN></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT size=3><FONT 
face="Times New Roman"> <o:p></o:p></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" 
size=3>Below is the code snippet</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" 
size=3>++++++++++++++++++++++++++++++++++++++++</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">$SQLcommand=qq(</SPAN><FONT 
face="Times New Roman" size=3>SELECT layer, ncpin, mapsheet, ownername, addr1, 
addr2, addr3, city, state, zip, book, page, value, acreage, pflag, revalue, 
market<SPAN style="mso-spacerun: yes">  </SPAN>FROM<SPAN 
style="mso-spacerun: yes">  </SPAN>jccondo WHERE the_geom && 
GeometryFromText('BOX3D(2103178.38307993 558215.2516,2173267.36692007 
611928.4437)',1) AND Distance(GeometryFromText('POINT(2170383.04659743 
579103.715194444)',1),the_geom) < 1401.77967680279);</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT size=3><FONT 
face="Times New Roman"> <o:p></o:p></FONT></FONT></P>
<P class=MsoNormal 
style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">my $stmt = 
$dbh->prepare($SQLcommand) ||<SPAN style="mso-spacerun: yes">  
</SPAN>&AppletMsg("The table name doesn't exist or one of the attrribute 
names are not valid... $GisDataSrc","error");<o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN 
style="mso-tab-count: 1">      
</SPAN><o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">$stmt->execute() or<SPAN 
style="mso-spacerun: yes">  </SPAN>&AppletMsg("Can't execute select 
items on $GisDataSrc - $DBI::errstr ","error");<o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> <o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">$colctr=1;<o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN 
style="mso-tab-count: 1">      
</SPAN><o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">while (@tname = 
($stmt->fetchrow_array())) {<o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN 
style="mso-tab-count: 1">      </SPAN>foreach $value 
(@tname) {<o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> <o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN 
style="mso-tab-count: 1">      </SPAN><SPAN 
style="mso-tab-count: 1">      </SPAN>if<SPAN 
style="mso-spacerun: yes">  </SPAN>($colctr == $NumAttrItems+1 
){<o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN 
style="mso-tab-count: 2">            
</SPAN><SPAN style="mso-tab-count: 1">      
</SPAN>$ItemNum++;<o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN 
style="mso-tab-count: 2">            
</SPAN><SPAN style="mso-tab-count: 1">      
</SPAN>$colctr=1;<o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN 
style="mso-tab-count: 1">      </SPAN><SPAN 
style="mso-tab-count: 1">      
</SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN 
style="mso-tab-count: 1">      </SPAN><SPAN 
style="mso-tab-count: 1">      
</SPAN>$QueryResultsmatrix[$ItemNum]->[$colctr]=$value<SPAN 
style="mso-tab-count: 2">       </SPAN><SPAN 
style="mso-tab-count: 2">            </SPAN><SPAN 
style="mso-tab-count: 1">      </SPAN><SPAN 
class=905040716-30072004>     </SPAN></SPAN></P>
<P class=MsoNormal 
style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN 
class=905040716-30072004></SPAN><SPAN 
class=905040716-30072004>            
</SPAN>$colctr++;<o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN 
style="mso-spacerun: yes"> </SPAN><SPAN 
style="mso-tab-count: 1">     </SPAN>}<o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">}<o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> <o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">$stmt->finish();<o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">++++++++++++++++++++++++++++++++++<o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN 
style="mso-tab-count: 1">      
</SPAN><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" 
size=3>If I need to define a cursor, can someone please send an example or edit 
my code to define how this may be done using DBI. </FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT size=3><FONT 
face="Times New Roman"> <o:p></o:p></FONT></FONT></P><SPAN 
style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">Thanks 
in advance for your help.</SPAN></FONT></DIV></BODY></HTML>