Tim Bunce [EMAIL PROTECTED] wrote:
> On Mon, Sep 29, 2003 at 12:14:17PM -0400, Hardy Merrill wrote:
> > Tim Bunce [EMAIL PROTECTED] wrote:
> > > On Mon, Sep 29, 2003 at 09:32:10AM -0400, Hardy Merrill wrote:
> > > > Thomas A. Lowery [EMAIL PROTECTED] wrote:
> > > > > # Does the error message contains the phrase: duplicate key
> > > > > if ($dbh->errstr =~ m/duplicate\skey/i) {
> > > > ^^^^^^^^^^^^^^
> > > > Just to clarify, as Thomas said above, each database produces
> > > > different error messages to indicate that you are trying
> > > > to insert a duplicate key - so what you search for here will
> > > > vary depending on which database you are using.
> > >
> > > Of course, in an ideal world, DBD's would all set $DBI::state
> > > ($h->state) to the appropriate value: "23000"
> > >
> > > Maybe someone could define a list of the errors that most frequently
> > > need to be explicitly checked for. The DBI spec could then list
> > > those along with the standard SQL_STATE error codes and suggest that
> > > drivers support at least that basic set of codes.
> >
> > I think this is an excellent idea!
>
> Does that mean you're volunteering to coordinate making the list?
> That is, soliciting input from dbi-users and dbi-announce and produce
> a list of the corresponding SQL_STATE values (based on ODBC 3.5).
> I hope so :)
Damn, I knew I shouldn't have responded to that ;-)
Just kidding :)
As I've never used ODBC, if you can point me to the proper
ODBC 3.5 docs, I'll solicit input to create a list of SQL_STATE
values. I searched google for 'odbc 3.5' and 'odbc' and 'odbc
sql state', and I'm not having much luck finding a list of
sql state's.
Hardy
>
> Tim.
>
> > The only situation I can think of that I've had to code
> > around where different databases produce different results
> > is this one - this "trying to insert a duplicate record"
> > error. There must be others ;-)
> >
> > --
> > Hardy Merrill
> > Red Hat, Inc.