php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34758 (DBLIB driver) PDOStatement::rowCount() returns int(0) on each query
Submitted: 2005-10-06 14:37 UTC Modified: 2005-10-12 17:03 UTC
From: spheroid@php.net Assigned: wez
Status: Closed Package: PDO related
PHP Version: 5CVS-2005-10-06 (snap) OS: Mac OS X 10.4
Private report: No CVE-ID:
 [2005-10-06 14:37 UTC] spheroid@php.net
Description:
------------
Using PDO DBLIB driver to connect to MSSQL server each SELECT query I've tried this far returns a valid resultset but PDOStatement::rowCount() always returns int(0).

PDO::exec() returns the correct row count, however.

Reproduce code:
---------------
<?php
$pdo   = new PDO(...);
$query = "SELECT 1+1";
$stmt  = $pdo->query($query);

var_dump($stmt->rowCount());
var_dump($stmt->fetchColumn());
var_dump($pdo->exec($query));

?>

Expected result:
----------------
int(1)
string(1) "2"
int(1)

Actual result:
--------------
int(0)
string(1) "2"
int(1)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-10-07 10:35 UTC] sniper@php.net
Assigned to the maintainer.

 [2005-10-12 17:03 UTC] iliaa@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Wed Apr 16 07:02:02 2014 UTC