php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42883 rowCount and ATTR_EMULATE_PREPARES fixed
Submitted: 2007-10-07 13:34 UTC Modified: 2007-10-19 21:07 UTC
From: salac dot r at gmail dot com Assigned:
Status: Closed Package: PDO related
PHP Version: 5.2.4 OS: openSUSE 10.2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: salac dot r at gmail dot com
New email:
PHP Version: OS:

 

 [2007-10-07 13:34 UTC] salac dot r at gmail dot com
Description:
------------
When I'm using ATTR_EMULATE_PREPARES set to true,
function rowCount returns bad result (0).
I think that it's quite strange because without ATTR_EMULATE_PREPARES it returns god values.

Reproduce code:
---------------
$dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass,
array(    
    PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true,
    PDO::ATTR_EMULATE_PREPARES => true)
);
$result=$dbh->query("SELECT * FROM Table");
echo "rows = ".$result->rowCount();

Expected result:
----------------
rows = 7 //number of rows in Table

Actual result:
--------------
rows = 0

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-10-08 18:51 UTC] iliaa@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows (zip):
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

For Windows (installer):

  http://snaps.php.net/win32/php5.2-win32-installer-latest.msi

Seems to work fine for me. What version of MySQL are you using?
 [2007-10-08 21:31 UTC] salac dot r at gmail dot com
Well I'm not sure that I have enough skills to compile whole PHP but I do my best.:-)

I tried the code on 3 different.
PHP 5.2.0 MySQL 5.0.41 
PHP 5.2.4 MySQL 5.0.26
and
PHP 5.2.4 MySQL 5.0.32

on all machines it returned as a result Zero.
 [2007-10-12 18:48 UTC] mj@php.net
Works fine for me with 5.2.4, 5.3 and HEAD with MySQL 5.0.32.
 [2007-10-19 21:05 UTC] salac dot r at gmail dot com
Well, it works good now when I upgaraded Mysql on 5.0.45. So I think that problem is solved. Anyway thanks for good work, which you are doing.
 [2007-10-19 21:07 UTC] salac dot r at gmail dot com
fixed
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 22:01:33 2025 UTC