What exactly are you asking about?  errstr is normally only defined
when an error occurs.

You can force an error:

use warnings;
use strict;
use DBI;
use Carp;

my $dbh = DBI->connect( 'dbi:Pg:dbname=template1', undef, undef,
{PrintError => 0, RaiseError => 0} ) or croak $DBI::errstr;

my $sth = $dbh->prepare( 'select fred from nothing' );

croak $dbh->errstr if ($dbh->err);

$sth->execute;

croak $sth->errstr if ($sth->err);

exit;

END { $dbh->disconnect if defined $dbh }


On Mon, Apr 15, 2002 at 04:18:08AM -0500, GB Clark wrote:
> Any time I call errstr either as a method or variable
> all I get is the err code.  ONE time I did get the right
> string, but for the life of me, I can't figure out why I
> can not get now.
> 
> Any ideas?

-- 
Thomas A. Lowery
See DBI/FAQ http://xmlproj.dyndns.org/cgi-bin/fom

Reply via email to