Normally, errors occurs for data-change statements (such as
UPDATE) that would violate
primary-key, unique-key, or foreign-key constraints. If you
are using a transactional storage engine such as
InnoDB, MySQL automatically rolls back the
statement. If you are using a nontransactional storage engine,
MySQL stops processing the statement at the row for which the
error occurred and leaves any remaining rows unprocessed.
MySQL supports an
IGNORE keyword for
UPDATE, and so forth. If you
use it, MySQL ignores primary-key or unique-key violations and
continues processing with the next row. See the section for
the statement that you are using (Section 12.2.4, “
Section 12.2.9, “
UPDATE Syntax”, and so forth).
You can get information about the number of rows actually
inserted or updated with the
mysql_info() C API function.
In MySQL 4.1 and up, you also can use the
SHOW WARNINGS statement. See
Section 188.8.131.52, “
Section 184.108.40.206, “
SHOW WARNINGS Syntax”.
InnoDB tables support
foreign keys. See
Section 220.127.116.11, “
FOREIGN KEY Constraints”.