Subject: | Incorrect rowcount from INSERT ... ON DUPLICATE KEY UPDATE |
When an "INSERT ... ON DUPLICATE KEY UPDATE" is completed, MySQL returns
the number of rows affected: 1 if an INSERT occurred, or 2 if an UPDATE
occurred (http://dev.mysql.com/doc/refman/5.1/en/insert-on-duplicate.html).
However, DBD::mysql fails to carry that behavior into Perl. It always
returns 1. As a result, there's no direct way for Perl apps to tell
whether an insert occurred or an update occurred.
Details and test cases are reported here:
http://bugs.mysql.com/bug.php?id=29941
Thanks,
--Jonathan A. Marshall