|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57147 PDO_MSSQL does not appear to return LOBs as streams
Submitted: 2006-07-19 22:18 UTC Modified: 2017-03-01 22:33 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: pdo at seven dot net dot nz Assigned:
Status: Open Package: PDO DBlib
PHP Version: 5.1.2 OS: Win32
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: pdo at seven dot net dot nz
New email:
PHP Version: OS:


 [2006-07-19 22:18 UTC] pdo at seven dot net dot nz
Returning a column as a LOB with PDO_MSSQL does not appear to return the column as a stream, as the documentation implies, it returns as a string, with a max size of 4096. Am I doing something wrong?

Failing that, is there any other way to fetch >4096 characters?

Reproduce code:
Assume article is a table containing id (int) and body (text) or (varchar(max))

$query = "SELECT body FROM article WHERE id = 1";
$statement = $database->prepare ($query);
$statement->execute (array ());

$statement->bindColumn (1, $id, PDO::PARAM_STR, 12);
$statement->bindColumn (2, $body, PDO::PARAM_LOB);

$statement->fetch (PDO::FETCH_BOUND);

var_dump ($body);

Expected result:

Actual result:
string(4096) (truncated)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-12-24 06:38 UTC]
Changing the return type _will_ break existing scripts. I am for returning them as streams since this coincides with the dbreadtext DBLIB function to stream a text or image field may avoid consuming PHP memory on large objects. It also agrees with the PDO_PGSQL return type.
 [2017-03-01 22:33 UTC]
-Package: PDO +Package: PDO DBlib
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Oct 15 21:03:43 2021 UTC