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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 16:01:29 2024 UTC