Normally, errors occurs for data-change statements (such as
INSERT or 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 non-transactional
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
INSERT, 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, “INSERT Syntax”, Section 12.2.10, “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.
You can also use the SHOW WARNINGS
statement. See Section 26.2.3.35, “mysql_info()”, and
Section 12.5.5.33, “SHOW WARNINGS Syntax”.
Currently, only InnoDB tables support
foreign keys. See
Section 13.2.6.4, “FOREIGN KEY Constraints”. We plan to
add foreign key support by other storage engines in a future
MySQL release. See Section 1.5, “MySQL Development Roadmap”.

User Comments
Add your own comment.