Skip to Content.
Sympa Menu

freetds - Re: [freetds] DBD::Sybase doesn't return number of rows affected

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Robert Gonzalez <robert AT robert-gonzalez.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] DBD::Sybase doesn't return number of rows affected
  • Date: Thu, 15 Apr 2010 09:35:47 -0700

I think that might actually actually be the way that MSSQL returns true
values. I ran into this once in a script I was working on where I was
expected a 1 returned for success but got back a -1. Not sure why it does
that, but in almost every case where I expected a boolean true value
expressed as an int I got a -1 in return. Stupid, I know, but manageable
when you know what to expect.

On Thu, Apr 15, 2010 at 1:31 AM, Srdan Dukic <srdan.dukic AT gmail.com> wrote:

> Hi,
>
> I've got a simple perl program which works with a MSSQL database and I am
> using the DBD::Sybase module with the FreeTDS driver to access the
> database.
>
> However, I find that the following code doesn't return the number of rows
> affected correctly:
>
> ...
> $insert = "Lorem Ipsum";
> $query = "INSERT INTO Simple.dbo.test (text) VALUES('$insert')";
> $sth = $dbh->prepare ($query) or die 'prepare failed\n';
> $sth->execute() or die "unable to execute query $query error $DBI::errstr";
>
> $rows = $sth->rows ;
> print "$rows rows returned by query\n";
> .....
>
> But actually produces this output:
>
> -1 rows returned by query
>
> This is strange because I can see in the database that the row is
> definitely
> inserted.
>
> If this is a bug, should I report it under FreeTDS or DBD::Sybase?
>
> Thank you
> --
> Srđan Đukić
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
>



--
Robert Gonzalez
http://www.robert-gonzalez.com
http://twitter.com/RobertGonzalez
http://www.linkedin.com/in/robertanthonygonzalez




Archive powered by MHonArc 2.6.24.

Top of Page