sql - Any way to distinguish the cases of 0 affected row of MYSQL update? -
suppose have table named 't'
--------------- | key | value | --------------- | 1 | abc | | 2 | def | ---------------
consider 2 mysql queries
update t set value='abc' key=1
update t set value='abc' key=3
executing both queries give 'affected rows' 0 (that is, not update row) because first query non-updating update , second non-matching update.
is there way distinguish these 2 cases?
if want number of 'matched' rows (and no longer number of 'changed' rows), can set client_found_rows
described here:
http://dev.mysql.com/doc/refman/5.5/en/mysql-affected-rows.html
for update statements, affected-rows value default number of rows changed. if specify client_found_rows flag mysql_real_connect() when connecting mysqld, affected-rows value number of rows “found”; is, matched clause.
Comments
Post a Comment