Re: bind_param() with geometric datatypes

"Greg Sabino Mullane" <greg-738XdyZ4GzZWk0Htik3J/[email protected]>
Newsgroups gmane.comp.db.postgresql.dbdpg
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


> Is there anyway to use bind_param() with geometric data types,
> specifically the box? I have a PL/pgSQL function call that would most
> efficiently be called with placeholders (I'll be inserting thousands at
> a time), but I noticed in Pg.pm that geometric types are not supported.
> Any suggestions?

Sorry for the late response. If you are using a fairly recent version
of DBD::Pg, you should be able to simply not use bind_param at all
and it will still work (because simple string quoting rules should work on
all geometric input). I've also just added explicit support for
gemoetric types to DBD::Pg, and you will be able to use them in the next
version (1.49) like this:

use DBD::Pg qw(:pg_types);

my $gdata = $dbh->quote('12,34', { pg_type => PG_POINT });

my $cdata = $dbh->quote('<12,34,56>', { pg_type => PG_CIRCLE });

$sth->bind_param(1,'[(1,2),(3,4)]', { pg_type => PG_PATH });

$sth->bind_param(1,'(1,2),(3,4)', { pg_type => PG_BOX });

The full list is:
PG_POINT PG_LINE PG_LSEG PG_BOX PG_PATH PG_POLYGON PG_CIRCLE

Anyone using geometric data types, please take the cvs version for a
spin (or 1.49 when it comes out), and let this list know of any problems
or suggestions. Thanks.

- --
Greg Sabino Mullane greg-738XdyZ4GzZWk0Htik3J/[email protected]
PGP Key: 0x14964AC8 200604091619
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8

-----BEGIN PGP SIGNATURE-----

iD8DBQFEOWy9vJuQZxSWSsgRAqwxAJ9tVk2RXKFSEsH7+JjH6KzzcZMV2ACdECcU
whK2cqTZVF7oEhaTL/Ee+Jg=
=uRBX
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.