Skip to Content.
Sympa Menu

freetds - Re: Dumb DBD::Sybase question.

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Bob Kline <bkline AT rksystems.com>
  • To: TDS Development Group <freetds AT franklin.oit.unc.edu>
  • Subject: Re: Dumb DBD::Sybase question.
  • Date: Mon, 27 Sep 1999 20:04:08 -0400 (EDT)


On Mon, 27 Sep 1999, Jaye Mathisen wrote:

> playing around with DBD::sybase some more.
>
> Is ->rows only valid after all rows are read?
>
> ie
>
> $sth -> prepare ("some statement");
>
> $sth-> execute;
>
> while ( @x = $sth->fetchrow) {
> $i = $sth->rows;
> }
>
>
>
> $i only gets the correct value after the last row is fetched.
> The rest of the time it's -1;
>
> looking at some DBD::Mysql stuff I have, this doesn't appear
> to be the case there.


The following is from the DBI docs (which you should have if you have
DBI installed):

"rows

$rv = $sth->rows;

Returns the number of rows affected by the last row affecting command,
or -1 if not known or not available.

Generally you can only rely on a row count after a non-select execute
(for some specific operations like update and delete) or after fetching
all the rows of a select statement.

For select statements it is generally not possible to know how many rows
will be returned except by fetching them all. Some drivers will return
the number of rows the application has fetched so far but others may
return -1 until all rows have been fetched. So, use of the rows method,
or $DBI::rows, with select statements is not recommended."

--
Bob Kline
mailto:bkline AT rksystems.com
http://www.rksystems.com





Archive powered by MHonArc 2.6.24.

Top of Page