|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #37706 oci8 maps to same descriptor when fetching multiple rows with lobs
Submitted: 2006-06-05 22:18 UTC Modified: 2007-03-12 16:24 UTC
From: crescentfreshpot at yahoo dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: 5CVS-2006-06-05 (snap) OS: Win XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
27 + 41 = ?
Subscribe to this entry?

 [2006-06-05 22:18 UTC] crescentfreshpot at yahoo dot com
I think OCI-Lob::read() is reading from the wrong handle when called multiple times on different lob descriptors.

Reproduce code:
create table lobtest (lobdata clob);
insert into lobtest (lobdata) values('data data data data data data data data');
insert into lobtest (lobdata) values('data2 data2 data2 data2 data2 data2 data2 data2');

$conn  = oci_connect('xxx','yyy','zzz');
$stmt = oci_parse($conn, "select lobdata from lobtest");

$row1 = oci_fetch_array($stmt, OCI_NUM);
$row2 = oci_fetch_array($stmt, OCI_NUM);



Expected result:
string(39) "data data data data data data data data"
string(0) "data2 data2 data2 data2 data2 data2 data2 data2"

Actual result:
string(39) "data data data data data data data data"
string(0) ""


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-06-05 22:21 UTC]
$row1[0] and $row2[0] are different variables pointing to the same LOB descriptor.
This is how it works and it's expected.
 [2006-06-06 00:29 UTC] crescentfreshpot at yahoo dot com
Three things:

a) AFAIK php has no problems with having multiple stream handles open, so does your "it's expected" comment refer to limitations in the oci library itself?

b) is this why there is no way to stop oci_fetch_all from automatically fetching my lob data and instead return them to me as separate, *individual* streams?

b) Is there no workaround for this? Something along the lines of php_stream_copy_to_stream to save a reference to an oci stream as it's fetched say in a fetchAll scenario?
 [2006-06-06 06:36 UTC]
I don't see any way to bind several variables to one placeholder/column in OCI API, so we reuse the same descriptor on each iteration.
 [2006-06-06 12:45 UTC] crescentfreshpot at yahoo dot com
Well it was not obvious that all my fetched rows would all point to the same (last fetched) lob descriptor in underlying memory, so can we say this at least needs to be documented?
 [2006-06-06 12:48 UTC]
Feel free to send a patch for the docs.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jul 15 22:01:28 2024 UTC