Tim Bunce wrote:
On Thu, Aug 02, 2007 at 04:26:02PM -0400, Philip Dye wrote:
DBD::Proxy version 0.2004
fetch() doesn't set proxy_rows.
disconnect() shouldn't attempt to dereference rdbh if it isn't defined.
Patches attached.
Thanks.
I agree with the second (applied). For the first I suspect it's incomplete.
fetch typically fetches batches of rows. It looks like your patch would
make $sth->rows return the size of the most recent batch, typically 20.
Tim,
You are quite correct. I was too hasty in writing that first patch.
According to the DBI documentation there are actually two approaches in
vogue for select operations:
rows <http://search.cpan.org/%7Etimb/DBI/DBI.pm#___top>
$rv = $sth->rows;
Returns the number of rows affected by the last row affecting
command, or -1 if the number of rows is 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.
I will implement the 'rows fetched so far' model. Oddly enough neither
my earlier fix or this fix will fix the problem I had with
Rose::DB::Object::load() that expects sth->rows() to be greater than
zero if and only if the most recent fetch() has returned a row. I
posted a fix Rose::DB::Object::load() to its mailing list.
Ideally, the implementation of sth->rows() would become standardized so
that its value would be dependable one way or the other after a fetch().
Respectfully,
Philip Dye
Senior Research Systems Programmer
Computing Facilities Group
School of Computer Science
[EMAIL PROTECTED]