php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57055 Text fields not returned very easily
Submitted: 2006-05-31 22:00 UTC Modified: 2006-10-10 22:18 UTC
From: pdo at seven dot net dot nz Assigned: wez (profile)
Status: Closed Package: PDO_ODBC (PECL)
PHP Version: 5.1.2 OS: Windows XP
Private report: No CVE-ID: None
 [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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-31 23:20 UTC] wez@php.net
Can you give an example of how you successfully get the text field out?
 [2006-05-31 23:26 UTC] pdo at seven dot net dot nz
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));
?>
 [2006-05-31 23:27 UTC] pdo at seven dot net dot nz
By explicitly select that row, I mean explicity select and cast that column.
 [2006-06-01 00:21 UTC] pdo at seven dot net dot nz
For what it's worth, this all works fine with the MSSQL PDO_DBLIB library, so that's what I'm now using. It's deprecated though, so not the ideal solution.
 [2006-10-10 22:18 UTC] wez@php.net
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.

I'm fairly sure that this is the same thing as PECL #8944 (http://pecl.php.net/bugs/bug.php?id=8944) which was just fixed in CVS.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 01:01:28 2024 UTC