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

M.-A. Lemburg mal@lemburg.com
Wed, 22 Jan 2003 17:14:04 +0100


Jon Erickson wrote:
> On Tue, 2003-01-21 at 13:47, Dieter Maurer wrote:
> 
>> > Passing None as max_rows to mean "no limits" is much more
>> > meaningful here, IMHO.
>>The problem here is, that the value should be changable by the ZMI.
>>There, "None" for "no limits" and an integer for "that many rows"
>>is not very good, as the content managers may not know Python.
> 
> 
> How about a null max_rows value to equal "no limits".  If the content
> manager wants all rows from the query returned, he leaves max_rows
> blank.  If he wants to restrict the size of the result set, he can
> provide an integer value.
> 
> To me, it seems non-intuative that a max_rows value of "0" == "return
> all rows".

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.

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.

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

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
_______________________________________________________________________
eGenix.com -- Makers of the Python mx Extensions: mxDateTime,mxODBC,...
Python Consulting:                               http://www.egenix.com/
Python Software:                    http://www.egenix.com/files/python/