-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
> What is the accepted way of inserting a binary string into
> a bytea column in perl?
It's pretty much as you described. Here's an example, modified
from the test suite:
use DBD::Pg qw(:pg_types);
...
my $sth = $dbh->prepare(qq{INSERT INTO dbd_pg_test (id,bytetest) VALUES (?,?)});
$sth->bind_param(2, undef, { pg_type => DBD::Pg::PG_BYTEA });
$sth->execute(400, 'aa\\bb\\cc\\\0dd\\');
Other options include storing just a filename, or base-64 encoding
everything and storing it as a text. I tend to prefer the latter
more often than not, as the encode/decode goes very quickly on
most modern computers.
- --
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200603222207
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----
iD8DBQFEIhEBvJuQZxSWSsgRAvAuAKDXEg6i+aykLuDeYpPCYCF+5XosNACfd/hZ
PR8cSm0/9NCJVInn+yEBpsU=
=jfTz
-----END PGP SIGNATURE-----