php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58086 Second call to db2_result() for same column returns empty string
Submitted: 2008-03-07 15:49 UTC Modified: 2015-06-05 12:42 UTC
From: dri at fadq dot qc dot ca Assigned: rahulpriyadarshi (profile)
Status: Closed Package: ibm_db2 (PECL)
PHP Version: 5.2.0 OS: Linux
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: dri at fadq dot qc dot ca
New email:
PHP Version: OS:

 

 [2008-03-07 15:49 UTC] dri at fadq dot qc dot ca
Description:
------------
Db2_connect V9.5 enterprise and connect to AS400

Although the first call to db2_result() returns the correct value, an immediate second call to db2_result() with the same parameters returns an empty string.



Reproduce code:
---------------
$IDconnect = db2_connect(...);

$reqSQL = "SELECT * FROM $g_libl.TABLE1 WHERE REGNUM=33";
$res=db2_exec($IDconnect,$reqSQL);
$row = db2_fetch_row($res);
echo '<br>REGNUM:'.db2_result($res,"REGNUM");
echo '<br>REGNUM:'.db2_result($res,"REGNUM");
echo '<br>REGNUM:'.db2_result($res,0);
echo '<br>REGNUM:'.db2_result($res,0);


Expected result:
----------------
REGNUM:33
REGNUM:33
REGNUM:33
REGNUM:33


Actual result:
--------------
REGNUM:33
REGNUM:
REGNUM:
REGNUM:

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-03-10 17:33 UTC] opendev at us dot ibm dot com
Need more information to analyze the problem, would like to know DB2 server running on which platform.
 [2008-03-11 10:07 UTC] dri at fadq dot qc dot ca
(as400)i5 DB2 OS/400 V5R3

and I connect to as400 with Db2_connect V9.5 enterprise on a Linux(Debian) server.
 [2008-03-13 16:48 UTC] opendev at us dot ibm dot com
An internal defect is opened to track this problem.
 [2008-11-21 10:41 UTC] dri at fadq dot qc dot ca
I tried with version 1.7.1 and the problem still exists.

Do you think this problem will be resolved soon?
 [2008-11-24 04:35 UTC] abhargav at in dot ibm dot com
Hi,

I tried a very simple program and found it working properly against AS400. 

Can you send the CLI trace for the following test case:

<?php

$conn = db2_connect (...);

if($conn) {
	$stmt = @db2_exec($conn, "CREATE TABLE TEST_13338 (ID INTEGER NOT NULL, NAME VARCHAR(20))");
	$stmt = @db2_exec($conn, "INSERT INTO TEST_13338 (ID, NAME) VALUES (0, 'TEMP 0'), (1, 'TEMP 1'), (2, 'TEMP 2')");

	$sql = "SELECT * FROM TEST_13338 WHERE ID = 0";

	$stmt = db2_exec ($conn, $sql);

	db2_fetch_row($stmt);
	echo "ID:\t" . db2_result($stmt, 0) . "\n";
	echo "ID:\t" . db2_result($stmt, 0) . "\n";
	echo "ID:\t" . db2_result($stmt, "ID") . "\n";
	echo "ID:\t" . db2_result($stmt, "ID") . "\n";

	$stmt = @db2_exec($conn, "DROP TABLE TEST_13338");
	db2_close($conn);
} else {
        print "Connection Failed." . "\n";
}

?>

I am getting of above example as:
ID:     0
ID:     0
ID:     0
ID:     0

Regards,
Ambrish Bhargava
 [2008-11-24 10:04 UTC] stefou01 at fadq dot qc dot ca
I tried your test case and it works when the table is created with CREATE TABLE.

But when the table is created with the AS400 command CRTPF it does not work.

I send to you the CLI trace.

[1227539477.164355 - 11/24/2008 10:11:17.164355] SQLFetch( )
[1227539477.164474 - 11/24/2008 10:11:17.164474]     <--- SQL_SUCCESS   Time elapsed - +5.970000E-004 seconds

[1227539477.164786 - 11/24/2008 10:11:17.164786] SQLGetData( hStmt=1:1, iCol=1, fCType=SQL_C_CHAR, rgbValue=&b1788acc, cbValueMax=12, pcbValue=&bfe6edc8 )
[1227539477.165448 - 11/24/2008 10:11:17.165448]     ---> Time elapsed - +3.120000E-004 seconds

[1227539477.165904 - 11/24/2008 10:11:17.165904] SQLGetData( rgbValue="1" - x'31', pcbValue=1 )
[1227539477.166211 - 11/24/2008 10:11:17.166211]     <--- SQL_SUCCESS   Time elapsed - +1.425000E-003 seconds

[1227539477.166448 - 11/24/2008 10:11:17.166448] SQLGetData( hStmt=1:1, iCol=1, fCType=SQL_C_CHAR, rgbValue=&b1788acc, cbValueMax=12, pcbValue=&bfe6edc8 )
[1227539477.167057 - 11/24/2008 10:11:17.167057]     ---> Time elapsed - +2.370000E-004 seconds

[1227539477.167166 - 11/24/2008 10:11:17.167166] SQLGetData( )
[1227539477.167264 - 11/24/2008 10:11:17.167264]     <--- SQL_NO_DATA_FOUND   Time elapsed - +8.160000E-004 seconds

[1227539477.167382 - 11/24/2008 10:11:17.167382] SQLGetData( hStmt=1:1, iCol=1, fCType=SQL_C_CHAR, rgbValue=&b1788acc, cbValueMax=12, pcbValue=&bfe6edc8 )
[1227539477.167945 - 11/24/2008 10:11:17.167945]     ---> Time elapsed - +1.180000E-004 seconds

[1227539477.168055 - 11/24/2008 10:11:17.168055] SQLGetData( )
[1227539477.168155 - 11/24/2008 10:11:17.168155]     <--- SQL_NO_DATA_FOUND   Time elapsed - +7.730000E-004 seconds
 [2010-07-02 09:20 UTC] steff07 at hotmail dot com
Do you think this problem will be resolved soon?
 [2012-08-01 08:52 UTC] rahulpriyadarshi@php.net
The above error may came due to at server side your z/OS zparm DESCSTAT is not
set to YES. For more detail please go through https://www-304.ibm.com/support/docview.wss?uid=swg21157678.

After setting it to yes and if you are still having the problems, you may also have to rebind the packages for the metadata procedures. For more detail please go through http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=/
com.ibm.db2.doc.inst/bjnniins1046825.htm.

Please let me know how it works for you.
 [2015-06-05 12:42 UTC] rahulpriyadarshi@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: rahulpriyadarshi
 [2015-06-05 12:42 UTC] rahulpriyadarshi@php.net
We are aspecting the solution works for customer, since from long time customer didn't came back
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon Sep 23 15:01:27 2019 UTC