in reply to Perl Database Select Results Being Truncated

Greetings all,
Disclaimer: The following is a best guess. I am by no means a Sybase guru.
My first question would be, are you sure the datatype should be varchar(1000)?
That seems to ring a bell in my memory about varchar size limit being <=255 or something like that.
Perhaps Sybase is converting it internally into something like a TEXT field or Blob since you mentioned that a direct query gives you the results you are looking for? I am wondering if Sybase is labeling the column as a varchar when Perl is trying to use it? possibly leading to the clipping you are seeing.
Not really an answer I know but one thing to possibly try is changing the datatype of that column to a Text/Blob and read the docs about LongReadLen to figure out how to fetch it out.

-InjunJoel

"I do not feel obliged to believe that the same God who endowed us with sense, reason and intellect has intended us to forego their use." -Galileo
  • Comment on Re: Perl Database Select Results Being Truncated

Replies are listed 'Best First'.
Re^2: Perl Database Select Results Being Truncated
by Anonymous Monk on Apr 28, 2005 at 16:13 UTC
    I'll talk to our database team. I originally wanted a blob type, but they said that they would give me a varchar 1000 to fit my need, but that raises a good point if Perl somehow truncates based on the 255 typical limitation of varchar. The thing that confuses me though is that if 255 is the varchar limit, why the sybase dbase allows it, and allows for me to do a command like select and retrieve the entire entry?

    Thanks again for any continued assistance.
      Hi again-

      I've tried the LongReadLen, and it still truncates. The database team has said that they kept the type varchar to save space in the database, and that it is possible to go over the 255 character contstraint for the varcar, so I am at a loss why the truncation still happens. Here is a clip of the new code with the LongReadLen attribute set:


      $dbh->{LongReadLen} = 65536;
      $statement = 'SELECT Description FROM DevelopmentTool WHERE ShortName like "%PSP%"';
      $sth = $dbh->prepare($statement);
      $sth->execute;

      while (($Description) = $sth->fetchrow) {

      print $Description . "\n\n";

      }
      Talk soon.