#47311 [Csd]: PDO::PARAM_LOB columns need to be bound before execute() on PgSQL
| From: | kalle@php.net | Date: | Sun, 22 Mar 2009 18:35:24 +0000 |
| Subject: | #47311 [Csd]: PDO::PARAM_LOB columns need to be bound before execute() on PgSQL | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-134997@lists.php.net to get a copy of this message | ||
ID: 47311
Updated by: kalle@php.net
Reported By: matteo at beccati dot com
Status: Closed
Bug Type: PDO related
Operating System: Any
PHP Version: 5.3.0beta1
New Comment:
Fixed in phpdoc for the record
Previous Comments:
------------------------------------------------------------------------
[2009-02-11 11:19:07] matteo at beccati dot com
Thanks for that. I've also created a patch for the documentation. You
might want to check the wording and fixing it before applying:
http://www.beccati.com/misc/pdo_pgsql_bug47311_phpdoc.patch
------------------------------------------------------------------------
[2009-02-11 10:44:56] felipe@php.net
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
------------------------------------------------------------------------
[2009-02-04 18:31:55] matteo at beccati dot com
Patch is available here:
http://www.beccati.com/misc/pdo_pgsql_bug47311_php_5.3.patch
It fixes another small problem in the phpt and adds one more test case.
Plus adds a note to the code.
------------------------------------------------------------------------
[2009-02-04 18:29:09] matteo at beccati dot com
Description:
------------
I was trying to investigate a test failure in the pdo_pgsql extension,
namely the large_objects.phpt.
The failure is caused by the fact that the LOB parameter is bound after
calling execute, which seems to be unsupported. Moving the call to
bindColumn() before execute() fixes the test.
I've also tried to fix it, but no matter how hard I tried I couldn't
find a suitable solution that also kept backwards compatibility (i.e.
returning the large object OID as int if the parameter is not explicitly
bound as PDO::PARAM_LOB).
Therefore I think that the best solution would be to document such
behaviour and fix the test accordingly.
Note: it doesn't look like a duplicate of #40913, as mysql and sqlite
do not seem to have custom code to retrieve data as a stream.
Reproduce code:
---------------
$stmt = $db->prepare("SELECT * from test");
$stmt->bindColumn('bloboid', $lob, PDO::PARAM_LOB);
$stmt->execute();
$stmt->fetch(PDO::FETCH_ASSOC);
var_dump(is_resource($lob));
$stmt = $db->prepare("SELECT * from test");
$stmt->execute();
$stmt->bindColumn('bloboid', $lob, PDO::PARAM_LOB);
$stmt->fetch(PDO::FETCH_ASSOC);
var_dump(is_resource($lob));
Expected result:
----------------
bool(true)
bool(true)
Actual result:
--------------
bool(true)
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47311&edit=1