#42883 [Opn]: Bad function of rowCount combined with ATTR_EMULATE_PREPARES
| From: | mj@php.net | Date: | Fri, 12 Oct 2007 18:48:15 +0000 |
| Subject: | #42883 [Opn]: Bad function of rowCount combined with ATTR_EMULATE_PREPARES | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-118499@lists.php.net to get a copy of this message | ||
ID: 42883
Updated by: mj@php.net
Reported By: salac dot r at gmail dot com
Status: Open
Bug Type: PDO related
Operating System: openSUSE 10.2
PHP Version: 5.2.4
New Comment:
Works fine for me with 5.2.4, 5.3 and HEAD with MySQL 5.0.32.
Previous Comments:
------------------------------------------------------------------------
[2007-10-08 21:31:21] 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-08 18:51:11] 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-07 13:34:46] 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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42883&edit=1