These will be random atomic Inserts originating from a Web page.
I'm not sure I catch your drift. The inserts are not in a batch.
I need to notify the user on the page which field was in error. I'd like to
refer to the index name in the schema and relate it to the field that
contains the non-duplicate data (i.e., error message on the email address
vs. error message on the userid field).
>From: Jeremy Zawodny <Jeremy@stripped>
>Reply-To: mysql@stripped
>To: Scot Campbell <scotcampbell@stripped>
>CC: mysql@stripped
>Subject: Re: Unique Key Violation - How to determine which key
>Date: Wed, 17 Sep 2003 13:27:28 -0700
>
>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)
_________________________________________________________________
Send and receive larger attachments with Hotmail Extra Storage.
http://join.msn.com/?PAGE=features/es