[Melbourne-pm] Connecting to a MSSQL 2005 server

Sam Watkins sam at nipl.net
Tue Jun 15 20:20:29 PDT 2010

On Fri, Jun 11, 2010 at 07:45:17PM +1000, David Dick wrote:
> On 11/06/10 12:23, Sam Watkins wrote:
>> For example, with DBD::Sybase and freetds, it appears that if you send an SQL
>> statement using bind variables having 2 or more bound to NULL, it segfaults :S
> This is a interesting case that i wasn't aware of.  I'm a bit snowed  
> under at the moment, but would you be able to post some more details  
> (freetds version, DBD::Sybase version and server type and version) so i  
> could (later on) replicate and fix this issue?

DBD::Sybase           1.10
sybase version, I'm not sure, but I think it doesn't matter as it crashes before it gets to the server (even if the table doesn't exist).

here is a test program that crashes:

use strict; use warnings;

warn "testing a bug, apparently with binding undef -> NULL in DBD::Sybase\n";

use DBI;
my $host = "localhost";
my $port = 2500;
my $db = "test";
my $user = "sa";
my $pass = "Sybase390";
my $connectionstring = "host=$host;port=$port;database=$db";
my $dbh = DBI->connect("dbi:Sybase:$connectionstring", $user, $pass,
                          { RaiseError => 1, AutoCommit => 1 })
    || die "Database connection not made $DBI::errstr";

$dbh->do("DROP TABLE sam_test");
$dbh->do("CREATE TABLE sam_test (ABN CHAR(11) NULL, ACN CHAR(9) NULL)");
$dbh->do("UPDATE sam_test SET ABN = NULL, ACN = NULL");
warn "got to final test, which will crash\n";
$dbh->do("UPDATE sam_test SET ABN = ?, ACN = ?", {}, undef, undef);

More information about the Melbourne-pm mailing list