Skip to Content.
Sympa Menu

freetds - 4K limit for a text field?

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Benji Spencer" <ben.spencer AT moody.edu>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: 4K limit for a text field?
  • Date: Fri, 26 Jul 2002 09:51:40 -0400


I looked around the list, and haven't found the answer. Hopefully there is
one :)

Linux RH 7.1
FreeTDS 0.53

PHP 4.2.2 (CGI/CLI)

Perl 5.6.1
DBI 1.30
DBD Sybase 0.94

I first ran into this problem using the above Perl (and module) versions.
I am trying to retrieve data from a MSSQL (2K) server which is contained
within a text field. If I try to retrieve this data, I end up with only
the first 4K (4096 bytes) of it. The rest is truncated. Since Perl failed,
I popped over to PHP, and tried the same thing. The CLI version of PHP
retuned 4K of data, however, if I use the same script via the web with a
PHP module of Apache, it returns the all the data. Setting LongReadLen
doesn't seem to have any affect. Any ideas of what this limitation is, or
getter yet, any way around it?

my scripts...

1) PERL Script
#!/usr/local/bin/perl

# we need DBI to connect to the databases
use DBI;

$ENV{SYBASE}="/usr/local/freetds";
$dbuser="xx";
$dbpass="xx";
$dbserver="testmssql";
$db=DBI->connect("dbi:Sybase:server=$dbserver;database=somedatabase",$dbuser,$dbpass);


$sql="select textvalue from largetext where
parentguid='FBE660DD3ED75FFCA0B6FEEAFB0B9B86'";
$sth=$db->prepare($sql);
$sth->execute;

($textvalue)=$row->fetchrow_array;

print length($textvalue) . "\n";

> Returns: 4096

2) PHP (CGI) script
#!/usr/local/bin/php -q
<?
$ms_conn=mssql_pconnect(testmssql",'xx','xx');
mssql_select_db("somedatabase");
$sql="select textvalue from largetext where
parentguid='FBE660DD3ED75FFCA0B6FEEAFB0B9B86'";
$result=mssql_query($sql);
$row=mssql_fetch_array($result);

print strlen($row[textvalue]) . "\n";
?>

> Returns: 4096


3) PHP (Apache Module)
<?
$ms_conn=mssql_pconnect("testmssql",'xx','xx');
mssql_select_db("somedatabase");
$sql="select textvalue from largetext where
parentguid='FBE660DD3ED75FFCA0B6FEEAFB0B9B86'";
$result=mssql_query($sql);
$row=mssql_fetch_array($result);

print strlen($row[textvalue]);

?>

> Returns: 11270

4) Interfaces snippet
testmssql
query tcp tds7.0 xxx.xxx.xxx.xxx 1433

5) php.ini snippet (for CGI)
sybase.interface_file=/usr/local/freetds/interfaces



  • 4K limit for a text field?, Benji Spencer, 07/26/2002

Archive powered by MHonArc 2.6.24.

Top of Page