ID: 41877
User updated by: jarismar at adplabs dot com dot br
-Summary: Trying to insert multiple BLOBs on oracle with pdo_oci
hangs up Apache.
Reported By: jarismar at adplabs dot com dot br
Status: Open
Bug Type: PDO related
-Operating System: Windows, Linux Ubintu
+Operating System: Windows
PHP Version: 5.2.3
New Comment:
Running the script from command line seems to work fine.
Apache version is 2.0.59 I'll trying an upgrade.
Previous Comments:
------------------------------------------------------------------------
[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