php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57315 Unable to return resultset with clob
Submitted: 2006-10-21 13:32 UTC Modified: 2006-10-24 13:57 UTC
From: dyohi at yahoo dot com Assigned:
Status: Not a bug Package: ibm_db2 (PECL)
PHP Version: 4.4.4 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: dyohi at yahoo dot com
New email:
PHP Version: OS:

 

 [2006-10-21 13:32 UTC] dyohi at yahoo dot com
Description:
------------
Unable to return result set with long varchar. Excluding the long varchar column returns the result set fine. Am using DB2 Express-C 8.2.13, IIS, PHP 4.4.4, IBM_DB2.dll 1.5.1.

Table Structure
===============

id bigint
title varchar(100)
keywords varchar(100)
description varchar(1024)

Reproduce code:
---------------
$dbh = db2_connect($dbname, $username, $passwd, array('DB2_ATTR_CASE'=>DB2_CASE_LOWER));
$sql = "select * from mytable";
$resultres = db2_exec($dbh, $sql);
while($row = db2_fetch_assoc($resultres)){
    $resultset[] = $row;
}
print_r($resultset);
db2_close($dbh);

Expected result:
----------------
array(
    array[0]['id'] = 1,
    array[0]['title'] = 'My Title',
    array[0]['keywords'] = 'keyword1, keyword2',
    array[0]['description'] = 'My Description...'
)

Actual result:
--------------
array()

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-10-21 20:33 UTC] dyohi at yahoo dot com
The description column should have been clob(1M) instead of varchar(1024).
 [2006-10-23 14:55 UTC] kfbombar at us dot ibm dot com
Hi,

I am not able to reproduce this bug.  I have used the following script with the latest ibm_db2, PHP 5.1.6, DB2 Express C, and IIS:

<?php

$conn_string = "DRIVER={IBM DB2 ODBC DRIVER};DATABASE=mydatabase;HOSTNAME=myhostname;PORT=50000;PROTOCOL=tcpip;UID=myuser;PWD=*****;";
$conn = db2_connect($conn_string, '', '', array('DB2_ATTR_CASE'=>DB2_CASE_LOWER));

db2_exec($conn, "DROP TABLE test");
db2_exec($conn, "CREATE TABLE test (id BIGINT, title VARCHAR(100), keywords VARCHAR(100), description CLOB(1M))");
db2_exec($conn, "INSERT INTO test (id, title, keywords, description) values (1, 'My Title', 'keyword1, keyword2', 'My Description...')");

$sql = "select * from test";
$resultres = db2_exec($conn, $sql);
while($row = db2_fetch_assoc($resultres)){
    $resultset[] = $row;
}
print_r($resultset);
db2_close($conn);

?>

And the results are as follows:

Array ( 
  [0] => Array ( [id] => 1 
  [title] => My Title 
  [keywords] => keyword1, keyword2 
  [description] => My Description... )
)

Can you try to update your PHP to the latest stable version (5.1.6), and try to reproduce?  Please provide feedback after your PHP upgrade in order to either close this bug or continue debugging.  Thank you.
 [2006-10-23 16:17 UTC] dyohi at yahoo dot com
I have an application that is built on PHP 4 and have not upgraded to PHP 5 because I am unsure that my application will work or not with PHP 5. If it is your recommendation that I should move to PHP 5, then I will go ahead and retest my entire app on PHP 5.

Thank you.
 [2006-10-23 16:35 UTC] kfbombar at us dot ibm dot com
Hi,

I just downloaded PHP 4.4.4 and tried out your script again, and I have seen no problems.  Is there any more info that you can give me in your environment to try and diagnose?  Since I am not able to reproduce with PHP 4 and PHP 5, I feel that this may be a setup issue.  Are other scripts with PHP and ibm_db2 working fine?
 [2006-10-24 13:57 UTC] dyohi at yahoo dot com
Upon further testing I am able to retrieve column information and data from tables with varchar(1024) and clobs. It appears to be a problem with my db object. I will close this thread. Thank you for your assistance.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Jan 22 15:01:23 2021 UTC