Bug #32135 row_count() function returns difference value using console and .net
Submitted: 6 Nov 2007 5:32 Modified: 8 Nov 2007 16:31
Reporter: xu ziyan Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:1.0.10.1 OS:Windows (XP SP2)
Assigned to: CPU Architecture:Any
Tags: row_count(), UPDATE

[6 Nov 2007 5:32] xu ziyan
Description:
I use update statement to modify a row in a table. But the new value is the same as the old value. So the result is Mathes:1, Modified: 0. Right?
When I use sql command in MySql Console, the row_count() returns 0;
but if I use .Net dirver 1.0.10.1 and ran the same sql, row_count() returns 1.
I think it's a bug, becuase whatever the row_count() means, it should returns the same value if I executed the same command.

How to repeat:
Make a table with some fileds and some rows. Write an update sql command, it can fetch one row, but the value want to set is same as the value is was. That means it matches one record but no record is updated.
Execute this sql in MySql Command Console, and then execute "select row_count();", it shows "0";
Write some codes in .net, eg in c#, like this...
And use MySqlCommand.Text = "update XXX set YYY=ZZZ where XXXid=1;select row_count();", and then use ExecuteScalar() to get the result. It shows "1".

Suggested fix:
Whatever the row_count() means, it should returns the same value if I executed the same command.
[8 Nov 2007 16:00] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/37345
[8 Nov 2007 16:02] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/37346
[8 Nov 2007 16:02] Reggie Burnett
Fixed in 1.0.11, 5.0.9, and 5.1.4+
[8 Nov 2007 16:05] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/37347
[8 Nov 2007 16:31] Reggie Burnett
after discussing with some folks this is not a bug.  The issue you are seeing is that the console application doesn't use the connection option FOUND_ROWS so the function row_count() only returns rows that are affected whereas Connector/Net uses the FOUND_ROWS option which will return all rows matched.