ID: 39199
User updated by: jarismar_silva at adplabs dot com dot br
-Reported By: jarismar_silva at adplabs dot com
+Reported By: jarismar_silva at adplabs dot com dot br
Status: Assigned
Bug Type: PDO related
Operating System: Linux
PHP Version: 5.2.0RC5
Assigned To: wez
New Comment:
jarismar_silva at adplabs.com.br
Previous Comments:
------------------------------------------------------------------------
[2006-10-19 14:50:44] jarismar_silva at adplabs dot com dot br
Description:
------------
Trying to read a CLOB field with has more than 4000 bytes result on
empty stream.
Reproduce code:
---------------
<?php
/* Table structure
CREATE TABLE test_clob (
id NUMBER(10),
data CLOB
)
*/
$sDSN = 'oci:dbname=//<server>:1521/<database>;charset=UTF-8';
$sUserName = '<user>';
$sPassword = '<passwd';
try {
$oPDO = new PDO($sDSN, $sUserName, $sPassword, $aDriverOptions);
$oStmt = $oPDO->prepare("insert into test_clob (id, data) values
(:id, EMPTY_CLOB())");
$iID = 1;
$oStmt->bindParam(':id', $iID);
if ($oStmt->execute()) {
$oStmt = $oPDO->prepare("update test_clob set data=:value where
id=1");
$sData = '<4000 bytes or more>';
$oStmt->bindParam(':value', $sData);
if ($oStmt->execute() === false) {
throw new Exception('Error on update clob');
}
} else {
throw new Exception('Error on insert EMPTY_CLOB');
}
$oStmt = $oPDO->prepare("select data from test_clob where id =
:id");
$oStmt->bindParam('id', $iID);
$oStmt->execute();
$oResult = $oStmt->fetch();
echo 'Read '.strlen(stream_get_contents($oResult['DATA'])).'
characters <br>';
} catch (Exception $oE) {
echo '<pre>';print_r($oStmt->errorInfo());echo "</pre><br>\n";
echo $oException->getMessage()."<br>\n";
}
$oPDO = null;
Expected result:
----------------
Read N characters (N >0)
Actual result:
--------------
Read 0 characters
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39199&edit=1