[Zope-DB] Can I manipulate a recordset returned by ZSQL-method?

Herbert Sitz hsitz@nwlink.com
Sat, 13 Oct 2001 13:09:20 -0700


Thanks for the suggestions.

One thing I'm wondering about is whether the solutions you're suggesting
will allow me to still use my ZSQL methods.  I like the way I can use them
within Zope, and merely being able to access data stores with ADO would not
be a complete step up; I'm looking for a method that I can integrate with
existing methods that fit within the Zope philosophy.

What I'm really looking for is a way to have a cursor object into a ZSQL
method, and I don't care how I get it.

I just discovered that I can access the result object of a ZSQL method,
which gets me part way to where I want to go.  At least it lets me retain
and process results rather than having the query results disappear
immediately.   (Found info on this at
http://www.zope.org/Members/spinwing/ZSQL_Results and on p. 209 of the Zope
book.)

It seems to me as though ZSQL methods must be using the cursor object of the
Python DB API, since, for example, how else could they get the Testing
interface to show 50 records at a time and give you a link to retrieve the
next 50 or previous 50 records.  What I want is a cursor into the ZSQL query
that can allow me to to use the DB API's fetchone, fetchmany, fetchnext
methods so that I can navigate through the query recordset without
retrieving all the data.   I'm indifferent to whether I can do this through
the existing Zope DB API, a grafted on ADO connection, or whatever.

I've been looking through the ZSQL, Aqueduct, DA source, but I'm new to
Python and am having trouble grokking it.

Thanks again for your help.  I'm open to any other advice on how I can do
what I want to do, and on whether any proposed ADO solution can be
integrated as providing a cursor to ZSQL methods.  I believe I read a
message by someone that said he had basically done this, but it had no
explanation and I got no response on an email that I sent to him.

Thanks again

Herb Sitz