insert into ... on duplicate key update ... 理论返回的影响行数应该为1或2,而resty-mysql里得到的是3 求解释
Hello! 2014-11-12 19:17 GMT-08:00 Walker: > insert into ... on duplicate key update ... > > 理论返回的影响行数应该为1或2,而resty-mysql里得到的是3 > > 求解释 > lua-resty-mysql 返回的 affected rows 的信息直接取自 MySQL 服务器返回的 packet 里的信息。客户端并没有尝试作任何自己的计算和解释。 Regards, -agentzh
Incompatible Change: The mysql_affected_rows() C API function returned 3 (instead of 2) for INSERT ... ON DUPLICATE KEY UPDATE statements where there was a duplicated key value.
mysql_affected_rows()
INSERT ... ON DUPLICATE KEY UPDATE
Now the affected-rows value per row is 1 if the row is inserted as a new row, 2 if an existing row is updated, and 0 if an existing row is set to its current values. If you specify the CLIENT_FOUND_ROWS flag to mysql_real_connect() when connecting to mysqld, the affected-rows value is 1 (not 0) if an existing row is set to its current values. (Bug #46675, Bug #11754979)
CLIENT_FOUND_ROWS
mysql_real_connect()
Hello! 2014-11-12 19:17 GMT-08:00 Walker: insert into ... on duplicate key update ... 理论返回的影响行数应该为1或2,而resty-mysql里得到的是3 求解释 lua-resty-mysql 返回的 affected rows 的信息直接取自 MySQL 服务器返回的 packet 里的信息。客户端并没有尝试作任何自己的计算和解释。 Regards, -agentzh
Hello! 2014-11-12 19:17 GMT-08:00 Walker:
lua-resty-mysql 返回的 affected rows 的信息直接取自 MySQL 服务器返回的 packet 里的信息。客户端并没有尝试作任何自己的计算和解释。 Regards, -agentzh