[DB-SIG] Remaining issues with DB API 1.1
M.-A. Lemburg
mal@lemburg.com
Sun, 28 Mar 1999 14:24:55 +0200
Mark Hammond wrote:
>
> > [changing the spec for argument of fetchmany()]
>
> I think the spec is fine - maybe just needs to be changed to "if
> it is None or not specified ...".
>
> Then again, explicitely stating the use of "None" makes it a PITA
> for implementations in C - it pretty much means you can't use
> PyArg_ParseTuple(args, "|i", &size);
>
> So to remove some burden on the implementors, it could be stated
> simply as "If it is not specified, then the cursor's arraysize
> determines the number of rows to be fetched.". This
> leaves implementors using C to use PyArg_ParseTuple, but
> implementors in Python to use "def xx(size = None):" - they are
> keeping to the spec, but users are not free to make an assumption
> about what the default is - they know the behaviour, not the
> implementation.
The updated spec now says:
"""
fetchmany([size=cursor.arraysize])
Fetch the next set of rows of a query result, returning a
sequence of sequences (e.g. a list of tuples). An empty
sequence is returned when no more rows are available. The
number of rows to fetch is specified by the parameter. If it is not
given, the cursor's arraysize determines the number of rows to
be fetched.
"""
> No need to specify in the spec exactly _what_ the default should
> be - it seems sufficient to describe the behaviour - ie, "if not
> specified", rather than "the default value is xxx"
Hmm, I don't quite follow you here. Why shouldn't the default
be defined ? [After all, the 1.0 spec also defined the "default"
to be cursor.arraysize.]
If we were not to define the default value, then the definition
of cursor.arraysize would be obsolete w/r to fetchmany():
"""
arraysize
This read/write attribute specifies the number of rows to fetch
at a time with fetchmany(). It defaults to 1 meaning to fetch
a single row at a time.
This value may also be used in the implementation of
executemany().
Implementations must observe it with respect to the
fetchmany() method, but are free to interact with the
database a single row at a time.
"""
Should we drop the reference to fetchmany() in the above definition ?
> [Hey - finally I have something to say here :-]
Everybody should feel free to drop in their 2 *0.01$ :-) ... after
all, the spec update will only become popular if people see some
use in it.
--
Marc-Andre Lemburg Y2000: 278 days left
---------------------------------------------------------------------
: Python Pages >>> http://starship.skyport.net/~lemburg/ :
---------------------------------------------------------