3
3
3ds2010-11-23 12:14:30
PHP
3ds, 2010-11-23 12:14:30

MSSQL and php.ini mssql.textlimit

The situation is this:
in the database there are pictures in base64 in a field of type text
when the field is received from php by a regular request - the field with the picture is truncated to 4096 bytes.
How to get a field of normal length?
I set mssql.textlimit = 2147483647 in php.ini

mssql.textsize =
2147483647

- does not help ... I
also found this solution: - the result is the same - only 4096 bytes are returned, i.e. early part of the picture. Has anyone encountered this and how did you solve it? Now it is decided by a stored procedure that collects everything in a temp table and returns, and then the script glues the lines - well, these solutions, to put it mildly, do not impress me very much :)

$q = $db->query ('SET TEXTSIZE 2147483647');
$q->fetchAll();
ini_set ('mssql.textlimit' , '2147483647');
ini_set ('mssql.textsize' , '2147483647');
$q = $db->query("select CONVERT(TEXT, img) from [shop].[dbo].[news_image] WHERE id = $id");
$res = $q->fetchAll();



Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dorbah, 2014-06-09
@Dorbah

It works for me like this:

mssql_connect($mssql_host, $mssql_user, $mssql_pass) or die('Error connecting to database');
mssql_query("SET TEXTSIZE 2147483647");
$att=mssql_query("SELECT TheName, MimeType, TheSize, Content
  FROM [$mssql_base2].[dbo].[Document] WHERE ID='$attachmentID'");
if ($row_att = mssql_fetch_array($att, MSSQL_ASSOC) ) {
  $TheName=$row_att['TheName'];
  $MimeType=$row_att['MimeType'];
  $TheSize=$row_att['TheSize'];
  $Content=$row_att['Content'];
  print $Content;
}#end if

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question