[ABE.pm] DBI Q

Faber Fedor faber at linuxnj.com
Tue Nov 9 14:22:28 CST 2004


What's the Proper Way to grab an error from a DBI call?  I thought this
would work:

 $dbh->do($stmt);
 snd_msg("failure in LOAD DATA INFILE command. Error: $DBI::errstr")
            if defined($dbh->err);

but that prints an error to STDOUT and dies, i.e. it never reaches
snd_msg().  I tried this:


 $dbh->do($stmt) or
 snd_msg("failure in LOAD DATA INFILE command. Error: $DBI::errstr")
            if defined($dbh->err);

but that printed nothing out (presumably since the return of the do()
was nonzero) and it didn't die.

RaiseError = 0 as well as PrintError.

-- 
 
Regards,
 
Faber                     

Linux New Jersey: Open Source Solutions for New Jersey
http://www.linuxnj.com





More information about the ABE-pm mailing list