开发者

MySQL row_count() rows affected

There is very little documentation on MySQL's row_count() function. Is this function specific to each stored procedure (i.e. will multiple instances of the same stored procedure executing at the same time return the correct result)? Is there any circumstances where you 开发者_StackOverflowwould want to avoid this function?

I am using MySQL's .NET Connector and ExecuteNonQuery does not correctly return rows affected on updates and deletes, so I am hoping row_count() can serve as an effective alternative.


The ROW_COUNT() value is the same as the value from the mysql_affected_rows(),

so if you insert 3 rows into a table

SELECT ROW_COUNT();

will return 3 as the result

similarly if you delete 2 rows

SELECT ROW_COUNT();

will return 2 as the result.

not sure if it will work on multiple instances of the same stored procedure, but it will return the number of rows affected on deletes and updates

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜