Skip to Content.
Sympa Menu

freetds - [freetds] freetds silently truncating text/varchar/etc fields to 80 characters

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Robert Jay <bryopsis AT gmail.com>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] freetds silently truncating text/varchar/etc fields to 80 characters
  • Date: Fri, 24 Apr 2009 07:23:27 +1000

Okay, log file attached. I'm not sure how the list handles attachments, but
i'll find out :)

The bit of Perl that does the insert is (which is pretty straightforward):
#!/usr/bin/perl
use warnings;
use DBI;
use DBD::Sybase;

my $dbh = DBI->connect("DBI:Sybase:server=acmt;database=acmt;", "l_acmt_rw",
"l_acmt_rw")
or die("Failed to connect to database");

my $sql = "INSERT INTO test (test_string) VALUES (?)";
my $v =
"a123456789b123456789c123456789d123456789e123456789f123456789g123456789h123456789i123456789j123456789";

my $sth = $dbh->prepare($sql) or die("Error preparing ($sql):
$DBI::errstr");
$sth->execute($v) or die("Error executing ($sql): $DBI::errstr");



The column test_string is defined in the DB as varchar(120). The DB is
running at compatibility level 90, and freetds.conf is set to tds version
8.0. I tried changing both of these around and it didn't make any
difference that I could see.

In the log file at around line #375 you can see it casting the parameter to
varchar(255) - it got cast to varchar(80) before I patched the code.

Hopefully this comes through okay,
Rob.

Attachment: freetds.log
Description: Binary data




Archive powered by MHonArc 2.6.24.

Top of Page