Re: DBD::Sybase doesn't return number of rows affected

Srdan Dukic <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
On 16 April 2010 04:35, Robert Gonzalez <[email protected]> wrote:

> 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.
>

Woops. I just realised that I made a mistake in describing the problem. The
code returns the correct number of rows on insert statements, but when I do
a select statement:

...
$query = "SELECT * FROM Simple.dbo.test";
$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";
.....

It outputs:

-1 rows returned by query

Not sure if this is intended behaviour (i.e. there is another way to get the
number of rows returned) or a bug.


-- 
Srđan Đukić
_______________________________________________
FreeTDS mailing list
[email protected]
http://lists.ibiblio.org/mailman/listinfo/freetds
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.