From:             jarismar_silva at adplabs dot com
Operating system: Linux
PHP version:      5.2.0RC5
PHP Bug Type:     PDO related
Bug description:  Cannot load Lob data with more than 4000 bytes on ORACLE 10

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 bug report at http://bugs.php.net/?id=39199&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=39199&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=39199&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=39199&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=39199&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=39199&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=39199&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=39199&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=39199&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=39199&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=39199&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=39199&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=39199&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=39199&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=39199&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=39199&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=39199&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=39199&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=39199&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=39199&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=39199&r=mysqlcfg

Reply via email to