#45021 [Opn]: PDO_OCI only fetches 512 bytes from a LONG column

From: Date: Mon, 19 May 2008 16:30:11 +0000
Subject: #45021 [Opn]: PDO_OCI only fetches 512 bytes from a LONG column
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-125118@lists.php.net to get a copy of this message
 ID:               45021
 User updated by:  steil at zweitwerk dot com
 Reported By:      steil at zweitwerk dot com
 Status:           Open
 Bug Type:         PDO related
 Operating System: Linux
 PHP Version:      5.2.6
 New Comment:

Sorry, I thought I could straighten the example by omitting records
with small content, but the long column does not support the length
property whence the statement should just read

$res = $db->query("SELECT longcolumn FROM table");

However, the bug remains.


Previous Comments:
------------------------------------------------------------------------

[2008-05-16 14:43:10] steil at zweitwerk dot com

Description:
------------
If you fetch from an Oracle column of datatype long, and the actual
data is more than 512 byte long it will be truncated and the following
warning will be issued
"Warning: PDOStatement::fetch(): column 0 data was too large for buffer
and was truncated to fit it in"

Reproduce code:
---------------
$db = new PDO('oci:dbname=...', 'user', 'pwd');
$res = $db->query("SELECT longcolumn FROM table WHERE
length(longcolumn) > 512");
$row = $res->fetch();
print_r('data length: '. strlen($row[0]));

results in $row[0] being truncated and the output
data length: 512

Expected result:
----------------
$row[0] should contain all of the data and the output
data length: x   (where x > 512)



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=45021&edit=1



Thread (8 messages)

« previous php.bugs (#125118) next »