Re: [CDBI] processing mysql errors

[prev] [thread] [next] [Date index for 2005/08/25]

From: Dave Howorth
Subject: Re: [CDBI] processing mysql errors
Date: 11:49 on 25 Aug 2005
Matt S Trout wrote:
> On Thu, Aug 25, 2005 at 12:02:20PM +0100, Dave Howorth wrote:
> 
>>I'd like to do some processing of MySQL database errors, either to 
>>recover from the condition or to display a more meaningful message to a 
>>user. I haven't looked into this topic before so I wondered what the 
>>prior art is and whether there are any CPAN modules that might help with 
>>this? I'd be grateful for any pointers :)
> 
> 
> $dbh->err and $dbh->errstr are probably your friends here, as is overriding
> sub _croak in your Class::DBI class to do something different with error
> strings there.
> 
> There may also be MySQL specific stuff you can do, but you're probably better
> reading the DBD docs for that.

Hi Matt,

Thanks for this. Yes DBD::mysql makes some attributes available, 
including mysql_errno and mysql_error. I believe these are propagated up 
through DBI and Class::DBI. But the detailed information, which users 
want and which my attempt at automatic recovery needs, is buried in the 
MySQL mysql_error string, AFAIK. So it seems like I need to parse that 
and I can't believe I'm the first to want to do it :)

Cheers, Dave


_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

[CDBI] processing mysql errors
Dave Howorth 11:02 on 25 Aug 2005

Re: [CDBI] processing mysql errors
Matt S Trout 11:21 on 25 Aug 2005

Re: [CDBI] processing mysql errors
David Baird 11:37 on 25 Aug 2005

Re: [CDBI] processing mysql errors
Dave Howorth 11:49 on 25 Aug 2005

Re: [CDBI] processing mysql errors
Matt S Trout 13:01 on 25 Aug 2005

Re: [CDBI] processing mysql errors
Brad Bowman 04:42 on 05 Sep 2005

Re: [CDBI] processing mysql errors
Dave Howorth 09:37 on 06 Sep 2005

Generated at 16:14 on 20 Sep 2005 by mariachi v0.52