|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2006-05-31 22:00 UTC] pdo at seven dot net dot nz
 Description:
------------
[If this better classified as a feature request, please do so]
I would think that a text field should be able to be returned with the rest of a result set. Binding an output column for such a simple request is tedious.
Reproduce code:
---------------
<?php
$statement = $pdo->prepare ("SELECT listing_no, public_remarks, listing_id FROM rnz_listing");
$statement->execute ();
print_r ($statement->fetch (PDO::FETCH_ASSOC));
?>
More tests at
http://www.netconcepts.com/steveh-bugreport/reproduce.php
Assume rnz_listing contains
listing_no (int)
listing_id (int)
public_remarks (text)
Expected result:
----------------
Return all content of all fields
Actual result:
--------------
http://www.netconcepts.com/steveh-bugreport/reproduce-output.php
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 22:00:01 2025 UTC | 
In the reproduce code, these 3 work: bind str 255, cast varchar 255 bind str 25600, cast varchar 255 bind null, cast varchar 255 Therefore, binding as strings or null works, if you cast it as a varchar(255). (PDO::PARAM_LOB does not work) However, you have to use bindColumn, and you also have to explicity select that row (no SELECT *). <?php $statement = $pdo->prepare ("SELECT listing_no, CAST(public_remarks AS varchar(255)) AS public_remarks, listing_id FROM rnz_listing"); $statement->execute (); $statement->bindColumn ('public_remarks', $public_remarks); print "PR: $public_remarks\n"; print_r ($statement->fetch (PDO::FETCH_ASSOC)); ?>