[postgis-users] Using DBI Placeholders for GeomFromText

Stuart Gralton sgralton at gmail.com
Fri Jun 11 21:27:28 PDT 2010


Hello Everybody,

Is it possible to use Perl DBI placeholders to insert a geometry into a
table using GeomFromText.

When I try the following;

     $sth = $dbh->prepare("INSERT INTO table (gid, the_geom) VALUES (?,?)");
     $sth->execute(1, GeomFromText('POINT(1 1)', 4326));

an error is produced:

     ERROR:  parse error - invalid geometry
     HINT:  You must specify a valid OGC WKT geometry type such as POINT,
LINESTRING or POLYGON

The following statement works fine:

     INSERT INTO table (gid, the_geom) VALUES (1, GeomFromText('POINT(1 1)',
4326));


I am not entirely sure if this is more of a DBI question or a POSTGIS
question, but maybe someone can help?

Thanks,

Stuart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20100612/84d0fe41/attachment.html>


More information about the postgis-users mailing list