I tried this using DBI 1.21, DBD::Pg 1.12, Postgresql 7.2 on winnt, newest
cygwin. No core dump, but I did get a set of 'unprintable' characters from
foreach (@{ $sth->{pg_type} }) {
 print"$_\n";
}
Later in the same script with another statement handle querying another
table (no numeric columns) the above idiom works fine. I suspect the
'unprintable' characters (approximately 62 line worth) may be an enumeration
of available pg_type s, but if anyone has more information (or can point me
to it) I'd appreciate the help
David
"Jeff Boes" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I've encountered a problem with the statement handle's pg_type
> attribute, under DBI 1.21 and DBD::Pg 1.12.
>
> Assuming a table that looks like this:
>
> CREATE TABLE foo ( bar numeric(2,1) );
>
>
> My script looks like this:
>
> use strict;
> use English;
>
> use DBI;
>
> my $dbh = DBI->connect('dbi:Pg:dbname=...','...','...')
>   or die $DBI::errstr;
>
> my $sth = $dbh->prepare('SELECT * FROM foo WHERE FALSE')
>   or die $DBI::errstr;
>
> $sth->execute
>   or die $DBI::errstr;
>
> my @types = @{ $sth->{pg_type} };
> foreach my $i (0..$sth->{NUM_OF_FIELDS}-1) {
>   print $types[$i], "\n";
>   print $sth->{pg_type}[$i], "\n";
> }
>
> If you run this, you'll get some unprintable output from the first print
> statement, and the second print causes a segmentation fault.
>
> --
> Jeff Boes                                      vox 616.226.9550 ext 24
> Database Engineer                                     fax 616.349.9076
> Nexcerpt, Inc.                                 http://www.nexcerpt.com
>            ...Nexcerpt... Extend your Expertise
>


Reply via email to