ODBC bug large image parameter

Matthew McGillis <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
With intel 64 running Red Hat Enterprise Linux Server 6.1 using FreeTDS 0.82, unixODBC 2.3.0, perl 5.10 and DBD::ODBC 1.29.

Connecting to a Windows box with Microsoft SQL Server 2005 - 9.00.4035.00 (X64)

If I create this stored procedure in a database.

"create procedure testbug @data image as begin return end"

Then create a script "bug" with the following:

#!/usr/bin/perl

use DBI;

my $dbh=DBI->connect("dbi:ODBC:".$ENV{DB},$ENV{USER},$ENV{PASS},
                   {PrintError => 1, RaiseError=> 1}) ||
  die "Failed DB connect: ".$dbh->errstr;


my $query = qq/{call testbug( ? )}/;
my $sth = $dbh->prepare($query);

my $name="";
while (true) {
$name.="a";
$sth->bind_param(1,$name, -4);
$sth->execute() || die $dbh->errstr;
print length($name)."\n";
}

The "bug" script will die when $name reaches 32768 chars with the message:

DBD::ODBC::st execute failed:     Unable to fetch information about the error at ./bug line 17.

however if I replace the query so it includes a ";" at the end like:

my $query = qq/{call testbug( ? )};/;

The code will not die at 32768 chars  and goes way beyond (never actually let the program run long enough to determine if it ever does die at some other larger limit).

Matthew
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.