#40913 [Com]: PDO::PARAM_LOB does not bind to a stream for fetching a BLOB

From: Date: Tue, 19 Jun 2007 19:06:09 +0000
Subject: #40913 [Com]: PDO::PARAM_LOB does not bind to a stream for fetching a BLOB
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-113936@lists.php.net to get a copy of this message
 ID:               40913
 Comment by:       hans at velum dot net
 Reported By:      dennis at inmarket dot lviv dot ua
 Status:           Assigned
 Bug Type:         PDO related
 Operating System: Win XP
 PHP Version:      5.2.1
 Assigned To:      wez
 New Comment:

I believe this is probably the same issue, but I also notice that using
MySQL to simply execute a SQL query which contains BLOB result columns
is also returning strings instead of streams.  The difference being that
I'm not using bindColumn() and specifying PDO::PARAM_LOB.  I wouldn't
expect that I'd need to, since simply performing a standard fetch()
works as expected w/ Postgres (and, I believe, Oracle).


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

[2007-03-25 12:29:07] dennis at inmarket dot lviv dot ua

Description:
------------
PDOStatement::bindColumn($idx, $var, PDO::PARAM_LOB) for SELECT query
makes $var a string with the BLOB Data rather than a stream, for both
MySQL and SQLite.

Reproduce code:
---------------
$id = (int)$_REQUEST['book'];
$stmt = $conn->prepare("SELECT coverMime, coverImage FROM books WHERE
id=$id");
$stmt->execute();
$stmt->bindColumn(1, $mime);
$stmt->bindColumn(2, $image, PDO::PARAM_LOB);
$stmt->fetch(PDO::FETCH_BOUND);
var_dump($image);

Expected result:
----------------
Resource #1

Actual result:
--------------
String(792) {GIF89a...}


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


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


Thread (39 messages)

« previous php.bugs (#113936) next »