on 5/4/05 7:22 PM, Paul DuBois at [EMAIL PROTECTED] wrote:

> At 19:09 -0700 5/4/05, Scott Haneda wrote:
>> 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.
> 
> Error strings do change format sometimes.
> 
> And they won't necessarily be in English. :-)

I had a feeling, what is the general method most use to deal with the above
scenario?  I really don't want to test error strings every time I update
mysql, I suppose the safe road is to hand select ahead of time?



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to