开发者

Mysql + JDBC: return value of INSERT ON DUPLICATE KEY does not match Mysql documentation

开发者 https://www.devze.com 2023-03-20 03:22 出处:网络
When I execute INSERT ON DUPLICATE KEY UPDATE (IODKU) in Mysql command line interface, it returns 2 rows updated, when the INSERT hits a duplicate key constraint.

When I execute INSERT ON DUPLICATE KEY UPDATE (IODKU) in Mysql command line interface, it returns 2 rows updated, when the INSERT hits a duplicate key constraint.

In JDBC it returns 3 rows updated.

Has anyone experienced something similar?

Running Mysql 5.1 with Mysql Connector/J 5.1.14. Bug report: http://bugs.mysql开发者_开发知识库.com/61850

Example query:

INSERT INTO session (tstamp, session_id, key1, key2, key3)
VALUES ('2011-07-13 10:08:01', 2, 21, 22, 23) 
    ON DUPLICATE KEY UPDATE tstamp='2011-07-13 10:08:01'


It is a bug in Mysql. See bug reports http://bugs.mysql.com/bug.php?id=61850 and http://bugs.mysql.com/bug.php?id=46675.

0

精彩评论

暂无评论...
验证码 换一张
取 消