php.net |  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
Votes:1
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
Have you experienced this issue?
Rate the importance of this bug to you:

 [2006-07-19 22:18 UTC] pdo at seven dot net dot nz
Description:
------------
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))

<?php
$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:
----------------
stream(>4096)

Actual result:
--------------
string(4096) (truncated)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-12-24 06:38 UTC] ssufficool@php.net
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] adambaratz@php.net
-Package: PDO +Package: PDO DBlib
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Mar 24 13:01:25 2019 UTC