On Wed, 2004-03-31 at 17:56, Jonathan Leffler wrote:
> 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.

Sybase (when used with OpenClient, which is what DBD::Sybase does) does
not set SQLSTATE at all...

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

Indeed...

Michael
-- 
Michael Peppler                              Data Migrations, Inc.
[EMAIL PROTECTED]                       http://www.peppler.org/
Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for short or 
long term contract positions - http://www.peppler.org/resume.html

Reply via email to