php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58499 Real db2 datatype is not supported by extension
Submitted: 2009-01-10 11:29 UTC Modified: 2009-03-09 06:26 UTC
From: kolar dot radim at gmail dot com Assigned:
Status: Closed Package: ibm_db2 (PECL)
PHP Version: 5.2.4 OS: Ubuntu 8.04
Private report: No CVE-ID: None
 [2009-01-10 11:29 UTC] kolar dot radim at gmail dot com
Description:
------------
db2 datatype 'REAL' is not supported by ibm_db2 PHP extension. Reading data of that type returns bogus values. Tested against IBM DB2 LUW 9.5.3

Reproduce code:
---------------
<?php
function print_array($res) {
	foreach($res as $key => $val) {
	 echo "$key -- $val \n";
	}
}
$dbcon=db2_connect("test","phorum","p");
$res=db2_exec($dbcon,"CREATE TABLE TEST1R (TZ_OFFSET REAL)");
$res=db2_exec($dbcon,"CREATE TABLE TEST1F (TZ_OFFSET FLOAT)");
$res=db2_exec($dbcon,"INSERT INTO TEST1R VALUES(-2.34)");
$res=db2_exec($dbcon,"INSERT INTO TEST1F VALUES(-2.34)");

echo "Float value\n";
$res=db2_exec($dbcon,"SELECT tz_offset from test1F");
$result=db2_fetch_assoc($res);
print_array($result);
echo "Real value\n";
$res=db2_exec($dbcon,"SELECT tz_offset from test1R");
$result=db2_fetch_assoc($res);
print_array($result);

$res=db2_exec($dbcon,"DROP TABLE TEST1R");
$res=db2_exec($dbcon,"DROP TABLE TEST1F");
?>


Expected result:
----------------
Float value
TZ_OFFSET -2.34
Real value
TZ_OFFSET -2.34

Actual result:
--------------
Float value
TZ_OFFSET -2.34
Real Value
TZ_OFFSET 1.59220141196E-314

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-01-12 02:10 UTC] abhargav at in dot ibm dot com
Hi,

Thanks for reporting this. I will get back to you once it is fixed.

Regards,
Ambrish Bhargava
 [2009-03-09 06:26 UTC] abhargav at in dot ibm dot com
Thank you for your bug report. This issue has been fixed
in the latest released version of the package, which you can download at
http://pecl.php.net/get/ibm_db2


 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu Aug 22 13:01:27 2019 UTC