ID: 41877 Updated by: [EMAIL PROTECTED] Reported By: jarismar at adplabs dot com dot br -Status: Open +Status: Feedback Bug Type: PDO related Operating System: Windows PHP Version: 5.2.3 New Comment:
Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If the script requires a database to demonstrate the issue, please make sure it creates all necessary tables, stored procedures etc. Please avoid embedding huge scripts into the report. Previous Comments: ------------------------------------------------------------------------ [2007-07-02 20:21:08] jarismar at adplabs dot com dot br Running the script from command line seems to work fine. Apache version is 2.0.59 I'll trying an upgrade. ------------------------------------------------------------------------ [2007-07-02 20:04:09] jarismar at adplabs dot com dot br Description: ------------ Unable to read BLOBs from a given table and insert on another one, because php hangs up after inserting the first record on destination table. Reproduce code: --------------- SQL: CREATE TABLE TBL_BLOB (id NUMBER(10), data BLOB); CREATE TABLE TBL_BLOB2 (id NUMBER(10), data BLOB); You will need to insert some records on TBL_BLOB. PHP: try { $oPDO = new PDO($sDSN, $sUserName, $sPassword); $oPDO->beginTransaction(); $sSQLRead = 'SELECT ID, DATA FROM TBL_BLOB'; $oStmtRead = $oPDO->prepare($sSQLRead); $oStmtRead->execute(); $sSQLWrite = 'INSERT INTO TBL_BLOB2 (ID, DATA) VALUES (:id, EMPTY_BLOB()) RETURNING DATA INTO :stream'; $oStmtWrite = $oPDO->prepare($sSQLWrite); while (($aRow = $oStmtRead->fetch())) { $iID = $aRow['ID']; $rData = $aRow['DATA']; if (is_resource($rData)) { $sData = stream_get_contents($rData); fclose($rData); } else { throw new Exception('Error fetching stream'); } $oStmtWrite->bindParam(':id', $iID); $oStmtWrite->bindParam(':stream', $resource, PDO::PARAM_LOB); $oStmtWrite->execute(); if (is_resource($resource)) { fwrite($resource, $sData); fclose($resource); } else { throw new Exception('Error fetching stream'); } } $oStmtRead->closeCursor(); $oPDO->commit(); } catch (Exception $oE) { $oPDO->rollBack(); throw $oE; } $oPDO = null; Expected result: ---------------- No output, but TBL_BLOB2 should have same records from TBL_BLOB. Actual result: -------------- Apache hangs up, the page keeps loading forever. Simply trying to debug the script I see no error, the script finishes normally, but Apache does not send any response. Uncommenting the fclose(<stream>) command then debugging, the debugger stops after writing to TBL_BLOB2 on the second record. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41877&edit=1