On Tuesday 01 Oct 2002 12:14 pm, Felix Geerinckx wrote:
> on Tue, 01 Oct 2002 10:50:26 GMT, [EMAIL PROTECTED]
>
> (Gary Stainburn) wrote:
> > Nobody's mentioned:
> >
> > $countrow=$sth->rows;
> >
> > This way is more efficient that doing the 'select count(*)' as
> > it's done from the same select query, and it also means that yo
> > know beforehand how many rows you will be reading, which is often
> > usefull, and is not possible if you use the countrow++ method.
>
> Unfortunately, my DBI documentation mentions:
>
>     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.

Now that you mention it, I do remember reading that section, but in my 
experience, using  PostgreSQL and DBI/DBD::Pg I've never had a problem.

As the OP was using MySQL this may not work - I've never used MySQL.
-- 
Gary Stainburn
 
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000     


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to