Exemple #1
0
 /**
  * Read data from large object input stream.
  *
  * @param array $lob array
  * @param blob $data reference to a variable that will hold data to be
  *      read from the large object input stream
  * @param int $length integer value that indicates the largest ammount of
  *      data to be read from the large object input stream.
  * @return mixed length on success, a MDB2 error on failure
  * @access protected
  */
 function _readLOB($lob, $length)
 {
     if ($lob['loaded']) {
         return parent::_readLOB($lob, $length);
     }
     if (!is_object($lob['resource'])) {
         $db = $this->getDBInstance();
         if (PEAR::isError($db)) {
             return $db;
         }
         return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null, 'attemped to retrieve LOB from non existing or NULL column', __FUNCTION__);
     }
     $data = $lob['resource']->read($length);
     if (!is_string($data)) {
         $db = $this->getDBInstance();
         if (PEAR::isError($db)) {
             return $db;
         }
         return $db->raiseError(null, null, null, 'Unable to read LOB', __FUNCTION__);
     }
     return $data;
 }