Skip to Content.
Sympa Menu

freetds - Re: [freetds] problem with UPDATE query

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Michael Peppler <mpeppler AT peppler.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] problem with UPDATE query
  • Date: 27 Feb 2003 16:36:12 -0800

On Thu, 2003-02-27 at 15:35, Russell Kroboth wrote:
> 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')

That connect() call is deprecated. Use

$dbh = DBI->connect("dbi:Sybase:server=<servername>", $username,
$password)

instead.

> &DBerror;
> $dbh->do("use Partners") || die &DBerror;
> $sql="UPDATE deals SET accountno = 'somethingelse' WHERE hotdealnum=15";
> $rows=$dbh->do($sql) || die &DBerror;

Turn on tracing and see what really happens:

DBI->trace(3);
$dbh->do($sql);

> print "$rows affected\n";
> exit;
>
> result: "-1 rows affected"

Note that -1 here means that the number of rows affected is not known,
not that an error occurred. Are you positive that no rows are affected?

Michael
--
Michael Peppler Data Migrations, Inc.
mpeppler AT peppler.org http://www.mbay.net/~mpeppler
Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for short or
long term contract positions - http://www.mbay.net/~mpeppler/resume.html




Archive powered by MHonArc 2.6.24.

Top of Page