Thank you Steve et al.  That worked perfectly.<br><br>I did have some trouble with the single quotes when substituting 'POINT(1 1)' with variables. However the following works, if anyone else ever needs to know:<br>
<br> $sth = $dbh->prepare("INSERT INTO table (gid, the_geom)  VALUES (?, GeomFromText(?, 4326))");<br><br>$some_geometry = "POINT(1 1)";<br><br>$sth->execute(1, $some_geometry);<br><br>The single quotes are all sorted by DBI.<br>
<br>Cheers,<br>Stuart<br><br><br><br><br><div class="gmail_quote">On Sat, Jun 12, 2010 at 1:03 PM, P Kishor <span dir="ltr"><<a href="mailto:punk.kish@gmail.com">punk.kish@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">On Fri, Jun 11, 2010 at 11:48 PM, Stephen Woodbridge<br>
<<a href="mailto:woodbri@swoodbridge.com">woodbri@swoodbridge.com</a>> wrote:<br>
> Stuart Gralton wrote:<br>
>><br>
>> Hello Everybody,<br>
>><br>
>> Is it possible to use Perl DBI placeholders to insert a geometry into a<br>
>> table using GeomFromText.<br>
>><br>
>> When I try the following;<br>
>><br>
>>     $sth = $dbh->prepare("INSERT INTO table (gid, the_geom) VALUES<br>
>> (?,?)");<br>
>>     $sth->execute(1, GeomFromText('POINT(1 1)', 4326));<br>
><br>
> You might try something like this.<br>
><br>
>      $sth = $dbh->prepare("INSERT INTO table (gid, the_geom)<br>
>                            VALUES (?, GeomFromText(?, 4326))");<br>
>      $sth->execute(1, 'POINT(1 1)');<br>
><br>
> I'm not sure it is valid to pass arbitrary SQL via a place holder.<br>
> GeomFromText() is a function and not a variable.<br>
><br>
<br>
<br>
</div>Steve is correct. I just tested his suggested syntax, and it works.<br>
<div class="im"><br>
<br>
> -Steve<br>
><br>
>><br>
>> an error is produced:<br>
>><br>
>>     ERROR:  parse error - invalid geometry<br>
>>     HINT:  You must specify a valid OGC WKT geometry type such as POINT,<br>
>> LINESTRING or POLYGON<br>
>><br>
>> The following statement works fine:<br>
>><br>
>>     INSERT INTO table (gid, the_geom) VALUES (1, GeomFromText('POINT(1<br>
>> 1)', 4326));<br>
>><br>
>><br>
>> I am not entirely sure if this is more of a DBI question or a POSTGIS<br>
>> question, but maybe someone can help?<br>
>><br>
>> Thanks,<br>
>><br>
>> Stuart<br>
>><br>
>><br>
>> ------------------------------------------------------------------------<br>
>><br>
>> _______________________________________________<br>
>> postgis-users mailing list<br>
>> <a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
>> <a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
><br>
> _______________________________________________<br>
> postgis-users mailing list<br>
> <a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
> <a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
><br>
<br>
<br>
<br>
</div><div class="im">--<br>
Puneet Kishor <a href="http://www.punkish.org" target="_blank">http://www.punkish.org</a><br>
Carbon Model <a href="http://carbonmodel.org" target="_blank">http://carbonmodel.org</a><br>
Charter Member, Open Source Geospatial Foundation <a href="http://www.osgeo.org" target="_blank">http://www.osgeo.org</a><br>
Science Commons Fellow, <a href="http://sciencecommons.org/about/whoweare/kishor" target="_blank">http://sciencecommons.org/about/whoweare/kishor</a><br>
Nelson Institute, UW-Madison <a href="http://www.nelson.wisc.edu" target="_blank">http://www.nelson.wisc.edu</a><br>
-----------------------------------------------------------------------<br>
Assertions are politics; backing up assertions with evidence is science<br>
=======================================================================<br>
_______________________________________________<br>
</div><div><div></div><div class="h5">postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
</div></div></blockquote></div><br>