Re: [CDBI] processing mysql errors
[prev]
[thread]
[next]
[Date index for 2005/08/25]
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