php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57442 db2_num_rows returns -1
Submitted: 2006-12-18 16:51 UTC Modified: 2007-01-02 10:34 UTC
From: rhodesa at us dot ibm dot com Assigned:
Status: Closed Package: ibm_db2 (PECL)
PHP Version: 5.2.0 RC4 OS: Windows XP Pro
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: rhodesa at us dot ibm dot com
New email:
PHP Version: OS:

 

 [2006-12-18 16:51 UTC] rhodesa at us dot ibm dot com
Description:
------------
Running the function db2_num_rows() with the Windows DLL returns -1. Running the same code on a SLES machine returns the correct number.

Reproduce code:
---------------
$cnx = db2_pconnect($cnx_string, '', '', array(
  'autocommit' => DB2_AUTOCOMMIT_ON,
  'DB2_ATTR_CASE' => DB2_CASE_LOWER,
  'CURSOR' => DB2_SCROLLABLE,
));
$query = "SELECT * FROM mytable";
$result = db2_exec($cnx,$query);
print "Row count: " . db2_num_rows($result) . "\n";
$count = 1;
while(db2_fetch_assoc($result))
  $count++;
print "Real row count: {$count}\n";

Expected result:
----------------
Row count: 29
Real row count: 29

Actual result:
--------------
Row count: -1
Real row count: 29

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-02 10:34 UTC] kfbombar at us dot ibm dot com
Thank you for taking the time to write to us, but this is not
a bug.

This is expected behavior.  The doc for ibm_db2 states this better than I can:

http://us2.php.net/manual/en/function.db2-num-rows.php
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Nov 17 00:01:34 2019 UTC