PDOStatement::rowCount result when used after PDO::commit?

核能气质少年 提交于 2019-12-05 03:22:26

A PDOStatement is returned for each query that is executed. You will be able to use PDOStatement->rowCount() at any time in your code (during or after a transaction and rollback/commit doesn't matter). Each object takes care of maintaining itself.

The reason mysql_affected_rows has that transaction note is because it is only aware of a single mysql connection resource. This means that when you complete the transaction (commit/rollback) a new query has been sent to the DB, thus altering which result is being processed for the number of affected rows.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!