Bug #38805 [Com]: PDO Truncates Text from SQL Server Text Data Type Field

From: Date: Tue, 03 Oct 2017 17:41:33 +0000
Subject: Bug #38805 [Com]: PDO Truncates Text from SQL Server Text Data Type Field
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-211501@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=38805&edit=1

 ID:                 38805
 Comment by:         ryan dot brainerd at gmail dot com
 Reported by:        gkrajci at arescorporation dot com
 Summary:            PDO Truncates Text from SQL Server Text Data Type
                     Field
 Status:             Closed
 Type:               Bug
 Package:            PDO related
 Operating System:   Windows NT PBMA-WB2 5.2 build 37
 PHP Version:        5.1.6
 Assigned To:        ssufficool
 Block user comment: N
 Private report:     N

 New Comment:

i am using PDO with SQL Server 2013 trying to SELECT large JSON strings and was hitting this issue

according to SQL Server docs, "SET TIMEOUT -1" indicates unlimited size and fixed the
problem for me as well, better than limiting to 3MB as in previous solution

this had to be executed first in a separate query, and then my SELECT could be executed

i am including this as a standard 'pre query' now when using PDO + MSSQL, so i do not have
to remember to do this for every large column. it does not seem to impact performance when used this
way, but if anyone has info otherwise a post would be appreciated

good luck all


Previous Comments:
------------------------------------------------------------------------
[2014-11-06 20:44:00] desiovincenzo at gmail dot com

hi all

you can solve this issue by using the sql convert function as below : 

SELECT CONVERT(TEXT,field) as field_name from table

hope it is useful for someone

byez

------------------------------------------------------------------------
[2012-09-13 04:35:07] ssufficool@php.net

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.



------------------------------------------------------------------------
[2011-12-04 02:48:51] ssufficool@php.net

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.



------------------------------------------------------------------------
[2010-12-17 21:07:48] kalle@php.net

.

------------------------------------------------------------------------
[2010-03-04 20:55:06] juan dot pineda at resultstel dot com

I solved this problem by adding to my php script a TEXTSIZE that is less than the allowed memory
from the MSSQL server. 

Remember, all the number are in Bytes, so I kept playing with the numbers, until this worked:
// ranges from 0 - 3145728 = 3Megabytes.  Default to 4096.
$sql = "SET TEXTSIZE 3145728";
mssql_query($sql, $db) or die(mssql_get_last_message());

Remember to always know what the allowed upload size for your server is.

I hope this helps someone

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=38805


--
Edit this bug report at https://bugs.php.net/bug.php?id=38805&edit=1


Thread (42 messages)

« previous php.bugs (#211501) next »