From: | Jeremy Buchmann <jeremy(at)wellsgaming(dot)com> |
---|---|
To: | Zachary Beane <xach(at)xach(dot)com>, <pgsql-interfaces(at)postgresql(dot)org> |
Subject: | Re: DBD::Pg or DBI breakage? |
Date: | 2001-05-24 15:32:54 |
Message-ID: | B73277B6.2EB5%jeremy@wellsgaming.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
> I've been having trouble getting the proper value of $handle->errstr
> or $DBI::errstr. For some reason, it's always giving the scalar 7 back
> rather than an informative error message. Here's an script and output:
>
> --- foo.pl ---
> #!/usr/bin/perl
>
> use DBI;
> my $dbh = DBI->connect("dbi:Pg:dbname=template1", "xach", undef);
>
> my $sql = "bogus sql goes here";
> my $sth = $dbh->prepare($sql);
> $sth->execute() or die $sth->errstr;
>
> my ($result) = $sth->fetchrow_array();
>
> $sth->finish;
>
> print $result, "\n";
> $dbh->disconnect();
> --- end ---
>
> When run, it prints out this:
>
> $ perl foo.pl
> DBD::Pg::st execute failed: at foo.pl line 8.
> 7 at foo.pl line 8.
> Database handle destroyed without explicit disconnect.
>
> Now, I'm not surprised at the "database handle destroyed..." part, but
> I can't figure out why i'm getting "7 at foo.pl" and a blank message
> in the execute failed string. Any ideas?
Try disabling automatic error checking...after the call to DBI->connect, do
this:
$dbh->{PrintError} = 0;
-- Jeremy [jeremy(at)wellsgaming(dot)com]
From | Date | Subject | |
---|---|---|---|
Next Message | Iassen Hristov | 2001-05-24 16:45:48 | dbExpress driver for PostgreSQL |
Previous Message | Manuel SEDANO | 2001-05-24 08:29:16 | NONE |