At 6:05 PM -0600 2000-02-23, Joey Mukherjee wrote:
>I have a text file which I parse in my program and then do the INSERT into the
>mysql database.
>
>I don't want duplicates in my database of course so my primary key
>prevents that
>from happening. However, I would like to know about the duplicate attempt.
>
>If I do an INSERT IGNORE, mysql_info never returns anything. Leaving out the
>IGNORE, mysql will abort after the first duplicate. If I do a
>LOW_PRIORITY, it
>will abort after the first duplicate. A DELAYED will let all the entries be
>inserted, but never return anything just like the INSERT IGNORE.
>
>Is there a way to find out when I am trying to add a duplicate, without having
>to query the database first?
Why don't you just use REPLACE and then (assuming no error occurred)
check the value of mysql_affected_rows()?
--
Paul DuBois, paul@stripped