| From: | Zachary Beane <xach(at)xach(dot)com> |
|---|---|
| To: | pgsql-interfaces(at)postgresql(dot)org |
| Subject: | DBD::Pg or DBI breakage? |
| Date: | 2001-05-23 20:34:32 |
| Message-ID: | 20010523163432.I18366@xach.com |
| Views: | Whole Thread | Raw Message | 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?
Zach
--
xach(at)xach(dot)com Zachary Beane http://www.xach.com/
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Erny | 2001-05-24 02:46:07 | Pygresql importing of largeobjects with loimport |
| Previous Message | Hans-Jürgen Schönig | 2001-05-23 14:19:03 | ECPG error: break statement not within loop or switch |