[Zope-DB] Getting a cursor?

Paul Winkler pw_lists at slinkp.com
Thu Sep 28 12:16:54 EDT 2006

On Thu, Sep 28, 2006 at 06:11:01PM +0200, Charlie Clark wrote:
> Am 28.09.2006, 17:30 Uhr, schrieb Paul Winkler <pw_lists at slinkp.com>:
> >>conn.callproc(procedure_name, params)
> >>while True:
> >>    rset = conn.fetchone()
> >No dice, it barfs on that line:
> >Traceback (most recent call last):
> >  File "<stdin>", line 2, in ?
> >AttributeError: DatabaseConnection instance has no attribute 'fetchone'
> >And, as I pointed out in my original post, DatabaseConnection.callproc()
> >has a different API from cursor.callproc(). Per my experimentation,
> >cursor.callproc() gets (but does not return) all result sets, which can
> >then be accessed via cursor.fetchone(), cursor.nextset() etc.
> >But DatabaseConnection.callproc() simply returns either the first or
> >last result set, depending on your configuration.  All other result sets
> >are discarded.
> >Thanks for the help though. Any other suggestions?
> Ah, okay.
> You can get a cursor on the connection of the connection object:
> c = conn.connection.cursor()
> c.execute("whatever")
> c.fetchone()
> Does that work for you?

Yes! Thank you very much.

Somehow I failed to notice that the connection had a connection


Paul Winkler

More information about the Zope-DB mailing list