php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59845 db2_fetch_assoc() terminates with "Cannot Determine LOB Size" with nested call
Submitted: 2011-07-12 19:31 UTC Modified: 2011-07-13 06:34 UTC
From: fsteegmans at sugarcrm dot com Assigned:
Status: Not a bug Package: ibm_db2 (PECL)
PHP Version: 5.3.5 OS: Ubuntu
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: fsteegmans at sugarcrm dot com
New email:
PHP Version: OS:

 

 [2011-07-12 19:31 UTC] fsteegmans at sugarcrm dot com
Description:
------------
db2_fetch_assoc() fails with "PHP Warning:  db2_fetch_assoc() 
[<a href='function.db2-fetch-assoc'>function.db2-fetch-
assoc</a>]: Cannot Determine LOB Size in ..." when a separate 
query with a different resource is executed in between 
fetches.

Note that the dynamic_query column in the sample code below is 
of the type CLOB(65535)

Reproduce code:
---------------
$q1 = "SELECT  f.dynamic_query FROM folders f";
$stmt1 = db2_prepare($db2, $q1);
db2_execute($stmt1);

var_dump($stmt1);var_dump("<br /> <br />");
while($i1 = db2_fetch_assoc($stmt1)) {
	var_dump($i1);var_dump("<br />inside while <br /><br />");

	$q2 = "select CURRENT DATE from SYSIBM.SYSDUMMY1";
	$stmt2 = db2_prepare($db2, $q2);
	$db2_execute($stmt2);
	var_dump($stmt2);var_dump("<br />After inner execute<br /><br />");
}
var_dump("ok!");


Expected result:
----------------
NO WARNING in the php.log

50 var_dumps in the output like there are now only 2 inside 
while statements. See actual result below.


Actual result:
--------------
php.log:

[12-Jul-2011 16:07:36] PHP Warning:  db2_fetch_assoc() [<a 
href='function.db2-fetch-assoc'>function.db2-fetch-
assoc</a>]: Cannot Determine LOB Size in 
/var/www/ent/sugarcrm/include/MVC/View/views/view.debug.php 
on line ...

Output:


resource(477) of type (DB2 Statement) string(13) "

" array(1) { ["DYNAMIC_QUERY"]=> string(398) "SELECT 
emails.id polymorphic_id, 'Emails' polymorphic_module FROM 
emails JOIN emails_text on emails.id = emails_text.email_id 
WHERE (type = 'inbound' OR status = 'inbound') AND 
assigned_user_id = '39880860-ecae-de70-e6e4-4e14c07675ed' 
AND emails.deleted = '0' AND status NOT IN ('sent', 
'archived', 'draft') AND type NOT IN ('out', 'archived', 
'draft')" } string(31) "
inside while 

" resource(478) of type (DB2 Statement) string(37) "
After inner execute

" array(1) { ["DYNAMIC_QUERY"]=> string(361) "SELECT 
emails.id polymorphic_id, 'Emails' polymorphic_module FROM 
emails JOIN emails_text on emails.id = emails_text.email_id 
WHERE (type = 'draft' OR status = 'draft') AND 
assigned_user_id = '39880860-ecae-de70-e6e4-4e14c07675ed' 
AND emails.deleted = '0' AND status NOT IN ('archived') AND 
type NOT IN ('archived')" } string(31) "
inside while 

" resource(479) of type (DB2 Statement) string(37) "
After inner execute

" string(3) "ok!"


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-07-13 06:34 UTC] abhargav at in dot ibm dot com
Sorry, but your problem does not imply a bug in PECL itself.  For a
list of more appropriate places to ask for help using PECL, please
visit http://pecl.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PECL.

Hi,

You need to turn off autocommit in-order to perform this type of operation. If autocommit is on, then inner SQL will commit and hence lob locator will get closed. That will throw an error (which you are getting). Something like:

db2_autocommit($db2, DB2_AUTOCOMMIT_OFF);
while($i1 = db2_fetch_assoc($stmt1)) {
	var_dump($i1);var_dump("<br />inside while <br /><br />");

	$q2 = "select CURRENT DATE from SYSIBM.SYSDUMMY1";
	$stmt2 = db2_prepare($db2, $q2);
	$db2_execute($stmt2);
	var_dump($stmt2);var_dump("<br />After inner execute<br /><br />");
}
db2_autocommit($db2, DB2_AUTOCOMMIT_ON);

Regards,
Ambrish Bhargava
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 17:01:31 2024 UTC