List:General Discussion« Previous MessageNext Message »
From:Jeremy Zawodny Date:September 17 2003 8:27pm
Subject:Re: Unique Key Violation - How to determine which key
View as plain text  
On Wed, Sep 17, 2003 at 08:01:07AM -0700, Scot Campbell wrote:
> Let me rephrase.  I insert a row and recieve a 1062 error (Key violation).  
> How do I determine, at run-time, which of the 3 possible columns has the 
> error.  I guess I could parse the mysql_error message string.  But, that 
> seems likely to change in the future.  Or, I can test each column for 
> uniqueness via individual selects before I issue the insert.

Unless it's an exceptionally common problem, I'd run the INSERTs and go
to all that extra work only when it fails.

Jeremy
-- 
Jeremy D. Zawodny     |  Perl, Web, MySQL, Linux Magazine, Yahoo!
<Jeremy@stripped>  |  http://jeremy.zawodny.com/

MySQL 4.0.15-Yahoo-SMP: up 3 days, processed 146,116,959 queries (440/sec. avg)
Thread
Unique Key Violation - How to determine which keyScot Campbell17 Sep
  • Re: Unique Key Violation - How to determine which keyJeremy Zawodny17 Sep
  • Permission Problem in OS XDietrich Speer23 Jan
    • Re: Permission Problem in OS XBrent Baisley23 Jan
Re: Unique Key Violation - How to determine which keyScot Campbell17 Sep
  • Re: Unique Key Violation - How to determine which keyJeremy Zawodny17 Sep
Re: Unique Key Violation - How to determine which keyScot Campbell18 Sep
  • Re: Unique Key Violation - How to determine which keyJeremy Zawodny18 Sep
  • Re: Unique Key Violation - How to determine which keyHarald Fuchs18 Sep
Re: Unique Key Violation - How to determine which keyScot Campbell18 Sep
  • Re: Unique Key Violation - How to determine which keyJeremy Zawodny18 Sep