Dean Arnold wrote:
A few months ago we had discussed on this list _standardizing_ error
handling for things like trying to insert duplicate records, but I kind
of dropped the ball - changing jobs and all didn't leave me enough time
to persue that standardization with members of this list. And since now
I don't use Perl in my new job, I don't have time to persue it at all. Anyone else have time to revisit standardizing error handling for things
like "Trying to insert duplicate record"??? Basically all it involved
was putting together a list of common error conditions and finding the
corresponding ODBC error codes.
Hardy Merrill


Er, isn't that what $h->state() is for ? In *theory*, state (aka SQLSTATE)
codes should be fairly uniform across DBMS's (tho there's always a
lot of platform specific state codes as well). However, I'm not certain
that many drivers actually support $h->state(), or if they do, if they're
conforming to the "standard" (presumably some SQL CLI  std ?).
If everybody adheres to that, then users can do a lookup of the
appropriate SQLSTATE in the <insert SQL manual here> book,
and key off the SQLSTATE value for disposition.

I don't think it will fly. There are too many DBMS-specific problems diagnosed by DBMS-specific values of SQLSTATE (or, in some cases, DBMS-non-specific values - Informix has a tendency to set SQLSTATE=IX000 - an Informix-specific error occurred; look at SQLCODE to see what really went wrong) for it to be sensible to do the mapping.


I, for one, have zero intention of going through 30,000 message codes and mapping them to anything resembling a standard.

--
Jonathan Leffler ([EMAIL PROTECTED], [EMAIL PROTECTED]) #include <disclaimer.h>
Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/




Reply via email to