[Zope-DB] Re: ZPsycopgDA (version 1.0.13) problems

Jon Erickson jon.erickson@neicoltech.org
22 Jan 2003 11:20:28 -0600


On Wed, 2003-01-22 at 10:14, M.-A. Lemburg wrote:
> If think that there is a bit of confusion here: if may_rows is
> not given, then all rows are returned. If it is given, then
> the passed in value should state the number of rows to fetch.

Yes, there was definitely some confusion on my part.
 
> Now, some DAs seem to use 0 as default value of the max_rows
> keyword parameter and have special code telling the method
> to return all rows if 0 is seen as value of max_rows. I don't
> believe that this is documented anywhere as the standard, though,
> so it should be regarded as implementation detail, IMHO.

Yes it's an implementation detail but it makes the code harder to read
unnecessarily.  There is no documented standard from what I can tell
either, however, the DB class's query method in the zope source
($ZOPE_HOME/lib/python/Shared/DC/ZRDB/dbi_db.py) uses 9999999 as the
default value for max_rows.  I think that when no standards are
documented, one should look for inspiration from the zope source; though
I'm not sure how I feel about 9999999 either.

> FWIW, I've changed the mxODBC Zope DA to simply check max_rows
> for truth: if it's false, then all rows are returned. (I'm
> using None as default keyword parameter value.)

That seems like a good method.

Jon