List:General Discussion« Previous MessageNext Message »
From:Scott Haneda Date:May 5 2005 2:09am
Subject:stability of mysql error strings
View as plain text  
I have a unique key on username and email address in mysql.  In my
application logic, I want to test for that response on failed insert.  Error
number 1062 tells me there is a duplicate key, but no way to tell what key
that is.

The error string returned is more telling, but seems less than ideal to use
for stability and upgrade issues.  It tells me username is key 2 and email
is key 3.

So, if error_string ends with 'key 2' etc etc
I took care to lowercase the error string, so that's covered.

What is not, is that it may not always 'ends with', so I could move to
'contains'.

Anyway, I think you see what my concern is, wonder what the preferred method
to fix is, or if someone can tell me when, if ever, the error string has
ever changed format in mysql.

I could run a insert ahead of time and parse the returned results, but I
would rather not add the overhead of another select ahead of time.



Thread
stability of mysql error stringsScott Haneda5 May
  • Re: stability of mysql error stringsPaul DuBois5 May
    • Re: stability of mysql error stringsScott Haneda5 May
      • Re: stability of mysql error stringsJigal van Hemert5 May