[DB-SIG] Re: oracle db module status (fetchall behavior)
Fri, 04 Dec 1998 09:53:45 -0500
At 06:46 PM 12/3/98 -0800, Greg Stein <firstname.lastname@example.org> wrote:
>If that is the behavior, then the modules are *wrong*. fetchall()
>should return *all* the rows, memory-be-damned. The fetchall() method
>was specified at the request of a number of users; Joel Shprentz was the
>specific motivator, as I recall -- he had some excellent arguments for
The "specific motivator" recalls ...
Many of the usual suspects discussed these issues during a lunch break at
the 1995 Python Workshop in Reston, Virginia.
As I write this message on a PC with 96 MB of memory, my principal argument
seems even more valid: In most cases we know that our computers have ample
real and/or virtual memory to hold all the rows that will be returned by an
When main memory was tiny, programs had to be structured to process each
row as it was retrieved. Now object models and program structures can
become cleaner and simpler because we can pass a retrieved array of rows to
some function that acts upon them. Or, better yet, encapuslate the array
and/or individual rows in objects and define methods that act on those objects.
I still find uses for fetchone and fetchmany. I use fetchone when I want
the first (last, worst, best, etc.) record from a list. For example, the
best selling product or the first unprocessed order. I use fetchmany when
I want to display a fixed number of results on a screen or when I want the
top (bottom, first, last, worst, best, etc.) records from a list. For
example, I may want to display only 25 result records on a web page. Or I
may want to retrieve Dave Letterman's top 10 list.
Joel Shprentz (202) 863-3487
BDM Federal, Inc. email@example.com
1501 BDM Way
McLean, VA 22102