php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26876 Query only gets the first 4096 bytes
Submitted: 2004-01-12 03:26 UTC Modified: 2004-01-12 08:19 UTC
From: agnerm at aloc dot dk Assigned:
Status: Not a bug Package: MSSQL related
PHP Version: 4.3.4 OS: Windows 2000
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: agnerm at aloc dot dk
New email:
PHP Version: OS:

 

 [2004-01-12 03:26 UTC] agnerm at aloc dot dk
Description:
------------
When trying to get a IMAGE-field from a MSSQL database I only get the first 4096. 



Reproduce code:
---------------
function SQL($sqlStatement)
{
 global $sqlConnection,$sqlDB;
 mssql_select_db($sqlDB,$sqlConnection) or die("fejl ved \"connection\" til databasen ($sqlDB)");
 $rs = mssql_query($sqlStatement,$sqlConnection) or die("Fejl i Sql-".nl2br($sqlStatement));
 return $rs;
}

function SQL2D($sqlStatement,$antal=-1)
{
 global $sqlConnection,$sqlDB;
 $dataArray="";
 $rs=SQL($sqlStatement,$sqlDB);
 if (mssql_num_rows($rs)==0) return null;
 if ($antal==-1) $antal=mssql_num_rows($rs);
 for ($y=0;(($y<mssql_num_rows($rs))&&($y<$antal));$y++)
 {
    $row = mssql_fetch_row($rs);
    for($i=0;$i<count($row);$i++)
    {
       $dataArray[$y][mssql_field_name($rs,$i)]=$row[$i];
    }
 }
 return $dataArray;
}
SQL("SET TEXTSIZE 512000");
SQL2D_out("SELECT @@TEXTSIZE");
$fil=SQL2D("SELECT len= DATALENGTH(dbo.nyheder.fil),dbo.nyheder.fil  from dbo.nyheder where nyhederid=9");

echo $fil[0]["len"];
echo "\n<br>";
echo strlen ($fil[0]["fil"]);

Expected result:
----------------
<table border=1>
 <tr>
  <td>computed</td>
 </tr>
 <tr>
  <td>512000</td>
 </tr>
</table>
34510
<br>34510

Actual result:
--------------
<table border=1>
 <tr>
  <td>computed</td>
 </tr>
 <tr>
  <td>512000</td>
 </tr>
</table>
34510
<br>4096

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-12 07:01 UTC] sniper@php.net
From manual comments for mssql_query():

"if you're experiencing truncates of your binary data read from mssql database (it looks like incomplete, broken or even no images) check mssql section of your php.ini file and set values of mssql.textlimit and mssql.textsize variables to their maximum (2147483647) or at least bigger size than the default is"

 [2004-01-12 08:19 UTC] agnerm at aloc dot dk
This is my setting... It does not work :(... phpinfo() reports: 

mssql.textlimit Server default Server default 
mssql.textsize Server default Server default 

[MSSQL]
mssql.secure_connection = On

; Allow or prevent persistent links.
mssql.allow_persistent = On

; Maximum number of persistent links.  -1 means no limit.
mssql.max_persistent = -1

; Maximum number of links (persistent+non persistent).  -1 means no limit.
mssql.max_links = -1

; Minimum error severity to display.
mssql.min_error_severity = 10

; Minimum message severity to display.
mssql.min_message_severity = 10

; Compatability mode with old versions of PHP 3.0.
mssql.compatability_mode = Off

; Valid range 0 - 2147483647.  Default = 4096.
;mssql.textlimit = 2147483647

; Valid range 0 - 2147483647.  Default = 4096.
;mssql.textsize = 2147483647

; Limits the number of records in each bach.  0 = all records in one batch.
;mssql.batchsize = 0
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 18:01:30 2024 UTC