Re: String truncated to 255 chars using DBD::Sybase with MSSQL

[email protected] Mon, 18 May 2009 13:27:22 -0400
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase
Message-ID <OF787783C1.38E2DE2F-ON852575BA.005FB0E5-852575BA.005FE2E3@evergreeninvestments.com>
<br><font size=2 face="sans-serif">It sounds like you have a ct-lib from
version 12.0 or older... Version 12.5 allowed strings longer than 255.</font>
<br>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>&quot;Ed Avis&quot; &lt;[email protected]&gt;</b>
</font>
<br><font size=1 face="sans-serif">Sent by: [email protected]</font>
<p><font size=1 face="sans-serif">05/18/2009 01:06 PM</font>
<td width=59%>
<table width=100%>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td><font size=1 face="sans-serif">&lt;[email protected]&gt;</font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td><font size=1 face="sans-serif">String truncated to 255 chars using
DBD::Sybase with MSSQL</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><tt><font size=2>I am using DBD::Sybase on Linux (Fedora 10) to connect
to an MSSQL server (Microsoft SQL Server 2000). &nbsp;The database allows
varchar columns greater than 255 characters in length, but when querying
from them the result is silently truncated.<br>
<br>
 &nbsp; &nbsp;my $long_string = 'x' x 200;<br>
 &nbsp; &nbsp;$dbh-&gt;do(&quot;select '$long_string' + '$long_string'
as x into #t&quot;);<br>
<br>
 &nbsp; &nbsp;my $sql = 'select len(x) from #t';<br>
 &nbsp; &nbsp;my $got = $dbh-&gt;selectall_arrayref($sql)-&gt;[0]-&gt;[0];<br>
 &nbsp; &nbsp;say $got;<br>
<br>
 &nbsp; &nbsp;$sql = 'select x from #t';<br>
 &nbsp; &nbsp;$got = $dbh-&gt;selectall_arrayref($sql)-&gt;[0]-&gt;[0];<br>
 &nbsp; &nbsp;say length $got;<br>
<br>
This prints '400' then '255' but I expected '400' and '400', or at least,
some exception thrown when the string was too long.<br>
<br>
Is there a way to access the whole string using DBD::Sybase?<br>
<br>
-- <br>
Ed Avis &lt;[email protected]&gt;<br>
<br>
______________________________________________________________________<br>
This email has been scanned by the MessageLabs Email Security System.<br>
For more information please visit http://www.messagelabs.com/email <br>
______________________________________________________________________<br>
<br>
</font></tt>
<br>