[DB-SIG] DB-API 1.1

M.-A. Lemburg mal@lemburg.com
Fri, 05 Jun 1998 10:53:32 +0200


Tod Olson wrote:
> 
> >>>>> "M" == M -A Lemburg <mal@lemburg.com> writes:
> 
> M> Things to be considered obsolete:
> M>      arraysize
> M>      setinputsize()
> M>      setoutputsize()
> 
> M>      Completely agree on punting these... fetchmany() would then
> M>      have a mandatory argument instead of an optional one.
> 
> I actually found arraysize to be useful when I implemented array
> binding in a module I was working on.  I could allocate the space for
> the array binding when the user set the variable and avoid doing a
> malloc and free on every call to fetch*.  That is, it was a nice hint
> for handling memory in a place where Python couldn't help me.

But arraysize is only intended as default argument for fetchmany()
-- what if the user decides s/he only wants arraysize/2 or arraysize*2
rows by passing an argument to fetchmany() ?

BTW: You can still optimize malloc/free's by reusing the arrays
for every fetchmany()-call. Calling realloc normally isn't that
costly.

> M> Multiple results sets.
> 
> M>      Same problem as with stored procedures. There doesn't
> M>      seem to be much of a standard and most DBs probably don't
> M>      even support these.
> 
> Sybase certainly does.  It would be good to leave in nextset() for
> those who can use it.

Agreed. It can always return None for databases that don't provide the
functionality.

> A result set object might be nice.  If the database (eg. Sybase) will
> only let you get the result sets in a specific order (ie. no
> simultaneous iteration over mult. sets) it doesn't seem to be that big
> of an improvement.  Does anyone use a database that can return
> multiple result sets to an SQL batch where the DB lets the programmer
> access the sets simultaneously?

ODBC allows multiple result sets too. SQLMoreResults is the
1-1 interface for .nextset(). It only allows to skip to the next
set in the list -- you don't have random access to all of them
(can't even go back to a previous one).

-- 
Marc-Andre Lemburg
----------------------------------------------------------------------
             | Python Pages:  http://starship.skyport.net/~lemburg/  |
              -------------------------------------------------------