PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » MDB2 » Bug #2744

multiple returned lob resource being overwritten

Details

Submitted2004-11-12 21:25 UTC
Frommichael dot caplan at lechateau dot ca
StatusNo Feedback
PackageMDB2
PHP Version5.0.2
OSRedhat Enterprise 3
Roadmaps(Not assigned)

Comments

[2004-11-12 21:25 UTC] michael dot caplan at lechateau dot ca

Description:
------------
I am selecting multiple columns from a table, one being a clob. the query returns multiple records for the query. The results are all good, execpt the clob column. The last returned record's clob column overwrites all previous clob columns (all the previous records have there unique data, except the clob columns which contains the data for the last record across all previous records).

To be sure, I tried my query first in strait oci8:

$query = 'select
id,
author,
cdate,
views,
title,
message,
top
from
APP_THREADS
where
TYPE = \'D\'';
$stmt = ociparse($fw_db->connection, $query);
ociexecute($stmt);

while (OCIFetchInto ($stmt, $row, OCI_ASSOC)) {
echo $row['MESSAGE']->load();
}

All good. This is what I am doing with MDB2 that results with overwritten clobs:

$query = 'select
id,
author,
cdate,
views,
title,
message,
top
from
APP_THREADS
where
TYPE = \'D\'';

$col_types = array('integer', 'text', 'date', 'integer', 'text', 'clob', 'integer');

// get topics
$topics = $fw_db->queryAll($query, $col_types, MDB2_FETCHMODE_ASSOC, true);

foreach ($topics as $topic => $topic_meta) {
for ($message = ''; !$fw_db->datatype->endOfLOB($topic_meta['message']);) {
$fw_db->datatype->readLOB($topic_meta['message'], $data, 8192);
$message .= $data;
}
$fw_db->datatype->destroyLOB($topic_meta['message']);

$topics[$topic]['message'] = $message;
}

But, this results with the above explained issue. The MDB2 code looks good to me. The issue, after some testing, appears to be how the oci8 function stores the clob resource. The following code (similar to how mdb2 goes about storing returned data) results in the same problem:

$query = 'select
id,
author,
cdate,
views,
title,
message,
top
from
APP_THREADS
where
TYPE = \'D\'';

$stmt = ociparse($fw_db->connection, $query);
ociexecute($stmt);

while (OCIFetchInto ($stmt, $row, OCI_ASSOC)) {
$messages[] = $row['MESSAGE'];
Var_Dump::display($row);
}

foreach ($messages as $message) {
Var_Dump::display($message);
Var_Dump::display($message->load());
}

It appears that the lob resources are overwritten when you loop through the resutl set the first time around.

I'm not to sure if this is an MDB2 issue, or if this is a oci8 issue.

Best,

Michael

[2004-11-20 09:37 UTC] smith at backendmedia dot com

Could you try out the test suite? There are several test that fetch multiple LOBs (one blob and one clob).

[2004-11-24 14:12 UTC] michael dot caplan at lechateau dot ca

is the test suite up-to-date with the current released MDB2 api? There seems to be several api calls in the test suite that just don't appear to be on the map in the current release.

[2004-11-24 14:14 UTC] smith at backendmedia dot com

oh you are using the CVS version?

[2005-01-12 23:54 UTC] smith at backendmedia dot com

I have made some major changes to the LOB handling in oracle (everything works on my oracle 9i install except for NULL handling in LOB fields). Could you try again?

[2005-03-08 11:28 UTC] smith at backendmedia dot com

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

[2005-03-08 16:34 UTC] michael dot caplan at lechateau dot ca

I'll try and do another test with the latest beta release in the next day or so.

Thanks!

[2005-06-03 07:50 UTC] smith at backendmedia dot com

any chances to get this tested?