DBI spec

M.-A. Lemburg mal at lemburg.com
Thu Jan 20 13:44:22 EST 2000


Timothy Grant wrote:
> 
> More questions regarding the DBI spec:

These should go to the DB DIG, not the main list...
 
> First, is it possible to walk backward through a cursor? All the
> fetchXXX() functions appear to only move forwards, however, one of my
> SQL books mentions the ability to move backwards as well as forwards.

Cursors are not widely supported by the different DB interfaces.
mxODBC is one that does allow naming cursors. Still, there
are no specific methods to walk in different directions. You
DB may have support for this through SQL statements though.
 
> Second, and very much related to the first, how are the results of a
> cursor query stored, are they stored in temporary storage on disk, are
> they loaded in memory, etc.

Depends on the driver. The Python interfaces only fetch the
data from the driver (and then create Python datatypes out of
it).
 
> Third, at the moment, given the current size of the results that my
> queries retrieve, I can implement the backward cursor movement by using
> fetchall() and traversing the resultant list, however, I can forsee
> that, given a large result set, that method will cause grief, how have
> others resolved the bi-directional cursor traversal issue?

I'd suggest playing some tricks with VIEWS and auto-increment
columns... depends on the database how exactly that would
have to be done. Stored procedures are also a nice way to
implement these things, but again very DB dependent.

-- 
Marc-Andre Lemburg
______________________________________________________________________
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/





More information about the Python-list mailing list