Req #45080 [Com]: PDOStatement - Mysql Driver - rowCount
| From: | jmichae3 at yahoo dot com | Date: | Thu, 22 Aug 2013 01:17:08 +0000 |
| Subject: | Req #45080 [Com]: PDOStatement - Mysql Driver - rowCount | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-181104@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=45080&edit=1
ID: 45080
Comment by: jmichae3 at yahoo dot com
Reported by: paul dot cocei at gmail dot com
Summary: PDOStatement - Mysql Driver - rowCount
Status: Not a bug
Type: Feature/Change Request
Package: Feature/Change Request
Operating System: CentOS 5.1
PHP Version: 5.2.6
Block user comment: N
Private report: N
New Comment:
I am having this problem too, and so are other people on the net. getting 0 always from rowCount()
on SELECT.
Previous Comments:
------------------------------------------------------------------------
[2008-08-20 22:46:30] kalle@php.net
This is expected behavior, the manual also says that the rowCount will return affected rows.
------------------------------------------------------------------------
[2008-05-23 13:10:24] paul dot cocei at gmail dot com
Description:
------------
Because libmysql contains a method named mysql_stmt_num_rows, it is possible in the mysql PDO driver
to return correctly the total count of rows selected by a SELECT statement.
Right now, the source code for mysql PDOStatement uses mysql_stmt_affected_rows, which evidentely
returns "0" for SELECT queries.
Localization: php-5.2.6/ext/pdo_mysql.c, line 202.
Reproduce code:
---------------
row_count = mysql_stmt_affected_rows(S->stmt);
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=45080&edit=1