[DB-SIG] Database API clarifications

Tod Olson Tod Olson <ta-olson@uchicago.edu>
Mon, 02 Feb 1998 09:28:02 -0600


>>>>> "M" == M -A Lemburg <lemburg@uni-duesseldorf.de> writes:

M> Bill Tutt wrote:
>> 
>> > me:
>> > Is that ok ? I'll add it to my API 1.1. draft then.
>> >
>> Well, close, but preferably return None instead of 0, this is Python after
>> all. :)

M> Right -- has a better sound to it :-)

That being the case, how about cursor.nextset() returns self.  Two
benefits:

- Allows cursor.nextset().fetchall(), which is nice for interactive
  typing.

- Works nicely if the database-API evolves to treat result sets as
  objects.

Next question: should a programmer be able to do

 	cursor.execute(big_query)
	while cursor.nextset():
		cursor.fetchall()

to process all the rows of all the results, or must the programmer do

 	cursor.execute(big_query)
	cursor.fetchall()
	while cursor.nextset():
		cursor.fetchall()

I personally prefer the former, since cursor.fetchall will usually be
some larger block of code and need to be duplicated.  Other opinions?

Tod A. Olson                        "How do you know I'm mad?" said Alice.
ta-olson@uchicago.edu               "If you weren't mad, you wouldn't have
The University of Chicago Library    come here," said the Cat.

_______________
DB-SIG  - SIG on Tabular Databases in Python

send messages to: db-sig@python.org
administrivia to: db-sig-request@python.org
_______________