Received: from mail.greatbasin.net (mail.greatbasin.net [207.228.35.39]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f4OFX3A94254 for ; Thu, 24 May 2001 11:33:03 -0400 (EDT) (envelope-from jeremy@wellsgaming.com) Received: from [172.16.1.6] (rno-dsl0b-131.gbis.net [216.82.145.131]) by mail.greatbasin.net (8.9.3-MySQL-0.2.3b/8.9.3) with ESMTP id IAA22825; Thu, 24 May 2001 08:32:52 -0700 (PDT) User-Agent: Microsoft-Outlook-Express-Macintosh-Edition/5.02.2022 Date: Thu, 24 May 2001 08:32:54 -0700 Subject: Re: DBD::Pg or DBI breakage? From: Jeremy Buchmann To: Zachary Beane , Message-ID: In-Reply-To: <20010523163432.I18366@xach.com> Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit X-Archive-Number: 200105/101 X-Sequence-Number: 1631 > 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@wellsgaming.com]