Request #8793 When a buffered result is used, LOBs must also be buffered
Submitted: 2006年09月26日 19:28 UTC
From: justinpatrin Assigned: quipo
Status: No Feedback Package: MDB2 (version CVS)
PHP Version: Irrelevant OS: Irrelevant
Roadmaps: (Not assigned)
Subscription


[2006年09月26日 19:28 UTC] justinpatrin (Justin Patrin)
Description: ------------ If a buffered result set is used the LOB objects returned are changed when a new row is fetched (for oci8 at least). 12:26 <@lsmith> so i guess the fix would be to 12:27 <@lsmith> 1) put an if statement around your fix to check if result types are set 12:27 <@lsmith> 2) add a parameter to convertResultRow() to tell _baseConvertResult() if it should immidiatly retrieve the lob value in its entirety 1) is done. 2) may or may not need to be specific to an RDBMS. I am currently writing a test case for LOB reading from multiple rows so that this can be tested on multiple RDMBS before fixing.

Comments

[2006年12月05日 11:28 UTC] quipo (Lorenzo Alberton)
what's the status of this one?
[2007年01月26日 06:20 UTC] lsmith (Lukas Smith)
still open .. i just got an email with this issue: I encountered a problem when use the function numRows() before retrieve a lob field. (The function numRows() is provided by the class MDB2_Result_Common.) The problem is: ----------------------------------------------------------- 1.numRows() returns the correct number of the rows in the result; 2.$lob_value is a variable to store the content of a lob field. Take for example, if the result contains 5 records, when the following script is executed, 5 records are print out in the web page, every field has diffrent values in different rows except the lob field, and the lob field's value is always the same(the value of the last record). Wish you can understand my description.(As you can see in the script, I set the initial value of $lob_value as a blank string each time before attaching the lob field to it. 3.The result buffering is on. But what does 'result buffering' mean? ----------------------------------------------------------- The sample PHP script is: ----------------------------------------------------------- <?php //Oracle database connection is setup, the handle is $db //A query is executed, and the result contains a lob field, the handle is $res if ($db->getOption('result_buffering')) { echo "<br/>".$res->numRows()." records are found!<br/>"; } else { echo 'cannot get number of rows in the result set when "result_buffering" is disabled'; } //The result buffering is on. But what does 'result buffering' mean? echo "<table>"; while (($row = $res->fetchRow(MDB2_FETCHMODE_ASSOC))) { echo "<tr>"; foreach($row as $key => $value){ //The type of 'CLOB' variable is 'resource', which can be showed by //echo gettype($value); //The resource type of 'CLOB' variable is 'stream', which can be showed by //echo get_resource_type($value); echo "<td>"; switch($key){ //The field 'lob_field' is a lob field case "lob_field": $lob_value = ""; if ($lob_value == ""){ echo 'The $lob_value is blank!'; } while (!feof($value)) { $lob_value .= str_replace("\n","|",stream_get_line($value, 4096)); } echo $lob_value; break; default: echo '["'.$key.'"] = '.$value."\n"; } echo "</td>"; } echo "</tr>"; } echo "</table>"; ?>
[2007年08月03日 20:05 UTC] quipo (Lorenzo Alberton)
Is it possible that this bug is fixed already in the current MDB2 CVS version, or that a recent build of the oci8 extension doesn't have this problem? Because I can't reproduce it...
[2007年08月22日 23:07 UTC] justinpatrin (Justin Patrin)
The extension wouldn't "fix" this issue I think...when the result is buffered the record pointer is moved on to the next record, hence the lob is moved to the next one. In my tests when opening this bug I consistently saw that when I tried to retrieve the LOBs after using a buffered result I always got the LOBs from the last record fetched.
[2007年09月09日 13:02 UTC] quipo (Lorenzo Alberton)
The fact is I can NOT reproduce this bug, neither in the MDB2 testsuite, nor with the testcase in Lukas' above message :-( Can you have another look at it, please? TIA

AltStyle によって変換されたページ (->オリジナル) /