[freetds] problem with UPDATE query

Russell Kroboth rkroboth at visitraleigh.com
Thu Feb 27 18:35:38 EST 2003


I am having a problem using the UPDATE statement in a Perl script with my
new Freetds setup, I was wondering if you could tell me if you can see what
I'm missing or if it's even FreeTDS related at all. I am using unixodbc ,
freeTDS and DBD:Sybase. This script does not update the field as expected:

#!/usr/bin/perl
use DBI;
require "DBconnect.cgi";
$dbh = DBI->connect($data_source, $username, $password, 'Sybase') || die
&DBerror;
$dbh->do("use Partners") || die &DBerror;
$sql="UPDATE deals SET accountno = 'somethingelse' WHERE hotdealnum=15";
$rows=$dbh->do($sql) || die &DBerror;
print "$rows affected\n";
exit;

result: "-1 rows affected"


However if I use a different query it works. For example, the following
script works fine:

#!/usr/bin/perl
use DBI;
require "DBconnect.cgi";
$dbh = DBI->connect($data_source, $username, $password, 'Sybase') || die
&DBerror;
$dbh->do("use Partners") || die &DBerror;
$sql="SELECT accountno FROM deals WHERE hotdealnum = 15";
$sth=$dbh->prepare($sql) || die &DBerror;
$sth->execute() || die &DBerror;
$hashref=$sth->fetchrow_hashref();
print "Value is ".$hashref->{'accountno'}."\n";
$sth->finish();
exit;

result: works as expected, can verify looking at actual value using
enterprise manager.


I tried the same query (UPDATE deals SET accountno = 'somethingelse'
WHERE hotdealnum=15) in Query Analyzer on the Windows server and it worked
fine.

I also tried the query using isql from the Linux box, and it worked fine.

No errors are registered by DBD or FreeTDS's FREETDSDUMP in any of these
cases. What else can I look at? Any feedback would be appreciated! Thanks!

-Rusty





More information about the FreeTDS mailing list