php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13722 mssql text type returns only 255 char
Submitted: 2001-10-17 22:19 UTC Modified: 2006-09-05 18:40 UTC
Votes:18
Avg. Score:4.5 ± 0.8
Reproduced:16 of 16 (100.0%)
Same Version:1 (6.2%)
Same OS:2 (12.5%)
From: brendan at msu dot edu Assigned:
Status: No Feedback Package: Sybase-ct (ctlib) related
PHP Version: 4.2.1 OS: Solaris 2.7
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.
Password:
Status:
Package:
Bug Type:
Summary:
From: brendan at msu dot edu
New email:
PHP Version: OS:

 

 [2001-10-17 22:19 UTC] brendan at msu dot edu
Built with:  
(edited config template to remove uneccessary sybase libs that are not included with freetds -lsybtcl -lcomn -lcs )

./configure --prefix=/home/username/php --with-sybase-ct=../../freetds --with-pgsql=/home/postgres/pgsql --with-apache=../../apache_1.3.22 -enable-track-vars --with-imap=../../imap
make
make install

FreeTDS verified functional using test scripts, and functional through Perl to same DB that PHP is connected to.

Problem: Text type returns only first 255 chars
Expected: >540 chars  (can retrieve through FreeTDS/Perl)

php.ini contains uncommented lines:
mssql.textlimit=8192
mssql.textsize=8192

Query to MSSQL Server:
SELECT @@TEXTSIZE
Returns: 4096
Expected: 8192  (due to php.ini settings?)

Query to MSSQL Server:
SET TEXTSIZE 8192 SELECT @@TEXTSIZE
Returns: 8192
Expected: 8192

Suspect: php.ini not being read
But: other setting changes show up on php_info()
Suspect: mssql settings not being read properly from
         php.info?

Query to MSSQL Server:
SET TEXTSIZE 8192 SELECT our_col FROM our_table;
Returns: only first 255 chars of our_col 
Expected: all 500+ chars in field

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-19 12:55 UTC] fmk@php.net
When you use subase-ct and FreeTDS you are not using the mssql extension, and all the settings in the ini file for mssql is not used.

The settings you are refering to works when you use the mssql extension, though that extension is only available on Win32 platforms.
 [2001-10-19 13:01 UTC] brendan at msu dot edu
Then there still exists a problem with the sybase-ct support for mssql, in that there is no way to specify a TEXTSIZE that allows PHP to support MSSQL 7.0's TEXT type.
Is there not?
 [2002-05-21 11:52 UTC] vedran at quark dot fsb dot hr
I have 4.1.2 and It's still not fixed.

Running my .php  that has a query "SELECT sometexttypefield FROM sometable"; with /usr/bin/php4 results in ;FATAL:  emalloc():  Unable to allocate -2147483648 bytes.

So it's definately some a bug and it probably can be solved if we know where this mailloc is called.
 [2002-07-26 23:42 UTC] systematic11 at comcast dot net
As of version 4.2.1, this issue has still not been corrected. Perhaps the problem lies with FreeTDS.
Apparently neither the CT-Lib and DB-Lib for Sybase have no use for this property (MSSQL TEXT SIZE).

If you must connect to MS SQL Server from PHP, I would suggest creating an include file that is included at the top of any PHP script that needs to access the MS SQL Server. Let the include file open a connection and call a query to "set textsize 65536" or to whatever limit you want.

e.g.

<?php

// include file for MS SQL server

$HOSTNAME = "SQLServer70";
$USERNAME = "sa";
$PASSWORD = "??";

$conn = mssql_pconnect($HOSTNAME, $USERNAME, $PASSWORD);

if ($conn) {
  mssql_query("SET TEXTSIZE 65536");
  mssql_select_db("whatever", $conn);
}

?>

Kelly Akins
 [2002-08-13 23:41 UTC] kalowsky@php.net
try doing a "SET TEXTSIZE <some really large number here>" in an exec command.  
 [2002-08-13 23:41 UTC] kalowsky@php.net
updating version as well.
 [2002-09-14 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2006-09-05 09:21 UTC] hostmak at gmail dot com
problem still exists....ideas ? :|
 [2006-09-05 18:40 UTC] fmk@php.net
Make sure you set TDS Version to 7 or 8. You can do this in freetds.conf where you define your server connection.
 [2007-10-02 10:45 UTC] nsthinh1201 at yahoo dot com
Hi, I have a problem when i used php_printer.dll.
I create a file name print.php (set default encoding is utf-8), this file read data from MySQL and it run will print direct information to page.
My Db default charset is UTF-8 (i'm from vietnam).This problem is print.php read and print to page then it not show vietnamese.
Please! help me,use php print direct to page show vietnamese.
All information you send to me with email (nsthinh1201@yahoo.com).
Thank you! (sorry, i speak english very bad!).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jul 25 05:01:29 2024 UTC